From 190fe7347cfd6fab67f37c7535c4fa9b8f0870de Mon Sep 17 00:00:00 2001 From: Raghav R V Date: Mon, 9 Mar 2015 05:55:13 +0530 Subject: [PATCH 1/3] FIX Include PyFuncDistance attributes while pickling. --- sklearn/neighbors/dist_metrics.c | 17919 +++++++++++++++------------ sklearn/neighbors/dist_metrics.pyx | 5 + 2 files changed, 9767 insertions(+), 8157 deletions(-) diff --git a/sklearn/neighbors/dist_metrics.c b/sklearn/neighbors/dist_metrics.c index 798286fccd47b..db9050a7254b7 100644 --- a/sklearn/neighbors/dist_metrics.c +++ b/sklearn/neighbors/dist_metrics.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jun 7 15:44:25 2014 */ +/* Generated by Cython 0.21.2 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -16,10 +16,11 @@ #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+. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) + #error Cython requires Python 2.6+ or Python 3.2+. #else -#include /* For offsetof */ +#define CYTHON_ABI "0_21_2" +#include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif @@ -53,83 +54,29 @@ #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 __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) - #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) - #define PyVarObject_HEAD_INIT(type, size) \ - PyObject_HEAD_INIT(type) size, - #define PyType_Modified(t) - typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; - } Py_buffer; - #define PyBUF_SIMPLE 0 - #define PyBUF_WRITABLE 0x0001 - #define PyBUF_FORMAT 0x0004 - #define PyBUF_ND 0x0008 - #define PyBUF_STRIDES (0x0010 | PyBUF_ND) - #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) - #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 *); +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 +#define Py_OptimizeFlag 0 #endif +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" #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) + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) -#endif -#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 - #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") + #define __Pyx_DefaultClassType PyType_Type #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 < 0x02060000 - #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE) + #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 @@ -137,13 +84,34 @@ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) + #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) + #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s) +#endif +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type @@ -152,35 +120,12 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif -#if PY_VERSION_HEX < 0x02060000 - #define PyBytesObject PyStringObject - #define PyBytes_Type PyString_Type - #define PyBytes_Check PyString_Check - #define PyBytes_CheckExact PyString_CheckExact - #define PyBytes_FromString PyString_FromString - #define PyBytes_FromStringAndSize PyString_FromStringAndSize - #define PyBytes_FromFormat PyString_FromFormat - #define PyBytes_DecodeEscape PyString_DecodeEscape - #define PyBytes_AsString PyString_AsString - #define PyBytes_AsStringAndSize PyString_AsStringAndSize - #define PyBytes_Size PyString_Size - #define PyBytes_AS_STRING PyString_AS_STRING - #define PyBytes_GET_SIZE PyString_GET_SIZE - #define PyBytes_Repr PyString_Repr - #define PyBytes_Concat PyString_Concat - #define PyBytes_ConcatAndDel PyString_ConcatAndDel -#endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else - #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ - PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) -#endif -#if PY_VERSION_HEX < 0x02060000 - #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) - #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) @@ -201,11 +146,17 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif -#if PY_VERSION_HEX < 0x03020000 +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif +#if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong @@ -213,42 +164,10 @@ #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) - #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) -#else - #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) - #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) - #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) -#endif #if 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)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) -#else - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) - #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)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #else - #define __Pyx_NAMESTR(n) (n) - #define __Pyx_DOCSTR(n) (n) + #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) @@ -264,7 +183,7 @@ #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) + #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict @@ -284,6 +203,12 @@ static CYTHON_INLINE float __PYX_NAN() { return value; } #endif +#ifdef __cplusplus +template +void __Pyx_call_destructor(T* x) { + x->~T(); +} +#endif #if PY_MAJOR_VERSION >= 3 @@ -339,18 +264,30 @@ static CYTHON_INLINE float __PYX_NAN() { # endif #endif typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \ + (sizeof(type) < sizeof(Py_ssize_t)) || \ + (sizeof(type) > sizeof(Py_ssize_t) && \ + likely(v < (type)PY_SSIZE_T_MAX || \ + v == (type)PY_SSIZE_T_MAX) && \ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \ + v == (type)PY_SSIZE_T_MIN))) || \ + (sizeof(type) == sizeof(Py_ssize_t) && \ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \ + v == (type)PY_SSIZE_T_MAX))) ) static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize @@ -358,17 +295,19 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif +#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) -#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; - return u_end - u - 1; + return (size_t)(u_end - u - 1); } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen @@ -382,7 +321,6 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -391,19 +329,22 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params() { - PyObject* sys = NULL; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; + const char* default_encoding_c; sys = PyImport_ImportModule("sys"); - if (sys == NULL) goto bad; + if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - if (default_encoding == NULL) goto bad; - if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { - const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { @@ -411,23 +352,21 @@ static int __Pyx_init_sys_getdefaultencoding_params() { } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (ascii_chars_u == NULL) goto bad; + if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } + Py_DECREF(ascii_chars_u); + Py_DECREF(ascii_chars_b); } - Py_XDECREF(sys); - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); + Py_DECREF(default_encoding); return 0; bad: - Py_XDECREF(sys); Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); @@ -440,22 +379,23 @@ static int __Pyx_init_sys_getdefaultencoding_params() { #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params() { - PyObject* sys = NULL; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); - if (sys == NULL) goto bad; + if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - if (default_encoding == NULL) goto bad; - default_encoding_c = PyBytes_AS_STRING(default_encoding); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(sys); Py_DECREF(default_encoding); return 0; bad: - Py_XDECREF(sys); Py_XDECREF(default_encoding); return -1; } @@ -463,16 +403,11 @@ static int __Pyx_init_sys_getdefaultencoding_params() { #endif -#ifdef __GNUC__ - /* Test for GCC > 2.95 */ - #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #else /* __GNUC__ > 2 ... */ - #define likely(x) (x) - #define unlikely(x) (x) - #endif /* __GNUC__ > 2 ... */ -#else /* __GNUC__ */ +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ @@ -510,23 +445,23 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "dist_metrics.pxd", - "dist_metrics.pyx", - "numpy.pxd", - "stringsource", - "stringsource", + "sklearn/neighbors/dist_metrics.pxd", + "sklearn/neighbors/dist_metrics.pyx", + "__init__.pxd", + "sklearn/neighbors/stringsource", + "sklearn/neighbors/stringsource", "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 */ + const char* name; struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - size_t arraysize[8]; /* length of array in each dimension */ + size_t size; + size_t arraysize[8]; int ndim; - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char typegroup; char is_unsigned; int flags; } __Pyx_TypeInfo; @@ -609,7 +544,7 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #endif -/* "numpy.pxd":723 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -618,7 +553,7 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":724 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -627,7 +562,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":725 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -636,7 +571,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":726 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -645,7 +580,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":730 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -654,7 +589,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":731 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -663,7 +598,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":732 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -672,7 +607,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":733 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -681,7 +616,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":737 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -690,7 +625,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":738 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -699,7 +634,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":747 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -708,7 +643,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":748 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -717,7 +652,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":749 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -726,7 +661,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":751 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -735,7 +670,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":752 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -744,7 +679,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":753 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -753,7 +688,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":755 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -762,7 +697,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":756 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -771,7 +706,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":758 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -780,7 +715,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":759 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -789,7 +724,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":760 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -837,33 +772,33 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t; /*--- Type declarations ---*/ -struct __pyx_MemviewEnum_obj; struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric; -struct __pyx_memoryview_obj; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HammingDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_CanberraDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_PyFuncDistance; struct __pyx_array_obj; +struct __pyx_MemviewEnum_obj; +struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_PyFuncDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance; -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance; -/* "numpy.pxd":762 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -872,7 +807,7 @@ struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":763 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -881,7 +816,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":764 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -890,7 +825,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":766 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -919,19 +854,6 @@ enum { __pyx_e_7sklearn_9neighbors_8typedefs_ITYPECODE = NPY_INTP }; -/* "View.MemoryView":275 - * - * @cname('__pyx_MemviewEnum') - * cdef class Enum(object): # <<<<<<<<<<<<<< - * cdef object name - * def __init__(self, name): - */ -struct __pyx_MemviewEnum_obj { - PyObject_HEAD - PyObject *name; -}; - - /* "sklearn/neighbors/dist_metrics.pxd":48 * ###################################################################### * # DistanceMetric base class @@ -953,102 +875,103 @@ struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric { }; -/* "View.MemoryView":308 +/* "sklearn/neighbors/dist_metrics.pyx":401 + * # Euclidean Distance + * # d = sqrt(sum(x_i^2 - y_i^2)) + * cdef class EuclideanDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Euclidean Distance metric * - * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + */ +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; +}; + + +/* "sklearn/neighbors/dist_metrics.pyx":434 + * # SEuclidean Distance + * # d = sqrt(sum((x_i - y_i2)^2 / v_i)) + * cdef class SEuclideanDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Standardized Euclidean Distance metric * - * cdef object obj */ -struct __pyx_memoryview_obj { - PyObject_HEAD - struct __pyx_vtabstruct_memoryview *__pyx_vtab; - PyObject *obj; - PyObject *_size; - PyObject *_array_interface; - PyThread_type_lock lock; - __pyx_atomic_int acquisition_count[2]; - __pyx_atomic_int *acquisition_count_aligned_p; - Py_buffer view; - int flags; - int dtype_is_object; - __Pyx_TypeInfo *typeinfo; +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":832 - * # Kulsinski Distance (boolean) - * # D(x, y) = (ntf + nft - ntt + n) / (n_neq + n) - * cdef class KulsinskiDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Kulsinski Distance +/* "sklearn/neighbors/dist_metrics.pyx":477 + * # Manhattan Distance + * # d = sum(abs(x_i - y_i)) + * cdef class ManhattanDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Manhattan/City-block Distance metric * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":929 - * # Sokal-Sneath Distance (boolean) - * # D(x, y) = n_neq / (0.5 * n_tt + n_neq) - * cdef class SokalSneathDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Sokal-Sneath Distance +/* "sklearn/neighbors/dist_metrics.pyx":498 + * # Chebyshev Distance + * # d = max_i(abs(x_i), abs(y_i)) + * cdef class ChebyshevDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Chebyshev/Infinity Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":429 - * # SEuclidean Distance - * # d = sqrt(sum((x_i - y_i2)^2 / v_i)) - * cdef class SEuclideanDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Standardized Euclidean Distance metric +/* "sklearn/neighbors/dist_metrics.pyx":519 + * # Minkowski Distance + * # d = sum(x_i^p - y_i^p) ^ (1/p) + * cdef class MinkowskiDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Minkowski Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":758 - * # Jaccard Distance (boolean) - * # D(x, y) = N_unequal(x, y) / N_nonzero(x, y) - * cdef class JaccardDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Jaccard Distance +/* "sklearn/neighbors/dist_metrics.pyx":566 + * # W-Minkowski Distance + * # d = sum(w_i * (x_i^p - y_i^p)) ^ (1/p) + * cdef class WMinkowskiDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Weighted Minkowski Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":688 - * # Hamming Distance - * # d = N_unequal(x, y) / N_tot - * cdef class HammingDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Hamming Distance +/* "sklearn/neighbors/dist_metrics.pyx":624 + * # Mahalanobis Distance + * # d = sqrt( (x - y)^T V^-1 (x - y) ) + * cdef class MahalanobisDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Mahalanobis Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HammingDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":733 - * # Bray-Curtis Distance - * # D(x, y) = sum[abs(x_i - y_i)] / sum[abs(x_i) + abs(y_i)] - * cdef class BrayCurtisDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Bray-Curtis Distance +/* "sklearn/neighbors/dist_metrics.pyx":693 + * # Hamming Distance + * # d = N_unequal(x, y) / N_tot + * cdef class HammingDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Hamming Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HammingDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":710 +/* "sklearn/neighbors/dist_metrics.pyx":715 * # Canberra Distance * # D(x, y) = sum[ abs(x_i - y_i) / (abs(x_i) + abs(y_i)) ] * cdef class CanberraDistance(DistanceMetric): # <<<<<<<<<<<<<< @@ -1060,79 +983,91 @@ struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_CanberraDistance { }; -/* "sklearn/neighbors/dist_metrics.pyx":881 - * # Russell-Rao Distance (boolean) - * # D(x, y) = (n - ntt) / n - * cdef class RussellRaoDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Russell-Rao Distance +/* "sklearn/neighbors/dist_metrics.pyx":738 + * # Bray-Curtis Distance + * # D(x, y) = sum[abs(x_i - y_i)] / sum[abs(x_i) + abs(y_i)] + * cdef class BrayCurtisDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Bray-Curtis Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":396 - * # Euclidean Distance - * # d = sqrt(sum(x_i^2 - y_i^2)) - * cdef class EuclideanDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Euclidean Distance metric +/* "sklearn/neighbors/dist_metrics.pyx":763 + * # Jaccard Distance (boolean) + * # D(x, y) = N_unequal(x, y) / N_nonzero(x, y) + * cdef class JaccardDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Jaccard Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":561 - * # W-Minkowski Distance - * # d = sum(w_i * (x_i^p - y_i^p)) ^ (1/p) - * cdef class WMinkowskiDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Weighted Minkowski Distance +/* "sklearn/neighbors/dist_metrics.pyx":788 + * # Matching Distance (boolean) + * # D(x, y) = n_neq / n + * cdef class MatchingDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Matching Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":514 - * # Minkowski Distance - * # d = sum(x_i^p - y_i^p) ^ (1/p) - * cdef class MinkowskiDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Minkowski Distance +/* "sklearn/neighbors/dist_metrics.pyx":812 + * # Dice Distance (boolean) + * # D(x, y) = n_neq / (2 * ntt + n_neq) + * cdef class DiceDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Dice Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":619 - * # Mahalanobis Distance - * # d = sqrt( (x - y)^T V^-1 (x - y) ) - * cdef class MahalanobisDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Mahalanobis Distance +/* "sklearn/neighbors/dist_metrics.pyx":837 + * # Kulsinski Distance (boolean) + * # D(x, y) = (ntf + nft - ntt + n) / (n_neq + n) + * cdef class KulsinskiDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Kulsinski Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":472 - * # Manhattan Distance - * # d = sum(abs(x_i - y_i)) - * cdef class ManhattanDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Manhattan/City-block Distance metric +/* "sklearn/neighbors/dist_metrics.pyx":862 + * # Rogers-Tanimoto Distance (boolean) + * # D(x, y) = 2 * n_neq / (n + n_neq) + * cdef class RogersTanimotoDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Rogers-Tanimoto Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; +}; + + +/* "sklearn/neighbors/dist_metrics.pyx":886 + * # Russell-Rao Distance (boolean) + * # D(x, y) = (n - ntt) / n + * cdef class RussellRaoDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Russell-Rao Distance + * + */ +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":905 +/* "sklearn/neighbors/dist_metrics.pyx":910 * # Sokal-Michener Distance (boolean) * # D(x, y) = 2 * n_neq / (n + n_neq) * cdef class SokalMichenerDistance(DistanceMetric): # <<<<<<<<<<<<<< @@ -1144,59 +1079,31 @@ struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance { }; -/* "View.MemoryView":96 - * - * @cname("__pyx_array") - * cdef class array: # <<<<<<<<<<<<<< +/* "sklearn/neighbors/dist_metrics.pyx":934 + * # Sokal-Sneath Distance (boolean) + * # D(x, y) = n_neq / (0.5 * n_tt + n_neq) + * cdef class SokalSneathDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Sokal-Sneath Distance * - * cdef: */ -struct __pyx_array_obj { - PyObject_HEAD - char *data; - Py_ssize_t len; - char *format; - int ndim; - Py_ssize_t *_shape; - Py_ssize_t *_strides; - Py_ssize_t itemsize; - PyObject *mode; - PyObject *_format; - void (*callback_free_data)(void *); - int free_data; - int dtype_is_object; -}; - - -/* "View.MemoryView":927 - * - * @cname('__pyx_memoryviewslice') - * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< - * "Internal class for passing memoryview slices to Python" - * - */ -struct __pyx_memoryviewslice_obj { - struct __pyx_memoryview_obj __pyx_base; - __Pyx_memviewslice from_slice; - PyObject *from_object; - PyObject *(*to_object_func)(char *); - int (*to_dtype_func)(char *, PyObject *); +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":857 - * # Rogers-Tanimoto Distance (boolean) - * # D(x, y) = 2 * n_neq / (n + n_neq) - * cdef class RogersTanimotoDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Rogers-Tanimoto Distance +/* "sklearn/neighbors/dist_metrics.pyx":960 + * # D(x, y) = 2 arcsin{sqrt[sin^2 ((x1 - y1) / 2) + * # + cos(x1) cos(y1) sin^2 ((x2 - y2) / 2)]} + * cdef class HaversineDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Haversine (Spherical) Distance * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance { +struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance { struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -/* "sklearn/neighbors/dist_metrics.pyx":1064 +/* "sklearn/neighbors/dist_metrics.pyx":1069 * # User-defined distance * # * cdef class PyFuncDistance(DistanceMetric): # <<<<<<<<<<<<<< @@ -1208,51 +1115,79 @@ struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_PyFuncDistance { }; -/* "sklearn/neighbors/dist_metrics.pyx":783 - * # Matching Distance (boolean) - * # D(x, y) = n_neq / n - * cdef class MatchingDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Matching Distance +/* "View.MemoryView":99 + * + * @cname("__pyx_array") + * cdef class array: # <<<<<<<<<<<<<< * + * cdef: */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; +struct __pyx_array_obj { + PyObject_HEAD + char *data; + Py_ssize_t len; + char *format; + int ndim; + Py_ssize_t *_shape; + Py_ssize_t *_strides; + Py_ssize_t itemsize; + PyObject *mode; + PyObject *_format; + void (*callback_free_data)(void *); + int free_data; + int dtype_is_object; }; -/* "sklearn/neighbors/dist_metrics.pyx":493 - * # Chebyshev Distance - * # d = max_i(abs(x_i), abs(y_i)) - * cdef class ChebyshevDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Chebyshev/Infinity Distance +/* "View.MemoryView":269 * + * @cname('__pyx_MemviewEnum') + * cdef class Enum(object): # <<<<<<<<<<<<<< + * cdef object name + * def __init__(self, name): */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; +struct __pyx_MemviewEnum_obj { + PyObject_HEAD + PyObject *name; }; -/* "sklearn/neighbors/dist_metrics.pyx":955 - * # D(x, y) = 2 arcsin{sqrt[sin^2 ((x1 - y1) / 2) - * # + cos(x1) cos(y1) sin^2 ((x2 - y2) / 2)]} - * cdef class HaversineDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Haversine (Spherical) Distance +/* "View.MemoryView":302 + * + * @cname('__pyx_memoryview') + * cdef class memoryview(object): # <<<<<<<<<<<<<< * + * cdef object obj */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; +struct __pyx_memoryview_obj { + PyObject_HEAD + struct __pyx_vtabstruct_memoryview *__pyx_vtab; + PyObject *obj; + PyObject *_size; + PyObject *_array_interface; + PyThread_type_lock lock; + __pyx_atomic_int acquisition_count[2]; + __pyx_atomic_int *acquisition_count_aligned_p; + Py_buffer view; + int flags; + int dtype_is_object; + __Pyx_TypeInfo *typeinfo; }; -/* "sklearn/neighbors/dist_metrics.pyx":807 - * # Dice Distance (boolean) - * # D(x, y) = n_neq / (2 * ntt + n_neq) - * cdef class DiceDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Dice Distance +/* "View.MemoryView":922 + * + * @cname('__pyx_memoryviewslice') + * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< + * "Internal class for passing memoryview slices to Python" * */ -struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; +struct __pyx_memoryviewslice_obj { + struct __pyx_memoryview_obj __pyx_base; + __Pyx_memviewslice from_slice; + PyObject *from_object; + PyObject *(*to_object_func)(char *); + int (*to_dtype_func)(char *, PyObject *); }; @@ -1276,63 +1211,63 @@ struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric { static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; -/* "sklearn/neighbors/dist_metrics.pyx":905 - * # Sokal-Michener Distance (boolean) - * # D(x, y) = 2 * n_neq / (n + n_neq) - * cdef class SokalMichenerDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Sokal-Michener Distance +/* "sklearn/neighbors/dist_metrics.pyx":401 + * # Euclidean Distance + * # d = sqrt(sum(x_i^2 - y_i^2)) + * cdef class EuclideanDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Euclidean Distance metric * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_EuclideanDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; -/* "sklearn/neighbors/dist_metrics.pyx":688 - * # Hamming Distance - * # d = N_unequal(x, y) / N_tot - * cdef class HammingDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Hamming Distance +/* "sklearn/neighbors/dist_metrics.pyx":434 + * # SEuclidean Distance + * # d = sqrt(sum((x_i - y_i2)^2 / v_i)) + * cdef class SEuclideanDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Standardized Euclidean Distance metric * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HammingDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HammingDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HammingDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; -/* "sklearn/neighbors/dist_metrics.pyx":493 - * # Chebyshev Distance - * # d = max_i(abs(x_i), abs(y_i)) - * cdef class ChebyshevDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Chebyshev/Infinity Distance +/* "sklearn/neighbors/dist_metrics.pyx":477 + * # Manhattan Distance + * # d = sum(abs(x_i - y_i)) + * cdef class ManhattanDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Manhattan/City-block Distance metric * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ManhattanDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ManhattanDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; -/* "sklearn/neighbors/dist_metrics.pyx":396 - * # Euclidean Distance - * # d = sqrt(sum(x_i^2 - y_i^2)) - * cdef class EuclideanDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Euclidean Distance metric +/* "sklearn/neighbors/dist_metrics.pyx":498 + * # Chebyshev Distance + * # d = max_i(abs(x_i), abs(y_i)) + * cdef class ChebyshevDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Chebyshev/Infinity Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_EuclideanDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; -/* "sklearn/neighbors/dist_metrics.pyx":514 +/* "sklearn/neighbors/dist_metrics.pyx":519 * # Minkowski Distance * # d = sum(x_i^p - y_i^p) ^ (1/p) * cdef class MinkowskiDistance(DistanceMetric): # <<<<<<<<<<<<<< @@ -1346,77 +1281,77 @@ struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance { static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance; -/* "sklearn/neighbors/dist_metrics.pyx":807 - * # Dice Distance (boolean) - * # D(x, y) = n_neq / (2 * ntt + n_neq) - * cdef class DiceDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Dice Distance +/* "sklearn/neighbors/dist_metrics.pyx":566 + * # W-Minkowski Distance + * # d = sum(w_i * (x_i^p - y_i^p)) ^ (1/p) + * cdef class WMinkowskiDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Weighted Minkowski Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DiceDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DiceDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DiceDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; -/* "sklearn/neighbors/dist_metrics.pyx":783 - * # Matching Distance (boolean) - * # D(x, y) = n_neq / n - * cdef class MatchingDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Matching Distance +/* "sklearn/neighbors/dist_metrics.pyx":624 + * # Mahalanobis Distance + * # d = sqrt( (x - y)^T V^-1 (x - y) ) + * cdef class MahalanobisDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Mahalanobis Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MatchingDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MatchingDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MatchingDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; -/* "sklearn/neighbors/dist_metrics.pyx":881 - * # Russell-Rao Distance (boolean) - * # D(x, y) = (n - ntt) / n - * cdef class RussellRaoDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Russell-Rao Distance +/* "sklearn/neighbors/dist_metrics.pyx":693 + * # Hamming Distance + * # d = N_unequal(x, y) / N_tot + * cdef class HammingDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Hamming Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HammingDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HammingDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HammingDistance; -/* "sklearn/neighbors/dist_metrics.pyx":472 - * # Manhattan Distance - * # d = sum(abs(x_i - y_i)) - * cdef class ManhattanDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Manhattan/City-block Distance metric +/* "sklearn/neighbors/dist_metrics.pyx":715 + * # Canberra Distance + * # D(x, y) = sum[ abs(x_i - y_i) / (abs(x_i) + abs(y_i)) ] + * cdef class CanberraDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Canberra Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ManhattanDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_CanberraDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ManhattanDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_CanberraDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_CanberraDistance; -/* "sklearn/neighbors/dist_metrics.pyx":710 - * # Canberra Distance - * # D(x, y) = sum[ abs(x_i - y_i) / (abs(x_i) + abs(y_i)) ] - * cdef class CanberraDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Canberra Distance +/* "sklearn/neighbors/dist_metrics.pyx":738 + * # Bray-Curtis Distance + * # D(x, y) = sum[abs(x_i - y_i)] / sum[abs(x_i) + abs(y_i)] + * cdef class BrayCurtisDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Bray-Curtis Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_CanberraDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_CanberraDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_CanberraDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; -/* "sklearn/neighbors/dist_metrics.pyx":758 +/* "sklearn/neighbors/dist_metrics.pyx":763 * # Jaccard Distance (boolean) * # D(x, y) = N_unequal(x, y) / N_nonzero(x, y) * cdef class JaccardDistance(DistanceMetric): # <<<<<<<<<<<<<< @@ -1430,92 +1365,91 @@ struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_JaccardDistance { static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_JaccardDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_JaccardDistance; -/* "sklearn/neighbors/dist_metrics.pyx":561 - * # W-Minkowski Distance - * # d = sum(w_i * (x_i^p - y_i^p)) ^ (1/p) - * cdef class WMinkowskiDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Weighted Minkowski Distance +/* "sklearn/neighbors/dist_metrics.pyx":788 + * # Matching Distance (boolean) + * # D(x, y) = n_neq / n + * cdef class MatchingDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Matching Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MatchingDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MatchingDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MatchingDistance; -/* "sklearn/neighbors/dist_metrics.pyx":429 - * # SEuclidean Distance - * # d = sqrt(sum((x_i - y_i2)^2 / v_i)) - * cdef class SEuclideanDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Standardized Euclidean Distance metric +/* "sklearn/neighbors/dist_metrics.pyx":812 + * # Dice Distance (boolean) + * # D(x, y) = n_neq / (2 * ntt + n_neq) + * cdef class DiceDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Dice Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DiceDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; - +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DiceDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DiceDistance; -/* "sklearn/neighbors/dist_metrics.pyx":1064 - * # User-defined distance - * # - * cdef class PyFuncDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """PyFunc Distance +/* "sklearn/neighbors/dist_metrics.pyx":837 + * # Kulsinski Distance (boolean) + * # D(x, y) = (ntf + nft - ntt + n) / (n_neq + n) + * cdef class KulsinskiDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Kulsinski Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_PyFuncDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_PyFuncDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_PyFuncDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; -/* "sklearn/neighbors/dist_metrics.pyx":619 - * # Mahalanobis Distance - * # d = sqrt( (x - y)^T V^-1 (x - y) ) - * cdef class MahalanobisDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Mahalanobis Distance +/* "sklearn/neighbors/dist_metrics.pyx":862 + * # Rogers-Tanimoto Distance (boolean) + * # D(x, y) = 2 * n_neq / (n + n_neq) + * cdef class RogersTanimotoDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Rogers-Tanimoto Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; -/* "sklearn/neighbors/dist_metrics.pyx":857 - * # Rogers-Tanimoto Distance (boolean) - * # D(x, y) = 2 * n_neq / (n + n_neq) - * cdef class RogersTanimotoDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Rogers-Tanimoto Distance +/* "sklearn/neighbors/dist_metrics.pyx":886 + * # Russell-Rao Distance (boolean) + * # D(x, y) = (n - ntt) / n + * cdef class RussellRaoDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Russell-Rao Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; -/* "sklearn/neighbors/dist_metrics.pyx":955 - * # D(x, y) = 2 arcsin{sqrt[sin^2 ((x1 - y1) / 2) - * # + cos(x1) cos(y1) sin^2 ((x2 - y2) / 2)]} - * cdef class HaversineDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Haversine (Spherical) Distance +/* "sklearn/neighbors/dist_metrics.pyx":910 + * # Sokal-Michener Distance (boolean) + * # D(x, y) = 2 * n_neq / (n + n_neq) + * cdef class SokalMichenerDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Sokal-Michener Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HaversineDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HaversineDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HaversineDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance; -/* "sklearn/neighbors/dist_metrics.pyx":929 +/* "sklearn/neighbors/dist_metrics.pyx":934 * # Sokal-Sneath Distance (boolean) * # D(x, y) = n_neq / (0.5 * n_tt + n_neq) * cdef class SokalSneathDistance(DistanceMetric): # <<<<<<<<<<<<<< @@ -1529,21 +1463,35 @@ struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance { static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; -/* "sklearn/neighbors/dist_metrics.pyx":733 - * # Bray-Curtis Distance - * # D(x, y) = sum[abs(x_i - y_i)] / sum[abs(x_i) + abs(y_i)] - * cdef class BrayCurtisDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Bray-Curtis Distance +/* "sklearn/neighbors/dist_metrics.pyx":960 + * # D(x, y) = 2 arcsin{sqrt[sin^2 ((x1 - y1) / 2) + * # + cos(x1) cos(y1) sin^2 ((x2 - y2) / 2)]} + * cdef class HaversineDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """Haversine (Spherical) Distance * */ -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance { +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HaversineDistance { struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HaversineDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HaversineDistance; + + +/* "sklearn/neighbors/dist_metrics.pyx":1069 + * # User-defined distance + * # + * cdef class PyFuncDistance(DistanceMetric): # <<<<<<<<<<<<<< + * """PyFunc Distance + * + */ + +struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_PyFuncDistance { + struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_PyFuncDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_PyFuncDistance; -/* "View.MemoryView":308 +/* "View.MemoryView":302 * * @cname('__pyx_memoryview') * cdef class memoryview(object): # <<<<<<<<<<<<<< @@ -1563,7 +1511,7 @@ struct __pyx_vtabstruct_memoryview { static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":927 +/* "View.MemoryView":922 * * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< @@ -1575,20 +1523,6 @@ struct __pyx_vtabstruct__memoryviewslice { struct __pyx_vtabstruct_memoryview __pyx_base; }; static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; - - -/* "sklearn/neighbors/dist_metrics.pyx":832 - * # Kulsinski Distance (boolean) - * # D(x, y) = (ntf + nft - ntt + n) / (n_neq + n) - * cdef class KulsinskiDistance(DistanceMetric): # <<<<<<<<<<<<<< - * """Kulsinski Distance - * - */ - -struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance { - struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_base; -}; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -1602,7 +1536,7 @@ static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_KulsinskiDista void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ @@ -1639,7 +1573,15 @@ static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_KulsinskiDista #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) -#endif /* CYTHON_REFNANNY */ +#endif +#define __Pyx_XDECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_XDECREF(tmp); \ + } while (0) +#define __Pyx_DECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_DECREF(tmp); \ + } while (0) #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) @@ -1658,7 +1600,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif -static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); @@ -1689,25 +1631,44 @@ static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); -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 void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); #define __Pyx_BufPtrCContig1d(type, buf, i0, s0) ((type)buf + i0) static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename); /*proto*/ + int lineno, const char *filename, + int full_traceback); #define __Pyx_BufPtrCContig2d(type, buf, i0, s0, i1, s1) ((type)((char*)buf + i0 * s0) + i1) -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) { int result = PySequence_Contains(seq, item); @@ -1731,35 +1692,48 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #endif static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ - -#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) -#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); + +#include + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ - const char* function_name); /*proto*/ + const char* function_name); #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL) @@ -1767,13 +1741,16 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ #define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) #endif -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ +static void __Pyx_RaiseBufferFallbackError(void); -static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ +static double __Pyx__PyObject_AsDouble(PyObject* obj); #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_AsDouble(obj) \ (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \ @@ -1787,12 +1764,8 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ - -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/ - -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 @@ -1801,15 +1774,15 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject * #define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ - static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); -#include +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); 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*/ @@ -1821,6 +1794,18 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/ +static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject* none = _PyList_Extend((PyListObject*)L, v); + if (unlikely(!none)) + return -1; + Py_DECREF(none); + return 0; +#else + return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); +#endif +} + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; @@ -1840,20 +1825,51 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyString_Join __Pyx_PyBytes_Join +#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v)) +#else +#define __Pyx_PyString_Join PyUnicode_Join +#define __Pyx_PyBaseString_Join PyUnicode_Join +#endif +#if CYTHON_COMPILING_IN_CPYTHON + #if PY_MAJOR_VERSION < 3 + #define __Pyx_PyBytes_Join _PyString_Join + #else + #define __Pyx_PyBytes_Join _PyBytes_Join + #endif +#else +static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); +#endif + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); -static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); /*proto*/ +static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); + +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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); -static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject *); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value); -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *); typedef struct { Py_ssize_t shape, strides, suboffsets; @@ -1880,8 +1896,12 @@ typedef struct { static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + #include "descrobject.h" -static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/ +static PyObject* __Pyx_Method_ClassMethod(PyObject *method); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -1895,7 +1915,7 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/ #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif -#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX +#if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else @@ -1981,6 +2001,8 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #endif #endif +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice *mvs, char order, int ndim); @@ -1996,42 +2018,14 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); +static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); + struct __pyx_typeinfo_string { char string[3]; }; static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type); -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); @@ -2057,29 +2051,65 @@ static int __Pyx_check_binary_version(void); #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*/ - -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*/ - +static PyObject *__Pyx_ImportModule(const char *name); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self, CYTHON_UNUSED __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, CYTHON_UNUSED __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, CYTHON_UNUSED __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_rdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_pdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self, __Pyx_memviewslice __pyx_v_X, __Pyx_memviewslice __pyx_v_D); /* proto*/ +static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_cdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self, __Pyx_memviewslice __pyx_v_X, __Pyx_memviewslice __pyx_v_Y, __Pyx_memviewslice __pyx_v_D); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric__rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_rdist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric__dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_dist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance__rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_rdist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance__dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_dist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_rdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_dist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance__rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_rdist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance__dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_dist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_rdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_dist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance__rdist_to_dist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_rdist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance__dist_to_rdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_dist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_rdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_dist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance__rdist_to_dist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_rdist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance__dist_to_rdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_dist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_rdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_dist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance__rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_rdist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance__dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_dist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_15HammingDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HammingDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_16CanberraDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_CanberraDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18BrayCurtisDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_15JaccardDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_16MatchingDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_12DiceDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17KulsinskiDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_22RogersTanimotoDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_18RussellRaoDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_21SokalMichenerDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_19SokalSneathDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17HaversineDistance__rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_rdist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_17HaversineDistance__dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_dist); /* proto*/ +static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance_dist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_PyFuncDistance *__pyx_v_self, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x1, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_v_x2, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t __pyx_v_size); /* proto*/ +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/ +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ /* Module declarations from 'cython.view' */ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ @@ -2118,31 +2148,31 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha /* Module declarations from 'sklearn.neighbors.typedefs' */ /* Module declarations from 'sklearn.neighbors.dist_metrics' */ -static PyTypeObject *__pyx_MemviewEnum_type = 0; static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric = 0; -static PyTypeObject *__pyx_memoryview_type = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance = 0; static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_JaccardDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance = 0; static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_HammingDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance = 0; static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_CanberraDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_JaccardDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MatchingDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DiceDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance = 0; static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance = 0; static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_HaversineDistance = 0; +static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_PyFuncDistance = 0; static PyTypeObject *__pyx_array_type = 0; +static PyTypeObject *__pyx_MemviewEnum_type = 0; +static PyTypeObject *__pyx_memoryview_type = 0; static PyTypeObject *__pyx_memoryviewslice_type = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_PyFuncDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MatchingDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_HaversineDistance = 0; -static PyTypeObject *__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DiceDistance = 0; static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_v_7sklearn_9neighbors_12dist_metrics_INF; static PyObject *generic = 0; static PyObject *strided = 0; @@ -2164,7 +2194,7 @@ static PyObject *_unellipsify(PyObject *, int); /*proto*/ static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ -static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/ +static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/ @@ -2270,424 +2300,413 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_EuclideanDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_JaccardDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ManhattanDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_HammingDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_CanberraDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_JaccardDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MatchingDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DiceDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_EuclideanDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ManhattanDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_HaversineDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_PyFuncDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_PyFuncDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MatchingDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_HaversineDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DiceDistance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static char __pyx_k_4[] = "Unrecognized metric '%s'"; -static char __pyx_k_6[] = "DistanceMetric is an abstract class"; -static char __pyx_k_8[] = "X and Y must have the same second dimension"; -static char __pyx_k_10[] = "SEuclidean dist: size of V does not match"; -static char __pyx_k_12[] = "p must be greater than 1"; -static char __pyx_k_14[] = "MinkowskiDistance requires finite p. For p=inf, use ChebyshevDistance."; -static char __pyx_k_17[] = "WMinkowskiDistance requires finite p. For p=inf, use ChebyshevDistance."; -static char __pyx_k_19[] = "WMinkowskiDistance dist: size of w does not match"; -static char __pyx_k_21[] = "V/VI must be square"; -static char __pyx_k_23[] = "Mahalanobis dist: size of V does not match"; -static char __pyx_k_25[] = "Haversine distance only valid in 2 dimensions"; -static char __pyx_k_29[] = "func must be a callable taking two arrays"; -static char __pyx_k_31[] = "func must return a float"; -static char __pyx_k_33[] = "ndarray is not C contiguous"; -static char __pyx_k_35[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_37[] = "Non-native byte order not supported"; -static char __pyx_k_39[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_40[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_43[] = "Format string allocated too short."; -static char __pyx_k_45[] = "Empty shape tuple for cython.array"; -static char __pyx_k_47[] = "itemsize <= 0 for cython.array"; -static char __pyx_k_50[] = "unable to allocate shape or strides."; -static char __pyx_k_52[] = "Invalid shape in axis %d: %d."; -static char __pyx_k_53[] = "Invalid mode, expected 'c' or 'fortran', got %s"; -static char __pyx_k_55[] = "unable to allocate array data."; -static char __pyx_k_57[] = "Can only create a buffer that is contiguous in memory."; -static char __pyx_k_59[] = "Unable to convert item to object"; -static char __pyx_k_61[] = "Buffer view does not expose strides"; -static char __pyx_k_63[] = ""; -static char __pyx_k_64[] = ""; -static char __pyx_k_67[] = "Cannot index with type '%s'"; -static char __pyx_k_69[] = "Indirect dimensions not supported"; -static char __pyx_k_71[] = "Index out of bounds (axis %d)"; -static char __pyx_k_72[] = "Step may not be zero (axis %d)"; -static char __pyx_k_73[] = "All dimensions preceding dimension %d must be indexed and not sliced"; -static char __pyx_k_74[] = "Out of bounds on buffer access (axis %d)"; -static char __pyx_k_75[] = "Cannot transpose memoryview with indirect dimensions"; -static char __pyx_k_76[] = "got differing extents in dimension %d (got %d and %d)"; -static char __pyx_k_77[] = "Dimension %d is not direct"; -static char __pyx_k_78[] = "^"; -static char __pyx_k_79[] = ""; -static char __pyx_k_80[] = "T{"; - static char __pyx_k_81[] = ":"; -static char __pyx_k_82[] = "}"; -static char __pyx_k_83[] = "(%s)"; -static char __pyx_k_84[] = ","; -static char __pyx_k_87[] = "/home/andy/checkout/scikit-learn/sklearn/neighbors/dist_metrics.pyx"; -static char __pyx_k_88[] = "sklearn.neighbors.dist_metrics"; -static char __pyx_k_91[] = "get_valid_metric_ids"; -static char __pyx_k_92[] = "get_valid_metric_ids (line 92)"; -static char __pyx_k_93[] = "Given an iterable of metric class names or class identifiers,\n return a list of metric IDs which map to those classes.\n\n Example:\n >>> L = get_valid_metric_ids([EuclideanDistance, 'ManhattanDistance'])\n >>> sorted(L)\n ['cityblock', 'euclidean', 'l1', 'l2', 'manhattan']\n "; -static char __pyx_k_94[] = "getbuffer(obj, view, flags)"; -static char __pyx_k_95[] = ""; -static char __pyx_k_97[] = ""; -static char __pyx_k_99[] = ""; -static char __pyx_k__B[] = "B"; -static char __pyx_k__C[] = "C"; -static char __pyx_k__H[] = "H"; -static char __pyx_k__I[] = "I"; -static char __pyx_k__L[] = "L"; -static char __pyx_k__O[] = "O"; -static char __pyx_k__Q[] = "Q"; -static char __pyx_k__V[] = "V"; -static char __pyx_k__X[] = "X"; -static char __pyx_k__Y[] = "Y"; -static char __pyx_k__b[] = "b"; -static char __pyx_k__c[] = "c"; -static char __pyx_k__d[] = "d"; -static char __pyx_k__f[] = "f"; -static char __pyx_k__g[] = "g"; -static char __pyx_k__h[] = "h"; -static char __pyx_k__i[] = "i"; -static char __pyx_k__l[] = "l"; -static char __pyx_k__p[] = "p"; -static char __pyx_k__q[] = "q"; -static char __pyx_k__w[] = "w"; -static char __pyx_k_101[] = ""; -static char __pyx_k_103[] = ""; -static char __pyx_k__VI[] = "VI"; -static char __pyx_k__Zd[] = "Zd"; -static char __pyx_k__Zf[] = "Zf"; -static char __pyx_k__Zg[] = "Zg"; -static char __pyx_k__id[] = "id"; -static char __pyx_k__l1[] = "l1"; -static char __pyx_k__l2[] = "l2"; -static char __pyx_k__np[] = "np"; -static char __pyx_k__inf[] = "inf"; -static char __pyx_k__inv[] = "inv"; -static char __pyx_k__key[] = "key"; -static char __pyx_k__obj[] = "obj"; -static char __pyx_k__pop[] = "pop"; -static char __pyx_k__sin[] = "sin"; -static char __pyx_k__val[] = "val"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__dice[] = "dice"; -static char __pyx_k__func[] = "func"; -static char __pyx_k__join[] = "join"; -static char __pyx_k__mode[] = "mode"; -static char __pyx_k__name[] = "name"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__pack[] = "pack"; -static char __pyx_k__size[] = "size"; -static char __pyx_k__sqrt[] = "sqrt"; -static char __pyx_k__step[] = "step"; -static char __pyx_k__stop[] = "stop"; -static char __pyx_k__ASCII[] = "ASCII"; -static char __pyx_k__DTYPE[] = "DTYPE"; -static char __pyx_k__ITYPE[] = "ITYPE"; -static char __pyx_k__dtype[] = "dtype"; -static char __pyx_k__error[] = "error"; -static char __pyx_k__flags[] = "flags"; -static char __pyx_k__isinf[] = "isinf"; -static char __pyx_k__items[] = "items"; -static char __pyx_k__numpy[] = "numpy"; -static char __pyx_k__order[] = "order"; -static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__start[] = "start"; -static char __pyx_k__zeros[] = "zeros"; -static char __pyx_k__arcsin[] = "arcsin"; -static char __pyx_k__decode[] = "decode"; -static char __pyx_k__encode[] = "encode"; -static char __pyx_k__extend[] = "extend"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__linalg[] = "linalg"; -static char __pyx_k__metric[] = "metric"; -static char __pyx_k__newObj[] = "newObj"; -static char __pyx_k__pyfunc[] = "pyfunc"; -static char __pyx_k__random[] = "random"; -static char __pyx_k__struct[] = "struct"; -static char __pyx_k__unpack[] = "unpack"; -static char __pyx_k__xrange[] = "xrange"; -static char __pyx_k____new__[] = "__new__"; -static char __pyx_k__asarray[] = "asarray"; -static char __pyx_k__fortran[] = "fortran"; -static char __pyx_k__hamming[] = "hamming"; -static char __pyx_k__jaccard[] = "jaccard"; -static char __pyx_k__memview[] = "memview"; -static char __pyx_k__Ellipsis[] = "Ellipsis"; -static char __pyx_k____main__[] = "__main__"; -static char __pyx_k____name__[] = "__name__"; -static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__canberra[] = "canberra"; -static char __pyx_k__infinity[] = "infinity"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__matching[] = "matching"; -static char __pyx_k__typedefs[] = "typedefs"; -static char __pyx_k__TypeError[] = "TypeError"; -static char __pyx_k____class__[] = "__class__"; -static char __pyx_k__chebyshev[] = "chebyshev"; -static char __pyx_k__cityblock[] = "cityblock"; -static char __pyx_k__enumerate[] = "enumerate"; -static char __pyx_k__euclidean[] = "euclidean"; -static char __pyx_k__haversine[] = "haversine"; -static char __pyx_k__kulsinski[] = "kulsinski"; -static char __pyx_k__manhattan[] = "manhattan"; -static char __pyx_k__minkowski[] = "minkowski"; -static char __pyx_k__IndexError[] = "IndexError"; -static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k____import__[] = "__import__"; -static char __pyx_k__braycurtis[] = "braycurtis"; -static char __pyx_k__get_metric[] = "get_metric"; -static char __pyx_k__russellrao[] = "russellrao"; -static char __pyx_k__seuclidean[] = "seuclidean"; -static char __pyx_k__wminkowski[] = "wminkowski"; -static char __pyx_k__MemoryError[] = "MemoryError"; -static char __pyx_k__mahalanobis[] = "mahalanobis"; -static char __pyx_k__sokalsneath[] = "sokalsneath"; -static char __pyx_k__RuntimeError[] = "RuntimeError"; -static char __pyx_k____getstate__[] = "__getstate__"; -static char __pyx_k__sokalmichener[] = "sokalmichener"; -static char __pyx_k__METRIC_MAPPING[] = "METRIC_MAPPING"; -static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; -static char __pyx_k__rogerstanimoto[] = "rogerstanimoto"; -static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; -static char __pyx_k__allocate_buffer[] = "allocate_buffer"; -static char __pyx_k__dtype_is_object[] = "dtype_is_object"; -static char __pyx_k__NotImplementedError[] = "NotImplementedError"; -static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer"; -static PyObject *__pyx_kp_s_10; -static PyObject *__pyx_kp_s_101; -static PyObject *__pyx_kp_s_103; -static PyObject *__pyx_kp_s_12; -static PyObject *__pyx_kp_s_14; -static PyObject *__pyx_kp_s_17; -static PyObject *__pyx_kp_s_19; -static PyObject *__pyx_kp_s_21; -static PyObject *__pyx_kp_s_23; -static PyObject *__pyx_kp_s_25; -static PyObject *__pyx_kp_s_29; -static PyObject *__pyx_kp_s_31; -static PyObject *__pyx_kp_u_33; -static PyObject *__pyx_kp_u_35; -static PyObject *__pyx_kp_u_37; -static PyObject *__pyx_kp_u_39; -static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_kp_u_40; -static PyObject *__pyx_kp_u_43; -static PyObject *__pyx_kp_s_45; -static PyObject *__pyx_kp_s_47; -static PyObject *__pyx_kp_s_50; -static PyObject *__pyx_kp_s_52; -static PyObject *__pyx_kp_s_53; -static PyObject *__pyx_kp_s_55; -static PyObject *__pyx_kp_s_57; -static PyObject *__pyx_kp_s_59; -static PyObject *__pyx_kp_s_6; -static PyObject *__pyx_kp_s_61; -static PyObject *__pyx_kp_s_63; -static PyObject *__pyx_kp_s_64; -static PyObject *__pyx_kp_s_67; -static PyObject *__pyx_kp_s_69; -static PyObject *__pyx_kp_s_74; -static PyObject *__pyx_kp_s_76; -static PyObject *__pyx_kp_b_78; -static PyObject *__pyx_kp_b_79; -static PyObject *__pyx_kp_s_8; -static PyObject *__pyx_kp_b_80; -static PyObject *__pyx_kp_b_81; -static PyObject *__pyx_kp_b_82; -static PyObject *__pyx_kp_u_83; -static PyObject *__pyx_kp_u_84; -static PyObject *__pyx_kp_s_87; -static PyObject *__pyx_n_s_88; -static PyObject *__pyx_n_s_91; -static PyObject *__pyx_kp_u_92; -static PyObject *__pyx_kp_u_93; -static PyObject *__pyx_kp_s_95; -static PyObject *__pyx_kp_s_97; -static PyObject *__pyx_kp_s_99; -static PyObject *__pyx_n_s__ASCII; -static PyObject *__pyx_n_s__C; -static PyObject *__pyx_n_s__DTYPE; -static PyObject *__pyx_n_s__Ellipsis; -static PyObject *__pyx_n_s__ITYPE; -static PyObject *__pyx_n_s__IndexError; -static PyObject *__pyx_n_s__L; -static PyObject *__pyx_n_s__METRIC_MAPPING; -static PyObject *__pyx_n_s__MemoryError; -static PyObject *__pyx_n_s__NotImplementedError; -static PyObject *__pyx_n_b__O; -static PyObject *__pyx_n_s__RuntimeError; -static PyObject *__pyx_n_s__TypeError; -static PyObject *__pyx_n_s__V; -static PyObject *__pyx_n_s__VI; -static PyObject *__pyx_n_s__ValueError; -static PyObject *__pyx_n_s__X; -static PyObject *__pyx_n_s__Y; -static PyObject *__pyx_n_s____class__; -static PyObject *__pyx_n_s____getstate__; -static PyObject *__pyx_n_s____import__; -static PyObject *__pyx_n_s____main__; -static PyObject *__pyx_n_s____name__; -static PyObject *__pyx_n_s____new__; -static PyObject *__pyx_n_s____pyx_getbuffer; -static PyObject *__pyx_n_s____pyx_releasebuffer; -static PyObject *__pyx_n_s____pyx_vtable__; -static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s__allocate_buffer; -static PyObject *__pyx_n_s__arcsin; -static PyObject *__pyx_n_s__asarray; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__braycurtis; -static PyObject *__pyx_n_b__c; -static PyObject *__pyx_n_s__c; -static PyObject *__pyx_n_u__c; -static PyObject *__pyx_n_s__canberra; -static PyObject *__pyx_n_s__chebyshev; -static PyObject *__pyx_n_s__cityblock; -static PyObject *__pyx_n_s__decode; -static PyObject *__pyx_n_s__dice; -static PyObject *__pyx_n_s__dtype; -static PyObject *__pyx_n_s__dtype_is_object; -static PyObject *__pyx_n_s__encode; -static PyObject *__pyx_n_s__enumerate; -static PyObject *__pyx_n_s__error; -static PyObject *__pyx_n_s__euclidean; -static PyObject *__pyx_n_s__extend; -static PyObject *__pyx_n_s__flags; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_b__fortran; -static PyObject *__pyx_n_s__fortran; -static PyObject *__pyx_n_s__func; -static PyObject *__pyx_n_s__get_metric; -static PyObject *__pyx_n_s__hamming; -static PyObject *__pyx_n_s__haversine; -static PyObject *__pyx_n_s__id; -static PyObject *__pyx_n_s__inf; -static PyObject *__pyx_n_s__infinity; -static PyObject *__pyx_n_s__inv; -static PyObject *__pyx_n_s__isinf; -static PyObject *__pyx_n_s__items; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__jaccard; -static PyObject *__pyx_n_s__join; -static PyObject *__pyx_n_s__key; -static PyObject *__pyx_n_s__kulsinski; -static PyObject *__pyx_n_s__l1; -static PyObject *__pyx_n_s__l2; -static PyObject *__pyx_n_s__linalg; -static PyObject *__pyx_n_s__mahalanobis; -static PyObject *__pyx_n_s__manhattan; -static PyObject *__pyx_n_s__matching; -static PyObject *__pyx_n_s__memview; -static PyObject *__pyx_n_s__metric; -static PyObject *__pyx_n_s__minkowski; -static PyObject *__pyx_n_s__mode; -static PyObject *__pyx_n_s__name; -static PyObject *__pyx_n_s__ndim; -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__order; -static PyObject *__pyx_n_s__p; -static PyObject *__pyx_n_s__pack; -static PyObject *__pyx_n_s__pop; -static PyObject *__pyx_n_s__pyfunc; -static PyObject *__pyx_n_s__random; -static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__rogerstanimoto; -static PyObject *__pyx_n_s__russellrao; -static PyObject *__pyx_n_s__seuclidean; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__sin; -static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__sokalmichener; -static PyObject *__pyx_n_s__sokalsneath; -static PyObject *__pyx_n_s__sqrt; -static PyObject *__pyx_n_s__start; -static PyObject *__pyx_n_s__step; -static PyObject *__pyx_n_s__stop; -static PyObject *__pyx_n_s__struct; -static PyObject *__pyx_n_s__typedefs; -static PyObject *__pyx_n_s__unpack; -static PyObject *__pyx_n_s__val; -static PyObject *__pyx_n_s__w; -static PyObject *__pyx_n_s__wminkowski; -static PyObject *__pyx_n_s__xrange; -static PyObject *__pyx_n_s__zeros; +static char __pyx_k_B[] = "B"; +static char __pyx_k_C[] = "C"; +static char __pyx_k_H[] = "H"; +static char __pyx_k_I[] = "I"; +static char __pyx_k_L[] = "L"; +static char __pyx_k_O[] = "O"; +static char __pyx_k_Q[] = "Q"; +static char __pyx_k_T[] = "T{"; + static char __pyx_k_V[] = "V"; + static char __pyx_k_X[] = "X"; + static char __pyx_k_Y[] = "Y"; + static char __pyx_k_b[] = "b"; + static char __pyx_k_c[] = "c"; + static char __pyx_k_d[] = "d"; + static char __pyx_k_f[] = "f"; + static char __pyx_k_g[] = "g"; + static char __pyx_k_h[] = "h"; + static char __pyx_k_i[] = "i"; + static char __pyx_k_l[] = "l"; + static char __pyx_k_p[] = "p"; + static char __pyx_k_q[] = "q"; + static char __pyx_k_s[] = "(%s)"; + static char __pyx_k_w[] = "w"; + static char __pyx_k_VI[] = "VI"; + static char __pyx_k_Zd[] = "Zd"; + static char __pyx_k_Zf[] = "Zf"; + static char __pyx_k_Zg[] = "Zg"; + static char __pyx_k_id[] = "id"; + static char __pyx_k_l1[] = "l1"; + static char __pyx_k_l2[] = "l2"; + static char __pyx_k_np[] = "np"; + static char __pyx_k__37[] = "^"; + static char __pyx_k__38[] = ""; + static char __pyx_k__39[] = ":"; +static char __pyx_k__40[] = "}"; +static char __pyx_k__41[] = ","; +static char __pyx_k_inf[] = "inf"; +static char __pyx_k_inv[] = "inv"; +static char __pyx_k_key[] = "key"; +static char __pyx_k_new[] = "__new__"; +static char __pyx_k_obj[] = "obj"; +static char __pyx_k_pop[] = "pop"; +static char __pyx_k_sin[] = "sin"; +static char __pyx_k_val[] = "val"; +static char __pyx_k_base[] = "base"; +static char __pyx_k_dice[] = "dice"; +static char __pyx_k_func[] = "func"; +static char __pyx_k_join[] = "join"; +static char __pyx_k_main[] = "__main__"; +static char __pyx_k_mode[] = "mode"; +static char __pyx_k_name[] = "__name__"; +static char __pyx_k_ndim[] = "ndim"; +static char __pyx_k_pack[] = "pack"; +static char __pyx_k_size[] = "size"; +static char __pyx_k_sqrt[] = "sqrt"; +static char __pyx_k_step[] = "step"; +static char __pyx_k_stop[] = "stop"; +static char __pyx_k_test[] = "__test__"; +static char __pyx_k_DTYPE[] = "DTYPE"; +static char __pyx_k_ITYPE[] = "ITYPE"; +static char __pyx_k_class[] = "__class__"; +static char __pyx_k_dtype[] = "dtype"; +static char __pyx_k_error[] = "error"; +static char __pyx_k_flags[] = "flags"; +static char __pyx_k_isinf[] = "isinf"; +static char __pyx_k_items[] = "items"; +static char __pyx_k_numpy[] = "numpy"; +static char __pyx_k_order[] = "order"; +static char __pyx_k_range[] = "range"; +static char __pyx_k_shape[] = "shape"; +static char __pyx_k_start[] = "start"; +static char __pyx_k_zeros[] = "zeros"; +static char __pyx_k_arcsin[] = "arcsin"; +static char __pyx_k_format[] = "format"; +static char __pyx_k_import[] = "__import__"; +static char __pyx_k_linalg[] = "linalg"; +static char __pyx_k_metric[] = "metric"; +static char __pyx_k_name_2[] = "name"; +static char __pyx_k_newObj[] = "newObj"; +static char __pyx_k_pyfunc[] = "pyfunc"; +static char __pyx_k_random[] = "random"; +static char __pyx_k_struct[] = "struct"; +static char __pyx_k_unpack[] = "unpack"; +static char __pyx_k_xrange[] = "xrange"; +static char __pyx_k_asarray[] = "asarray"; +static char __pyx_k_fortran[] = "fortran"; +static char __pyx_k_hamming[] = "hamming"; +static char __pyx_k_jaccard[] = "jaccard"; +static char __pyx_k_memview[] = "memview"; +static char __pyx_k_Ellipsis[] = "Ellipsis"; +static char __pyx_k_canberra[] = "canberra"; +static char __pyx_k_getstate[] = "__getstate__"; +static char __pyx_k_infinity[] = "infinity"; +static char __pyx_k_itemsize[] = "itemsize"; +static char __pyx_k_matching[] = "matching"; +static char __pyx_k_typedefs[] = "typedefs"; +static char __pyx_k_TypeError[] = "TypeError"; +static char __pyx_k_chebyshev[] = "chebyshev"; +static char __pyx_k_cityblock[] = "cityblock"; +static char __pyx_k_enumerate[] = "enumerate"; +static char __pyx_k_euclidean[] = "euclidean"; +static char __pyx_k_haversine[] = "haversine"; +static char __pyx_k_kulsinski[] = "kulsinski"; +static char __pyx_k_manhattan[] = "manhattan"; +static char __pyx_k_minkowski[] = "minkowski"; +static char __pyx_k_IndexError[] = "IndexError"; +static char __pyx_k_ValueError[] = "ValueError"; +static char __pyx_k_braycurtis[] = "braycurtis"; +static char __pyx_k_get_metric[] = "get_metric"; +static char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; +static char __pyx_k_russellrao[] = "russellrao"; +static char __pyx_k_seuclidean[] = "seuclidean"; +static char __pyx_k_wminkowski[] = "wminkowski"; +static char __pyx_k_MemoryError[] = "MemoryError"; +static char __pyx_k_mahalanobis[] = "mahalanobis"; +static char __pyx_k_sokalsneath[] = "sokalsneath"; +static char __pyx_k_RuntimeError[] = "RuntimeError"; +static char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static char __pyx_k_sokalmichener[] = "sokalmichener"; +static char __pyx_k_METRIC_MAPPING[] = "METRIC_MAPPING"; +static char __pyx_k_PyFuncDistance[] = "PyFuncDistance"; +static char __pyx_k_rogerstanimoto[] = "rogerstanimoto"; +static char __pyx_k_allocate_buffer[] = "allocate_buffer"; +static char __pyx_k_dtype_is_object[] = "dtype_is_object"; +static char __pyx_k_strided_and_direct[] = ""; +static char __pyx_k_NotImplementedError[] = "NotImplementedError"; +static char __pyx_k_V_VI_must_be_square[] = "V/VI must be square"; +static char __pyx_k_get_valid_metric_ids[] = "get_valid_metric_ids"; +static char __pyx_k_strided_and_indirect[] = ""; +static char __pyx_k_Unrecognized_metric_s[] = "Unrecognized metric '%s'"; +static char __pyx_k_contiguous_and_direct[] = ""; +static char __pyx_k_MemoryView_of_r_object[] = ""; +static char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; +static char __pyx_k_contiguous_and_indirect[] = ""; +static char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; +static char __pyx_k_func_must_return_a_float[] = "func must return a float"; +static char __pyx_k_getbuffer_obj_view_flags[] = "getbuffer(obj, view, flags)"; +static char __pyx_k_p_must_be_greater_than_1[] = "p must be greater than 1"; +static char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; +static char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; +static char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; +static char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; +static char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; +static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; +static char __pyx_k_get_valid_metric_ids_line_92[] = "get_valid_metric_ids (line 92)"; +static char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; +static char __pyx_k_scikit_learn_sklearn_neighbors[] = "/scikit-learn/sklearn/neighbors/dist_metrics.pyx"; +static char __pyx_k_sklearn_neighbors_dist_metrics[] = "sklearn.neighbors.dist_metrics"; +static char __pyx_k_strided_and_direct_or_indirect[] = ""; +static char __pyx_k_Mahalanobis_dist_size_of_V_does[] = "Mahalanobis dist: size of V does not match"; +static char __pyx_k_WMinkowskiDistance_dist_size_of[] = "WMinkowskiDistance dist: size of w does not match"; +static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; +static char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; +static char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; +static char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions"; +static char __pyx_k_DistanceMetric_is_an_abstract_cl[] = "DistanceMetric is an abstract class"; +static char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; +static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_Given_an_iterable_of_metric_clas[] = "Given an iterable of metric class names or class identifiers,\n return a list of metric IDs which map to those classes.\n\n Example:\n >>> L = get_valid_metric_ids([EuclideanDistance, 'ManhattanDistance'])\n >>> sorted(L)\n ['cityblock', 'euclidean', 'l1', 'l2', 'manhattan']\n "; +static char __pyx_k_Haversine_distance_only_valid_in[] = "Haversine distance only valid in 2 dimensions"; +static char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; +static char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; +static char __pyx_k_MinkowskiDistance_requires_finit[] = "MinkowskiDistance requires finite p. For p=inf, use ChebyshevDistance."; +static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; +static char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; +static char __pyx_k_SEuclidean_dist_size_of_V_does_n[] = "SEuclidean dist: size of V does not match"; +static char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; +static char __pyx_k_WMinkowskiDistance_requires_fini[] = "WMinkowskiDistance requires finite p. For p=inf, use ChebyshevDistance."; +static char __pyx_k_X_and_Y_must_have_the_same_secon[] = "X and Y must have the same second dimension"; +static char __pyx_k_func_must_be_a_callable_taking_t[] = "func must be a callable taking two arrays"; +static char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; +static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; +static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; +static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; +static PyObject *__pyx_n_s_C; +static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; +static PyObject *__pyx_kp_s_Cannot_index_with_type_s; +static PyObject *__pyx_n_s_DTYPE; +static PyObject *__pyx_kp_s_DistanceMetric_is_an_abstract_cl; +static PyObject *__pyx_n_s_Ellipsis; +static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; +static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; +static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; +static PyObject *__pyx_kp_u_Given_an_iterable_of_metric_clas; +static PyObject *__pyx_kp_s_Haversine_distance_only_valid_in; +static PyObject *__pyx_n_s_ITYPE; +static PyObject *__pyx_n_s_IndexError; +static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; +static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; +static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d; +static PyObject *__pyx_n_s_L; +static PyObject *__pyx_n_s_METRIC_MAPPING; +static PyObject *__pyx_kp_s_Mahalanobis_dist_size_of_V_does; +static PyObject *__pyx_n_s_MemoryError; +static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; +static PyObject *__pyx_kp_s_MemoryView_of_r_object; +static PyObject *__pyx_kp_s_MinkowskiDistance_requires_finit; +static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; +static PyObject *__pyx_n_s_NotImplementedError; +static PyObject *__pyx_n_b_O; +static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; +static PyObject *__pyx_n_s_PyFuncDistance; +static PyObject *__pyx_n_s_RuntimeError; +static PyObject *__pyx_kp_s_SEuclidean_dist_size_of_V_does_n; +static PyObject *__pyx_kp_b_T; +static PyObject *__pyx_n_s_TypeError; +static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; +static PyObject *__pyx_kp_s_Unrecognized_metric_s; +static PyObject *__pyx_n_s_V; +static PyObject *__pyx_n_s_VI; +static PyObject *__pyx_kp_s_V_VI_must_be_square; +static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_kp_s_WMinkowskiDistance_dist_size_of; +static PyObject *__pyx_kp_s_WMinkowskiDistance_requires_fini; +static PyObject *__pyx_n_s_X; +static PyObject *__pyx_kp_s_X_and_Y_must_have_the_same_secon; +static PyObject *__pyx_n_s_Y; +static PyObject *__pyx_kp_b__37; +static PyObject *__pyx_kp_b__38; +static PyObject *__pyx_kp_b__39; +static PyObject *__pyx_kp_b__40; +static PyObject *__pyx_kp_u__41; +static PyObject *__pyx_n_s_allocate_buffer; +static PyObject *__pyx_n_s_arcsin; +static PyObject *__pyx_n_s_asarray; +static PyObject *__pyx_n_s_base; +static PyObject *__pyx_n_s_braycurtis; +static PyObject *__pyx_n_s_c; +static PyObject *__pyx_n_u_c; +static PyObject *__pyx_n_s_canberra; +static PyObject *__pyx_n_s_chebyshev; +static PyObject *__pyx_n_s_cityblock; +static PyObject *__pyx_n_s_class; +static PyObject *__pyx_kp_s_contiguous_and_direct; +static PyObject *__pyx_kp_s_contiguous_and_indirect; +static PyObject *__pyx_n_s_dice; +static PyObject *__pyx_n_s_dtype; +static PyObject *__pyx_n_s_dtype_is_object; +static PyObject *__pyx_n_s_enumerate; +static PyObject *__pyx_n_s_error; +static PyObject *__pyx_n_s_euclidean; +static PyObject *__pyx_n_s_flags; +static PyObject *__pyx_n_s_format; +static PyObject *__pyx_n_s_fortran; +static PyObject *__pyx_n_u_fortran; +static PyObject *__pyx_n_s_func; +static PyObject *__pyx_kp_s_func_must_be_a_callable_taking_t; +static PyObject *__pyx_kp_s_func_must_return_a_float; +static PyObject *__pyx_n_s_get_metric; +static PyObject *__pyx_n_s_get_valid_metric_ids; +static PyObject *__pyx_kp_u_get_valid_metric_ids_line_92; +static PyObject *__pyx_n_s_getstate; +static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi; +static PyObject *__pyx_n_s_hamming; +static PyObject *__pyx_n_s_haversine; +static PyObject *__pyx_n_s_id; +static PyObject *__pyx_n_s_import; +static PyObject *__pyx_n_s_inf; +static PyObject *__pyx_n_s_infinity; +static PyObject *__pyx_n_s_inv; +static PyObject *__pyx_n_s_isinf; +static PyObject *__pyx_n_s_items; +static PyObject *__pyx_n_s_itemsize; +static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; +static PyObject *__pyx_n_s_jaccard; +static PyObject *__pyx_n_s_join; +static PyObject *__pyx_n_s_key; +static PyObject *__pyx_n_s_kulsinski; +static PyObject *__pyx_n_s_l1; +static PyObject *__pyx_n_s_l2; +static PyObject *__pyx_n_s_linalg; +static PyObject *__pyx_n_s_mahalanobis; +static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_manhattan; +static PyObject *__pyx_n_s_matching; +static PyObject *__pyx_n_s_memview; +static PyObject *__pyx_n_s_metric; +static PyObject *__pyx_n_s_minkowski; +static PyObject *__pyx_n_s_mode; +static PyObject *__pyx_n_s_name; +static PyObject *__pyx_n_s_name_2; +static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; +static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; +static PyObject *__pyx_n_s_ndim; +static PyObject *__pyx_n_s_new; +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_order; +static PyObject *__pyx_n_s_p; +static PyObject *__pyx_kp_s_p_must_be_greater_than_1; +static PyObject *__pyx_n_s_pack; +static PyObject *__pyx_n_s_pop; +static PyObject *__pyx_n_s_pyfunc; +static PyObject *__pyx_n_s_pyx_getbuffer; +static PyObject *__pyx_n_s_pyx_vtable; +static PyObject *__pyx_n_s_random; +static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_rogerstanimoto; +static PyObject *__pyx_n_s_russellrao; +static PyObject *__pyx_kp_u_s; +static PyObject *__pyx_kp_s_scikit_learn_sklearn_neighbors; +static PyObject *__pyx_n_s_seuclidean; +static PyObject *__pyx_n_s_shape; +static PyObject *__pyx_n_s_sin; +static PyObject *__pyx_n_s_size; +static PyObject *__pyx_n_s_sklearn_neighbors_dist_metrics; +static PyObject *__pyx_n_s_sokalmichener; +static PyObject *__pyx_n_s_sokalsneath; +static PyObject *__pyx_n_s_sqrt; +static PyObject *__pyx_n_s_start; +static PyObject *__pyx_n_s_step; +static PyObject *__pyx_n_s_stop; +static PyObject *__pyx_kp_s_strided_and_direct; +static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; +static PyObject *__pyx_kp_s_strided_and_indirect; +static PyObject *__pyx_n_s_struct; +static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_typedefs; +static PyObject *__pyx_kp_s_unable_to_allocate_array_data; +static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; +static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; +static PyObject *__pyx_n_s_unpack; +static PyObject *__pyx_n_s_val; +static PyObject *__pyx_n_s_w; +static PyObject *__pyx_n_s_wminkowski; +static PyObject *__pyx_n_s_xrange; +static PyObject *__pyx_n_s_zeros; +static PyObject *__pyx_float_0_5; 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_10; -static PyObject *__pyx_int_15; -static PyObject *__pyx_k_tuple_1; -static PyObject *__pyx_k_tuple_2; -static PyObject *__pyx_k_tuple_3; -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_13; -static PyObject *__pyx_k_tuple_15; -static PyObject *__pyx_k_tuple_16; -static PyObject *__pyx_k_tuple_18; -static PyObject *__pyx_k_tuple_20; -static PyObject *__pyx_k_tuple_22; -static PyObject *__pyx_k_tuple_24; -static PyObject *__pyx_k_tuple_26; -static PyObject *__pyx_k_tuple_27; -static PyObject *__pyx_k_tuple_28; -static PyObject *__pyx_k_tuple_30; -static PyObject *__pyx_k_tuple_32; -static PyObject *__pyx_k_tuple_34; -static PyObject *__pyx_k_tuple_36; -static PyObject *__pyx_k_tuple_38; -static PyObject *__pyx_k_tuple_41; -static PyObject *__pyx_k_tuple_42; -static PyObject *__pyx_k_tuple_44; -static PyObject *__pyx_k_tuple_46; -static PyObject *__pyx_k_tuple_48; -static PyObject *__pyx_k_tuple_49; -static PyObject *__pyx_k_tuple_51; -static PyObject *__pyx_k_tuple_54; -static PyObject *__pyx_k_tuple_56; -static PyObject *__pyx_k_tuple_58; -static PyObject *__pyx_k_tuple_60; -static PyObject *__pyx_k_tuple_62; -static PyObject *__pyx_k_tuple_65; -static PyObject *__pyx_k_tuple_66; -static PyObject *__pyx_k_tuple_68; -static PyObject *__pyx_k_tuple_70; -static PyObject *__pyx_k_tuple_85; -static PyObject *__pyx_k_tuple_89; -static PyObject *__pyx_k_tuple_96; -static PyObject *__pyx_k_tuple_98; -static PyObject *__pyx_k_tuple_100; -static PyObject *__pyx_k_tuple_102; -static PyObject *__pyx_k_tuple_104; -static PyObject *__pyx_k_codeobj_86; -static PyObject *__pyx_k_codeobj_90; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_tuple__2; +static PyObject *__pyx_tuple__3; +static PyObject *__pyx_tuple__4; +static PyObject *__pyx_tuple__5; +static PyObject *__pyx_tuple__6; +static PyObject *__pyx_tuple__7; +static PyObject *__pyx_tuple__8; +static PyObject *__pyx_tuple__9; +static PyObject *__pyx_slice__33; +static PyObject *__pyx_slice__34; +static PyObject *__pyx_slice__35; +static PyObject *__pyx_tuple__10; +static PyObject *__pyx_tuple__11; +static PyObject *__pyx_tuple__12; +static PyObject *__pyx_tuple__13; +static PyObject *__pyx_tuple__14; +static PyObject *__pyx_tuple__15; +static PyObject *__pyx_tuple__16; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__19; +static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__21; +static PyObject *__pyx_tuple__22; +static PyObject *__pyx_tuple__23; +static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__25; +static PyObject *__pyx_tuple__26; +static PyObject *__pyx_tuple__27; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__29; +static PyObject *__pyx_tuple__30; +static PyObject *__pyx_tuple__31; +static PyObject *__pyx_tuple__32; +static PyObject *__pyx_tuple__36; +static PyObject *__pyx_tuple__42; +static PyObject *__pyx_tuple__44; +static PyObject *__pyx_tuple__46; +static PyObject *__pyx_tuple__47; +static PyObject *__pyx_tuple__48; +static PyObject *__pyx_tuple__49; +static PyObject *__pyx_tuple__50; +static PyObject *__pyx_codeobj__43; +static PyObject *__pyx_codeobj__45; /* "sklearn/neighbors/dist_metrics.pyx":17 * ###################################################################### @@ -2751,7 +2770,15 @@ static __Pyx_memviewslice __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview __pyx_t_5.data = NULL; goto __pyx_L0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":17 + * ###################################################################### + * # Numpy 1.3-1.4 compatibility utilities + * cdef DTYPE_t[:, ::1] get_memview_DTYPE_2D( # <<<<<<<<<<<<<< + * np.ndarray[DTYPE_t, ndim=2, mode='c'] X): + * return ( X.data) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(((PyObject *)__pyx_t_2)); __Pyx_XDECREF(__pyx_t_3); @@ -2764,7 +2791,7 @@ static __Pyx_memviewslice __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview __pyx_r.data = NULL; __pyx_r.memview = NULL; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.get_memview_DTYPE_2D", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = __pyx_r; + goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); @@ -2815,14 +2842,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_f_7sklearn_9neighbor __pyx_r = (&(*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_pybuffernd_vec.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_vec.diminfo[0].strides))); goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vec.rcbuffer->pybuffer); + /* "sklearn/neighbors/dist_metrics.pyx":22 + * + * + * cdef DTYPE_t* get_vec_ptr(np.ndarray[DTYPE_t, ndim=1, mode='c'] vec): # <<<<<<<<<<<<<< + * return &vec[0] + * + */ + + /* function exit code */ + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vec.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("sklearn.neighbors.dist_metrics.get_vec_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.neighbors.dist_metrics.get_vec_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -2873,14 +2907,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *__pyx_f_7sklearn_9neighbor __pyx_r = (&(*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_pybuffernd_mat.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_mat.diminfo[0].strides, __pyx_t_2, __pyx_pybuffernd_mat.diminfo[1].strides))); goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":26 + * + * + * cdef DTYPE_t* get_mat_ptr(np.ndarray[DTYPE_t, ndim=2, mode='c'] mat): # <<<<<<<<<<<<<< + * return &mat[0, 0] + * ###################################################################### + */ + + /* function exit code */ __pyx_L1_error:; { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mat.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("sklearn.neighbors.dist_metrics.get_mat_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.neighbors.dist_metrics.get_mat_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -2922,8 +2963,15 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_9neighbors_12dist_metrics__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":37 + * + * + * cdef inline np.ndarray _buffer_to_ndarray(DTYPE_t* x, np.npy_intp n): # <<<<<<<<<<<<<< + * # Wrap a memory buffer with an ndarray. Warning: this is not robust. + * # In particular, if x is deallocated before the returned array goes + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics._buffer_to_ndarray", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -2934,32 +2982,35 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_9neighbors_12dist_metrics__ return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":58 + * # newObj function + * # this is a helper function for pickling + * def newObj(obj): # <<<<<<<<<<<<<< + * return obj.__new__(obj) + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_1newObj(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/ -static PyMethodDef __pyx_mdef_7sklearn_9neighbors_12dist_metrics_1newObj = {__Pyx_NAMESTR("newObj"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_1newObj, METH_O, __Pyx_DOCSTR(0)}; +static PyMethodDef __pyx_mdef_7sklearn_9neighbors_12dist_metrics_1newObj = {"newObj", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_1newObj, METH_O, 0}; static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_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_12dist_metrics_newObj(__pyx_self, ((PyObject *)__pyx_v_obj)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":58 - * # newObj function - * # this is a helper function for pickling - * def newObj(obj): # <<<<<<<<<<<<<< - * return obj.__new__(obj) - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_newObj(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) { 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2973,27 +3024,51 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_newObj(CYTHON_UNUSE * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s____new__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __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[1]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __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[1]; __pyx_lineno = 59; __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_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __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 = NULL; + __Pyx_INCREF(__pyx_v_obj); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":58 + * # newObj function + * # this is a helper function for pickling + * def newObj(obj): # <<<<<<<<<<<<<< + * return obj.__new__(obj) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.newObj", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3002,27 +3077,29 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_newObj(CYTHON_UNUSE return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":92 + * + * + * def get_valid_metric_ids(L): # <<<<<<<<<<<<<< + * """Given an iterable of metric class names or class identifiers, + * return a list of metric IDs which map to those classes. + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_3get_valid_metric_ids(PyObject *__pyx_self, PyObject *__pyx_v_L); /*proto*/ static char __pyx_doc_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_ids[] = "Given an iterable of metric class names or class identifiers,\n return a list of metric IDs which map to those classes.\n\n Example:\n >>> L = get_valid_metric_ids([EuclideanDistance, 'ManhattanDistance'])\n >>> sorted(L)\n ['cityblock', 'euclidean', 'l1', 'l2', 'manhattan']\n "; -static PyMethodDef __pyx_mdef_7sklearn_9neighbors_12dist_metrics_3get_valid_metric_ids = {__Pyx_NAMESTR("get_valid_metric_ids"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_3get_valid_metric_ids, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_ids)}; +static PyMethodDef __pyx_mdef_7sklearn_9neighbors_12dist_metrics_3get_valid_metric_ids = {"get_valid_metric_ids", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_3get_valid_metric_ids, METH_O, __pyx_doc_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_ids}; static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_3get_valid_metric_ids(PyObject *__pyx_self, PyObject *__pyx_v_L) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_valid_metric_ids (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_ids(__pyx_self, ((PyObject *)__pyx_v_L)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":92 - * - * - * def get_valid_metric_ids(L): # <<<<<<<<<<<<<< - * """Given an iterable of metric class names or class identifiers, - * return a list of metric IDs which map to those classes. - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_ids(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_L) { PyObject *__pyx_v_key = NULL; PyObject *__pyx_v_val = NULL; @@ -3031,9 +3108,9 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_i PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *(*__pyx_t_9)(PyObject *); @@ -3055,43 +3132,61 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_i __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__METRIC_MAPPING); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__items); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_METRIC_MAPPING); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __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[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; - __pyx_t_5 = NULL; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { - if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } } else { - __pyx_t_2 = __pyx_t_5(__pyx_t_3); + __pyx_t_2 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; @@ -3112,30 +3207,29 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_i } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); } else { - __pyx_t_6 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_7); #else - __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - { + } else { Py_ssize_t index = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); + index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3149,11 +3243,9 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_i {__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } - __Pyx_XDECREF(__pyx_v_key); - __pyx_v_key = __pyx_t_6; - __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_v_val); - __pyx_v_val = __pyx_t_7; + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7); __pyx_t_7 = 0; /* "sklearn/neighbors/dist_metrics.pyx":102 @@ -3163,17 +3255,21 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_i * * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_val, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = (__Pyx_PySequence_Contains(__pyx_t_2, __pyx_v_L, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = (__Pyx_PySequence_Contains(__pyx_t_2, __pyx_v_L, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(__pyx_t_10 != 0)) { - __pyx_t_11 = (__Pyx_PySequence_Contains(__pyx_v_val, __pyx_v_L, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = (__pyx_t_11 != 0); + __pyx_t_12 = (__pyx_t_11 != 0); + if (!__pyx_t_12) { } else { - __pyx_t_12 = (__pyx_t_10 != 0); + __pyx_t_10 = __pyx_t_12; + goto __pyx_L8_bool_binop_done; } - if (__pyx_t_12) { + __pyx_t_12 = (__Pyx_PySequence_Contains(__pyx_v_val, __pyx_v_L, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = (__pyx_t_12 != 0); + __pyx_t_10 = __pyx_t_11; + __pyx_L8_bool_binop_done:; + if (__pyx_t_10) { /* "sklearn/neighbors/dist_metrics.pyx":101 * ['cityblock', 'euclidean', 'l1', 'l2', 'manhattan'] @@ -3187,18 +3283,25 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_i } __pyx_L7:; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = ((PyObject *)__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":92 + * + * + * def get_valid_metric_ids(L): # <<<<<<<<<<<<<< + * """Given an iterable of metric class names or class identifiers, + * return a list of metric IDs which map to those classes. + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.get_valid_metric_ids", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -3211,6 +3314,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_2get_valid_metric_i return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":209 + * scaling as other distances. + * """ + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.p = 2 + * self.vec = np.zeros(1, dtype=DTYPE, order='c') + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -3221,18 +3332,12 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_1__cinit __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_12dist_metrics_14DistanceMetric___cinit__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":209 - * scaling as other distances. - * """ - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.p = 2 - * self.vec = np.zeros(1, dtype=DTYPE, order='c') - */ - static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric___cinit__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -3260,22 +3365,22 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric___cinit_ * self.mat = np.zeros((1, 1), dtype=DTYPE, order='c') * self.vec_ptr = get_vec_ptr(self.vec) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __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[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __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[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__c)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_1), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_order, __pyx_n_s_c) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__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[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->vec); @@ -3290,22 +3395,22 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric___cinit_ * self.vec_ptr = get_vec_ptr(self.vec) * self.mat_ptr = get_mat_ptr(self.mat) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __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[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __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[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __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[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_s_c) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->mat); @@ -3346,6 +3451,15 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric___cinit_ */ __pyx_v_self->size = 1; + /* "sklearn/neighbors/dist_metrics.pyx":209 + * scaling as other distances. + * """ + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.p = 2 + * self.vec = np.zeros(1, dtype=DTYPE, order='c') + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -3359,6 +3473,14 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric___cinit_ return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":217 + * self.size = 1 + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * """ + * reduce method used for pickling + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_2__reduce__[] = "\n reduce method used for pickling\n "; @@ -3367,18 +3489,12 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_3_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_2__reduce__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":217 - * self.size = 1 - * - * def __reduce__(self): # <<<<<<<<<<<<<< - * """ - * reduce method used for pickling - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_2__reduce__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3386,6 +3502,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_2_ PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3399,42 +3516,65 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_2_ * def __getstate__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__newObj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_newObj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __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[1]; __pyx_lineno = 221; __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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __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[1]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getstate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 221; __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); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":217 + * self.size = 1 + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * """ + * reduce method used for pickling + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.DistanceMetric.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3443,6 +3583,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_2_ return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":223 + * return (newObj, (self.__class__,), self.__getstate__()) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * """ + * get state for pickling + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_4__getstate__[] = "\n get state for pickling\n "; @@ -3451,23 +3599,18 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_5_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_4__getstate__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":223 - * return (newObj, (self.__class__,), self.__getstate__()) - * - * def __getstate__(self): # <<<<<<<<<<<<<< - * """ - * get state for pickling - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_4__getstate__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3476,16 +3619,64 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_4_ /* "sklearn/neighbors/dist_metrics.pyx":227 * get state for pickling * """ - * return (float(self.p), self.vec, self.mat) # <<<<<<<<<<<<<< - * - * def __setstate__(self, state): + * if self.__class__.__name__ == "PyFuncDistance": # <<<<<<<<<<<<<< + * return (float(self.p), self.vec, self.mat, self.func, self.kwargs) + * return (float(self.p), self.vec, self.mat) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_self->p)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_PyFuncDistance, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "sklearn/neighbors/dist_metrics.pyx":228 + * """ + * if self.__class__.__name__ == "PyFuncDistance": + * return (float(self.p), self.vec, self.mat, self.func, self.kwargs) # <<<<<<<<<<<<<< + * return (float(self.p), self.vec, self.mat) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyFloat_FromDouble(((double)__pyx_v_self->p)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __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(((PyObject *)__pyx_v_self->vec)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->vec)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->vec)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->mat)); + PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->mat)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->mat)); + __Pyx_INCREF(__pyx_v_self->func); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_self->func); + __Pyx_GIVEREF(__pyx_v_self->func); + __Pyx_INCREF(__pyx_v_self->kwargs); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_self->kwargs); + __Pyx_GIVEREF(__pyx_v_self->kwargs); + __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + + /* "sklearn/neighbors/dist_metrics.pyx":229 + * if self.__class__.__name__ == "PyFuncDistance": + * return (float(self.p), self.vec, self.mat, self.func, self.kwargs) + * return (float(self.p), self.vec, self.mat) # <<<<<<<<<<<<<< + * + * def __setstate__(self, state): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_self->p)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 229; __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(((PyObject *)__pyx_v_self->vec)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->vec)); @@ -3494,12 +3685,19 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_4_ PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->mat)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->mat)); __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":223 + * return (newObj, (self.__class__,), self.__getstate__()) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * """ + * get state for pickling + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -3511,6 +3709,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_4_ return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":231 + * return (float(self.p), self.vec, self.mat) + * + * def __setstate__(self, state): # <<<<<<<<<<<<<< + * """ + * set state for pickling + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ static char __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_6__setstate__[] = "\n set state for pickling\n "; @@ -3519,98 +3725,143 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_7_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_6__setstate__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":229 - * return (float(self.p), self.vec, self.mat) - * - * def __setstate__(self, state): # <<<<<<<<<<<<<< - * """ - * set state for pickling - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_6__setstate__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/neighbors/dist_metrics.pyx":233 + /* "sklearn/neighbors/dist_metrics.pyx":235 * set state for pickling * """ * self.p = state[0] # <<<<<<<<<<<<<< * self.vec = state[1] * self.mat = state[2] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 235; __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[1]; __pyx_lineno = 233; __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[1]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->p = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":234 + /* "sklearn/neighbors/dist_metrics.pyx":236 * """ * self.p = state[0] * self.vec = state[1] # <<<<<<<<<<<<<< * self.mat = state[2] - * self.vec_ptr = get_vec_ptr(self.vec) + * if self.__class__.__name__ == "PyFuncDistance": */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 236; __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[1]; __pyx_lineno = 234; __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[1]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->vec); __Pyx_DECREF(((PyObject *)__pyx_v_self->vec)); __pyx_v_self->vec = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":235 + /* "sklearn/neighbors/dist_metrics.pyx":237 * self.p = state[0] * self.vec = state[1] * self.mat = state[2] # <<<<<<<<<<<<<< - * self.vec_ptr = get_vec_ptr(self.vec) - * self.mat_ptr = get_mat_ptr(self.mat) + * if self.__class__.__name__ == "PyFuncDistance": + * self.func = state[3] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 2, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __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[1]; __pyx_lineno = 235; __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[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->mat); __Pyx_DECREF(((PyObject *)__pyx_v_self->mat)); __pyx_v_self->mat = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":236 + /* "sklearn/neighbors/dist_metrics.pyx":238 * self.vec = state[1] * self.mat = state[2] + * if self.__class__.__name__ == "PyFuncDistance": # <<<<<<<<<<<<<< + * self.func = state[3] + * self.kwargs = state[4] + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 238; __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_PyString_Equals(__pyx_t_3, __pyx_n_s_PyFuncDistance, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "sklearn/neighbors/dist_metrics.pyx":239 + * self.mat = state[2] + * if self.__class__.__name__ == "PyFuncDistance": + * self.func = state[3] # <<<<<<<<<<<<<< + * self.kwargs = state[4] + * self.vec_ptr = get_vec_ptr(self.vec) + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_state, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->func); + __Pyx_DECREF(__pyx_v_self->func); + __pyx_v_self->func = __pyx_t_3; + __pyx_t_3 = 0; + + /* "sklearn/neighbors/dist_metrics.pyx":240 + * if self.__class__.__name__ == "PyFuncDistance": + * self.func = state[3] + * self.kwargs = state[4] # <<<<<<<<<<<<<< + * self.vec_ptr = get_vec_ptr(self.vec) + * self.mat_ptr = get_mat_ptr(self.mat) + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->kwargs); + __Pyx_DECREF(__pyx_v_self->kwargs); + __pyx_v_self->kwargs = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "sklearn/neighbors/dist_metrics.pyx":241 + * self.func = state[3] + * self.kwargs = state[4] * self.vec_ptr = get_vec_ptr(self.vec) # <<<<<<<<<<<<<< * self.mat_ptr = get_mat_ptr(self.mat) * self.size = 1 */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->vec); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_self->vec_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_vec_ptr(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((PyObject *)__pyx_v_self->vec); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_self->vec_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_vec_ptr(((PyArrayObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":237 - * self.mat = state[2] + /* "sklearn/neighbors/dist_metrics.pyx":242 + * self.kwargs = state[4] * self.vec_ptr = get_vec_ptr(self.vec) * self.mat_ptr = get_mat_ptr(self.mat) # <<<<<<<<<<<<<< * self.size = 1 * */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->mat); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_self->mat_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_mat_ptr(((PyArrayObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((PyObject *)__pyx_v_self->mat); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_self->mat_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_mat_ptr(((PyArrayObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":238 + /* "sklearn/neighbors/dist_metrics.pyx":243 * self.vec_ptr = get_vec_ptr(self.vec) * self.mat_ptr = get_mat_ptr(self.mat) * self.size = 1 # <<<<<<<<<<<<<< @@ -3619,10 +3870,20 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_6_ */ __pyx_v_self->size = 1; + /* "sklearn/neighbors/dist_metrics.pyx":231 + * return (float(self.p), self.vec, self.mat) + * + * def __setstate__(self, state): # <<<<<<<<<<<<<< + * """ + * set state for pickling + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.DistanceMetric.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3631,6 +3892,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_6_ return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":246 + * + * @classmethod + * def get_metric(cls, metric, **kwargs): # <<<<<<<<<<<<<< + * """Get the given distance metric from the string identifier. + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_9get_metric(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8get_metric[] = "Get the given distance metric from the string identifier.\n\n See the docstring of DistanceMetric for a list of available metrics.\n\n Parameters\n ----------\n metric : string or class name\n The distance metric to use\n **kwargs\n additional arguments will be passed to the requested metric\n "; @@ -3646,7 +3915,7 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_9g __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__metric,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_metric,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -3659,11 +3928,11 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_9g kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__metric)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_metric)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "get_metric") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "get_metric") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -3674,7 +3943,7 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_9g } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_metric", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_metric", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.DistanceMetric.get_metric", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -3682,19 +3951,13 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_9g return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8get_metric(((PyObject*)__pyx_v_cls), __pyx_v_metric, __pyx_v_kwargs); + + /* function exit code */ __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":241 - * - * @classmethod - * def get_metric(cls, metric, **kwargs): # <<<<<<<<<<<<<< - * """Get the given distance metric from the string identifier. - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8get_metric(CYTHON_UNUSED PyObject *__pyx_v_cls, PyObject *__pyx_v_metric, PyObject *__pyx_v_kwargs) { PyObject *__pyx_v_p = NULL; PyObject *__pyx_r = NULL; @@ -3716,7 +3979,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g __Pyx_RefNannySetupContext("get_metric", 0); __Pyx_INCREF(__pyx_v_metric); - /* "sklearn/neighbors/dist_metrics.pyx":253 + /* "sklearn/neighbors/dist_metrics.pyx":258 * additional arguments will be passed to the requested metric * """ * if isinstance(metric, DistanceMetric): # <<<<<<<<<<<<<< @@ -3727,7 +3990,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":254 + /* "sklearn/neighbors/dist_metrics.pyx":259 * """ * if isinstance(metric, DistanceMetric): * return metric # <<<<<<<<<<<<<< @@ -3738,22 +4001,20 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g __Pyx_INCREF(__pyx_v_metric); __pyx_r = __pyx_v_metric; goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":256 + /* "sklearn/neighbors/dist_metrics.pyx":261 * return metric * * if callable(metric): # <<<<<<<<<<<<<< * return PyFuncDistance(metric, **kwargs) * */ - __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_metric); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_metric); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "sklearn/neighbors/dist_metrics.pyx":257 + /* "sklearn/neighbors/dist_metrics.pyx":262 * * if callable(metric): * return PyFuncDistance(metric, **kwargs) # <<<<<<<<<<<<<< @@ -3761,44 +4022,46 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g * # Map the metric string ID to the metric class */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __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 = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_metric); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_metric); __Pyx_GIVEREF(__pyx_v_metric); - __pyx_t_4 = ((PyObject *)__pyx_v_kwargs); + __pyx_t_4 = __pyx_v_kwargs; __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_PyFuncDistance)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_PyFuncDistance)), __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - goto __pyx_L4; } - __pyx_L4:; - /* "sklearn/neighbors/dist_metrics.pyx":260 + /* "sklearn/neighbors/dist_metrics.pyx":265 * * # Map the metric string ID to the metric class * if isinstance(metric, type) and issubclass(metric, DistanceMetric): # <<<<<<<<<<<<<< * pass * else: */ - __pyx_t_1 = PyType_Check(__pyx_v_metric); - if ((__pyx_t_1 != 0)) { - __pyx_t_2 = PyObject_IsSubclass(__pyx_v_metric, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric))); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = (__pyx_t_2 != 0); + __pyx_t_2 = PyType_Check(__pyx_v_metric); + __pyx_t_6 = (__pyx_t_2 != 0); + if (__pyx_t_6) { } else { - __pyx_t_6 = (__pyx_t_1 != 0); + __pyx_t_1 = __pyx_t_6; + goto __pyx_L6_bool_binop_done; } - if (__pyx_t_6) { + __pyx_t_6 = PyObject_IsSubclass(__pyx_v_metric, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric))); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_6 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { goto __pyx_L5; } /*else*/ { - /* "sklearn/neighbors/dist_metrics.pyx":263 + /* "sklearn/neighbors/dist_metrics.pyx":268 * pass * else: * try: # <<<<<<<<<<<<<< @@ -3812,32 +4075,31 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { - /* "sklearn/neighbors/dist_metrics.pyx":264 + /* "sklearn/neighbors/dist_metrics.pyx":269 * else: * try: * metric = METRIC_MAPPING[metric] # <<<<<<<<<<<<<< * except: * raise ValueError("Unrecognized metric '%s'" % metric) */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__METRIC_MAPPING); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_METRIC_MAPPING); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L8_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetItem(__pyx_t_5, __pyx_v_metric); if (!__pyx_t_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_t_5, __pyx_v_metric); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L8_error;}; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_v_metric); - __pyx_v_metric = __pyx_t_4; + __Pyx_DECREF_SET(__pyx_v_metric, __pyx_t_4); __pyx_t_4 = 0; } __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L13_try_end; - __pyx_L6_error:; + goto __pyx_L15_try_end; + __pyx_L8_error:; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":265 + /* "sklearn/neighbors/dist_metrics.pyx":270 * try: * metric = METRIC_MAPPING[metric] * except: # <<<<<<<<<<<<<< @@ -3846,91 +4108,82 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g */ /*except:*/ { __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.DistanceMetric.get_metric", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_3); - /* "sklearn/neighbors/dist_metrics.pyx":266 + /* "sklearn/neighbors/dist_metrics.pyx":271 * metric = METRIC_MAPPING[metric] * except: * raise ValueError("Unrecognized metric '%s'" % metric) # <<<<<<<<<<<<<< * * # In Minkowski special cases, return more efficient methods */ - __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_metric); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_Unrecognized_metric_s, __pyx_v_metric); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} __Pyx_GOTREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L7_exception_handled; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} } - __pyx_L8_except_error:; + __pyx_L10_except_error:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L1_error; - __pyx_L7_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_L13_try_end:; + __pyx_L15_try_end:; } } __pyx_L5:; - /* "sklearn/neighbors/dist_metrics.pyx":269 + /* "sklearn/neighbors/dist_metrics.pyx":274 * * # In Minkowski special cases, return more efficient methods * if metric is MinkowskiDistance: # <<<<<<<<<<<<<< * p = kwargs.pop('p', 2) * if p == 1: */ - __pyx_t_6 = (__pyx_v_metric == ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance))); - __pyx_t_1 = (__pyx_t_6 != 0); - if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_metric == ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance))); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":270 + /* "sklearn/neighbors/dist_metrics.pyx":275 * # In Minkowski special cases, return more efficient methods * if metric is MinkowskiDistance: * p = kwargs.pop('p', 2) # <<<<<<<<<<<<<< * if p == 1: * return ManhattanDistance(**kwargs) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_kwargs), __pyx_n_s__pop); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs, __pyx_n_s_pop); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_p = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":271 + /* "sklearn/neighbors/dist_metrics.pyx":276 * if metric is MinkowskiDistance: * p = kwargs.pop('p', 2) * if p == 1: # <<<<<<<<<<<<<< * return ManhattanDistance(**kwargs) * elif p == 2: */ - __pyx_t_5 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __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[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_1) { + if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":272 + /* "sklearn/neighbors/dist_metrics.pyx":277 * p = kwargs.pop('p', 2) * if p == 1: * return ManhattanDistance(**kwargs) # <<<<<<<<<<<<<< @@ -3938,30 +4191,29 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g * return EuclideanDistance(**kwargs) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = ((PyObject *)__pyx_v_kwargs); + __pyx_t_5 = __pyx_v_kwargs; __Pyx_INCREF(__pyx_t_5); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance)), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - goto __pyx_L17; } - /* "sklearn/neighbors/dist_metrics.pyx":273 + /* "sklearn/neighbors/dist_metrics.pyx":278 * if p == 1: * return ManhattanDistance(**kwargs) * elif p == 2: # <<<<<<<<<<<<<< * return EuclideanDistance(**kwargs) * elif np.isinf(p): */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_p, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_p, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { + if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":274 + /* "sklearn/neighbors/dist_metrics.pyx":279 * return ManhattanDistance(**kwargs) * elif p == 2: * return EuclideanDistance(**kwargs) # <<<<<<<<<<<<<< @@ -3969,43 +4221,58 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g * return ChebyshevDistance(**kwargs) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_v_kwargs); + __pyx_t_3 = __pyx_v_kwargs; __Pyx_INCREF(__pyx_t_3); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance)), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - goto __pyx_L17; } - /* "sklearn/neighbors/dist_metrics.pyx":275 + /* "sklearn/neighbors/dist_metrics.pyx":280 * elif p == 2: * return EuclideanDistance(**kwargs) * elif np.isinf(p): # <<<<<<<<<<<<<< * return ChebyshevDistance(**kwargs) * else: */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__isinf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __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[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_p); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_p); - __Pyx_GIVEREF(__pyx_v_p); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isinf); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __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_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_3) { + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + } else { + __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_p); + PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_p); + __Pyx_GIVEREF(__pyx_v_p); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_1) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":276 + /* "sklearn/neighbors/dist_metrics.pyx":281 * return EuclideanDistance(**kwargs) * elif np.isinf(p): * return ChebyshevDistance(**kwargs) # <<<<<<<<<<<<<< @@ -4013,19 +4280,18 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g * return MinkowskiDistance(p, **kwargs) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((PyObject *)__pyx_v_kwargs); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_5 = __pyx_v_kwargs; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance)), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - goto __pyx_L17; } /*else*/ { - /* "sklearn/neighbors/dist_metrics.pyx":278 + /* "sklearn/neighbors/dist_metrics.pyx":283 * return ChebyshevDistance(**kwargs) * else: * return MinkowskiDistance(p, **kwargs) # <<<<<<<<<<<<<< @@ -4033,27 +4299,25 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g * return metric(**kwargs) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_p); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_p); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_p); __Pyx_GIVEREF(__pyx_v_p); - __pyx_t_4 = ((PyObject *)__pyx_v_kwargs); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance)), ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5 = __pyx_v_kwargs; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance)), __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_10; + __pyx_t_10 = 0; goto __pyx_L0; } - __pyx_L17:; - goto __pyx_L16; } /*else*/ { - /* "sklearn/neighbors/dist_metrics.pyx":280 + /* "sklearn/neighbors/dist_metrics.pyx":285 * return MinkowskiDistance(p, **kwargs) * else: * return metric(**kwargs) # <<<<<<<<<<<<<< @@ -4061,19 +4325,25 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g * def __init__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_v_kwargs); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(__pyx_v_metric, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_10 = __pyx_v_kwargs; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_metric, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; } - __pyx_L16:; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":246 + * + * @classmethod + * def get_metric(cls, metric, **kwargs): # <<<<<<<<<<<<<< + * """Get the given distance metric from the string identifier. + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -4090,6 +4360,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8g return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":287 + * return metric(**kwargs) + * + * def __init__(self): # <<<<<<<<<<<<<< + * if self.__class__ is DistanceMetric: + * raise NotImplementedError("DistanceMetric is an abstract class") + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -4100,18 +4378,12 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init __Pyx_RaiseArgtupleInvalid("__init__", 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, "__init__", 0))) return -1; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_10__init__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":282 - * return metric(**kwargs) - * - * def __init__(self): # <<<<<<<<<<<<<< - * if self.__class__ is DistanceMetric: - * raise NotImplementedError("DistanceMetric is an abstract class") - */ - static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_10__init__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -4123,36 +4395,43 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_10__init int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/neighbors/dist_metrics.pyx":283 + /* "sklearn/neighbors/dist_metrics.pyx":288 * * def __init__(self): * if self.__class__ is DistanceMetric: # <<<<<<<<<<<<<< * raise NotImplementedError("DistanceMetric is an abstract class") * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 == ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric))); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "sklearn/neighbors/dist_metrics.pyx":284 + /* "sklearn/neighbors/dist_metrics.pyx":289 * def __init__(self): * if self.__class__ is DistanceMetric: * raise NotImplementedError("DistanceMetric is an abstract class") # <<<<<<<<<<<<<< * * cdef DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, ITYPE_t size) except -1: */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __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[1]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; + /* "sklearn/neighbors/dist_metrics.pyx":287 + * return metric(**kwargs) + * + * def __init__(self): # <<<<<<<<<<<<<< + * if self.__class__ is DistanceMetric: + * raise NotImplementedError("DistanceMetric is an abstract class") + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -4164,7 +4443,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_10__init return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":286 +/* "sklearn/neighbors/dist_metrics.pyx":291 * raise NotImplementedError("DistanceMetric is an abstract class") * * cdef DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, ITYPE_t size) except -1: # <<<<<<<<<<<<<< @@ -4177,7 +4456,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":291 + /* "sklearn/neighbors/dist_metrics.pyx":296 * This should be overridden in a base class. * """ * return -999 # <<<<<<<<<<<<<< @@ -4187,13 +4466,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = -999.0; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":291 + * raise NotImplementedError("DistanceMetric is an abstract class") + * + * cdef DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, ITYPE_t size) except -1: # <<<<<<<<<<<<<< + * """Compute the distance between vectors x1 and x2 + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":293 +/* "sklearn/neighbors/dist_metrics.pyx":298 * return -999 * * cdef DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, ITYPE_t size) except -1: # <<<<<<<<<<<<<< @@ -4210,19 +4497,26 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":303 + /* "sklearn/neighbors/dist_metrics.pyx":308 * distance. * """ * return self.dist(x1, x2, size) # <<<<<<<<<<<<<< * * cdef int pdist(self, DTYPE_t[:, ::1] X, DTYPE_t[:, ::1] D) except -1: */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->dist(__pyx_v_self, __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->dist(__pyx_v_self, __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_t_1; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":298 + * return -999 + * + * cdef DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, ITYPE_t size) except -1: # <<<<<<<<<<<<<< + * """Compute the reduced distance between vectors x1 and x2. + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.DistanceMetric.rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1.0; @@ -4231,7 +4525,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":305 +/* "sklearn/neighbors/dist_metrics.pyx":310 * return self.dist(x1, x2, size) * * cdef int pdist(self, DTYPE_t[:, ::1] X, DTYPE_t[:, ::1] D) except -1: # <<<<<<<<<<<<<< @@ -4264,7 +4558,7 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_pdist(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":308 + /* "sklearn/neighbors/dist_metrics.pyx":313 * """compute the pairwise distances between points in X""" * cdef ITYPE_t i1, i2 * for i1 in range(X.shape[0]): # <<<<<<<<<<<<<< @@ -4275,7 +4569,7 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_pdist(str for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i1 = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":309 + /* "sklearn/neighbors/dist_metrics.pyx":314 * cdef ITYPE_t i1, i2 * for i1 in range(X.shape[0]): * for i2 in range(i1, X.shape[0]): # <<<<<<<<<<<<<< @@ -4286,7 +4580,7 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_pdist(str for (__pyx_t_4 = __pyx_v_i1; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i2 = __pyx_t_4; - /* "sklearn/neighbors/dist_metrics.pyx":310 + /* "sklearn/neighbors/dist_metrics.pyx":315 * for i1 in range(X.shape[0]): * for i2 in range(i1, X.shape[0]): * D[i1, i2] = self.dist(&X[i1, 0], &X[i2, 0], X.shape[1]) # <<<<<<<<<<<<<< @@ -4297,12 +4591,12 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_pdist(str __pyx_t_6 = 0; __pyx_t_7 = __pyx_v_i2; __pyx_t_8 = 0; - __pyx_t_9 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->dist(__pyx_v_self, (&(*((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_X.data + __pyx_t_5 * __pyx_v_X.strides[0]) )) + __pyx_t_6)) )))), (&(*((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) )) + __pyx_t_8)) )))), (__pyx_v_X.shape[1])); if (unlikely(__pyx_t_9 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->dist(__pyx_v_self, (&(*((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_X.data + __pyx_t_5 * __pyx_v_X.strides[0]) )) + __pyx_t_6)) )))), (&(*((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) )) + __pyx_t_8)) )))), (__pyx_v_X.shape[1])); if (unlikely(__pyx_t_9 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = __pyx_v_i1; __pyx_t_11 = __pyx_v_i2; *((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_10 * __pyx_v_D.strides[0]) )) + __pyx_t_11)) )) = __pyx_t_9; - /* "sklearn/neighbors/dist_metrics.pyx":311 + /* "sklearn/neighbors/dist_metrics.pyx":316 * for i2 in range(i1, X.shape[0]): * D[i1, i2] = self.dist(&X[i1, 0], &X[i2, 0], X.shape[1]) * D[i2, i1] = D[i1, i2] # <<<<<<<<<<<<<< @@ -4317,7 +4611,7 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_pdist(str } } - /* "sklearn/neighbors/dist_metrics.pyx":312 + /* "sklearn/neighbors/dist_metrics.pyx":317 * D[i1, i2] = self.dist(&X[i1, 0], &X[i2, 0], X.shape[1]) * D[i2, i1] = D[i1, i2] * return 0 # <<<<<<<<<<<<<< @@ -4327,8 +4621,15 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_pdist(str __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":310 + * return self.dist(x1, x2, size) + * + * cdef int pdist(self, DTYPE_t[:, ::1] X, DTYPE_t[:, ::1] D) except -1: # <<<<<<<<<<<<<< + * """compute the pairwise distances between points in X""" + * cdef ITYPE_t i1, i2 + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.DistanceMetric.pdist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; @@ -4337,7 +4638,7 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_pdist(str return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":314 +/* "sklearn/neighbors/dist_metrics.pyx":319 * return 0 * * cdef int cdist(self, DTYPE_t[:, ::1] X, DTYPE_t[:, ::1] Y, # <<<<<<<<<<<<<< @@ -4368,7 +4669,7 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_cdist(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":318 + /* "sklearn/neighbors/dist_metrics.pyx":323 * """compute the cross-pairwise distances between arrays X and Y""" * cdef ITYPE_t i1, i2 * if X.shape[1] != Y.shape[1]: # <<<<<<<<<<<<<< @@ -4378,23 +4679,21 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_cdist(str __pyx_t_1 = (((__pyx_v_X.shape[1]) != (__pyx_v_Y.shape[1])) != 0); if (__pyx_t_1) { - /* "sklearn/neighbors/dist_metrics.pyx":319 + /* "sklearn/neighbors/dist_metrics.pyx":324 * cdef ITYPE_t i1, i2 * if X.shape[1] != Y.shape[1]: * raise ValueError('X and Y must have the same second dimension') # <<<<<<<<<<<<<< * for i1 in range(X.shape[0]): * for i2 in range(Y.shape[0]): */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __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[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":320 + /* "sklearn/neighbors/dist_metrics.pyx":325 * if X.shape[1] != Y.shape[1]: * raise ValueError('X and Y must have the same second dimension') * for i1 in range(X.shape[0]): # <<<<<<<<<<<<<< @@ -4405,7 +4704,7 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_cdist(str for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i1 = __pyx_t_4; - /* "sklearn/neighbors/dist_metrics.pyx":321 + /* "sklearn/neighbors/dist_metrics.pyx":326 * raise ValueError('X and Y must have the same second dimension') * for i1 in range(X.shape[0]): * for i2 in range(Y.shape[0]): # <<<<<<<<<<<<<< @@ -4416,7 +4715,7 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_cdist(str for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i2 = __pyx_t_6; - /* "sklearn/neighbors/dist_metrics.pyx":322 + /* "sklearn/neighbors/dist_metrics.pyx":327 * for i1 in range(X.shape[0]): * for i2 in range(Y.shape[0]): * D[i1, i2] = self.dist(&X[i1, 0], &Y[i2, 0], X.shape[1]) # <<<<<<<<<<<<<< @@ -4427,14 +4726,14 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_cdist(str __pyx_t_8 = 0; __pyx_t_9 = __pyx_v_i2; __pyx_t_10 = 0; - __pyx_t_11 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->dist(__pyx_v_self, (&(*((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) )) + __pyx_t_8)) )))), (&(*((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) )) + __pyx_t_10)) )))), (__pyx_v_X.shape[1])); if (unlikely(__pyx_t_11 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->dist(__pyx_v_self, (&(*((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) )) + __pyx_t_8)) )))), (&(*((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) )) + __pyx_t_10)) )))), (__pyx_v_X.shape[1])); if (unlikely(__pyx_t_11 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = __pyx_v_i1; __pyx_t_13 = __pyx_v_i2; *((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_12 * __pyx_v_D.strides[0]) )) + __pyx_t_13)) )) = __pyx_t_11; } } - /* "sklearn/neighbors/dist_metrics.pyx":323 + /* "sklearn/neighbors/dist_metrics.pyx":328 * for i2 in range(Y.shape[0]): * D[i1, i2] = self.dist(&X[i1, 0], &Y[i2, 0], X.shape[1]) * return 0 # <<<<<<<<<<<<<< @@ -4444,8 +4743,15 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_cdist(str __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":319 + * return 0 + * + * cdef int cdist(self, DTYPE_t[:, ::1] X, DTYPE_t[:, ::1] Y, # <<<<<<<<<<<<<< + * DTYPE_t[:, ::1] D) except -1: + * """compute the cross-pairwise distances between arrays X and Y""" + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.DistanceMetric.cdist", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -4455,7 +4761,7 @@ static int __pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_cdist(str return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":325 +/* "sklearn/neighbors/dist_metrics.pyx":330 * return 0 * * cdef DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< @@ -4468,7 +4774,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":327 + /* "sklearn/neighbors/dist_metrics.pyx":332 * cdef DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: * """Convert the reduced distance to the distance""" * return rdist # <<<<<<<<<<<<<< @@ -4478,13 +4784,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = __pyx_v_rdist; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":330 + * return 0 + * + * cdef DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< + * """Convert the reduced distance to the distance""" + * return rdist + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":329 +/* "sklearn/neighbors/dist_metrics.pyx":334 * return rdist * * cdef DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< @@ -4497,7 +4811,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":331 + /* "sklearn/neighbors/dist_metrics.pyx":336 * cdef DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: * """Convert the distance to the reduced distance""" * return dist # <<<<<<<<<<<<<< @@ -4507,12 +4821,28 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = __pyx_v_dist; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":334 + * return rdist + * + * cdef DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< + * """Convert the distance to the reduced distance""" + * return dist + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":338 + * return dist + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * """Convert the Reduced distance to the true distance. + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_13rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist); /*proto*/ static char __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_12rdist_to_dist[] = "Convert the Reduced distance to the true distance.\n\n The reduced distance, defined for some metrics, is a computationally\n more efficent measure which preserves the rank of the true distance.\n For example, in the Euclidean distance metric, the reduced distance\n is the squared-euclidean distance.\n "; @@ -4521,24 +4851,18 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_13 __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rdist_to_dist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_12rdist_to_dist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), ((PyObject *)__pyx_v_rdist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":333 - * return dist - * - * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< - * """Convert the Reduced distance to the true distance. - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_12rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self, PyObject *__pyx_v_rdist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":341 + /* "sklearn/neighbors/dist_metrics.pyx":346 * is the squared-euclidean distance. * """ * return rdist # <<<<<<<<<<<<<< @@ -4550,13 +4874,29 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_12 __pyx_r = __pyx_v_rdist; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "sklearn/neighbors/dist_metrics.pyx":338 + * return dist + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * """Convert the Reduced distance to the true distance. + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":348 + * return rdist + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * """Convert the true distance to the reduced distance. + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_15dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist); /*proto*/ static char __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_14dist_to_rdist[] = "Convert the true distance to the reduced distance.\n\n The reduced distance, defined for some metrics, is a computationally\n more efficent measure which preserves the rank of the true distance.\n For example, in the Euclidean distance metric, the reduced distance\n is the squared-euclidean distance.\n "; @@ -4565,24 +4905,18 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_15 __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dist_to_rdist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_14dist_to_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), ((PyObject *)__pyx_v_dist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":343 - * return rdist - * - * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< - * """Convert the true distance to the reduced distance. - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_14dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *__pyx_v_self, PyObject *__pyx_v_dist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":351 + /* "sklearn/neighbors/dist_metrics.pyx":356 * is the squared-euclidean distance. * """ * return dist # <<<<<<<<<<<<<< @@ -4594,13 +4928,29 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_14 __pyx_r = __pyx_v_dist; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "sklearn/neighbors/dist_metrics.pyx":348 + * return rdist + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * """Convert the true distance to the reduced distance. + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":358 + * return dist + * + * def pairwise(self, X, Y=None): # <<<<<<<<<<<<<< + * """Compute the pairwise distances between X and Y + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_17pairwise(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16pairwise[] = "Compute the pairwise distances between X and Y\n\n This is a convenience routine for the sake of testing. For many\n metrics, the utilities in scipy.spatial.distance.cdist and\n scipy.spatial.distance.pdist will be faster.\n\n Parameters\n ----------\n X : array_like\n Array of shape (Nx, D), representing Nx points in D dimensions.\n Y : array_like (optional)\n Array of shape (Ny, D), representing Ny points in D dimensions.\n If not specified, then Y=X.\n Returns\n -------\n dist : ndarray\n The shape (Nx, Ny) array of pairwise distances between points in\n X and Y.\n "; @@ -4614,16 +4964,8 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_17 __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("pairwise (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_Y,0}; PyObject* values[2] = {0,0}; - - /* "sklearn/neighbors/dist_metrics.pyx":353 - * return dist - * - * def pairwise(self, X, Y=None): # <<<<<<<<<<<<<< - * """Compute the pairwise distances between X and Y - * - */ values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -4637,16 +4979,16 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_17 kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 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) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Y); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pairwise") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pairwise") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4661,13 +5003,15 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_17 } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("pairwise", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("pairwise", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.DistanceMetric.pairwise", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16pairwise(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), __pyx_v_X, __pyx_v_Y); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -4717,36 +5061,36 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 __pyx_pybuffernd_Darr.data = NULL; __pyx_pybuffernd_Darr.rcbuffer = &__pyx_pybuffer_Darr; - /* "sklearn/neighbors/dist_metrics.pyx":377 + /* "sklearn/neighbors/dist_metrics.pyx":382 * cdef np.ndarray[DTYPE_t, ndim=2, mode='c'] Darr * * Xarr = np.asarray(X, dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * if Y is None: * Darr = np.zeros((Xarr.shape[0], Xarr.shape[0]), */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __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[1]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __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[1]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __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[1]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __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[1]; __pyx_lineno = 377; __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[1]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_s_C) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __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[1]; __pyx_lineno = 377; __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; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4762,13 +5106,13 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 } } __pyx_pybuffernd_Xarr.diminfo[0].strides = __pyx_pybuffernd_Xarr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Xarr.diminfo[0].shape = __pyx_pybuffernd_Xarr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Xarr.diminfo[1].strides = __pyx_pybuffernd_Xarr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Xarr.diminfo[1].shape = __pyx_pybuffernd_Xarr.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __pyx_v_Xarr = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":378 + /* "sklearn/neighbors/dist_metrics.pyx":383 * * Xarr = np.asarray(X, dtype=DTYPE, order='C') * if Y is None: # <<<<<<<<<<<<<< @@ -4779,23 +5123,23 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 __pyx_t_11 = (__pyx_t_10 != 0); if (__pyx_t_11) { - /* "sklearn/neighbors/dist_metrics.pyx":379 + /* "sklearn/neighbors/dist_metrics.pyx":384 * Xarr = np.asarray(X, dtype=DTYPE, order='C') * if Y is None: * Darr = np.zeros((Xarr.shape[0], Xarr.shape[0]), # <<<<<<<<<<<<<< * dtype=DTYPE, order='C') * self.pdist(get_memview_DTYPE_2D(Xarr), */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __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((__pyx_v_Xarr->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_Xarr->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Xarr->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_Xarr->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __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[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __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); @@ -4803,32 +5147,40 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 __Pyx_GIVEREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/neighbors/dist_metrics.pyx":380 + /* "sklearn/neighbors/dist_metrics.pyx":385 * if Y is None: * Darr = np.zeros((Xarr.shape[0], Xarr.shape[0]), * dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * self.pdist(get_memview_DTYPE_2D(Xarr), * get_memview_DTYPE_2D(Darr)) */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 385; __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[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_C) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/neighbors/dist_metrics.pyx":384 + * Xarr = np.asarray(X, dtype=DTYPE, order='C') + * if Y is None: + * Darr = np.zeros((Xarr.shape[0], Xarr.shape[0]), # <<<<<<<<<<<<<< + * dtype=DTYPE, order='C') + * self.pdist(get_memview_DTYPE_2D(Xarr), + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_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[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4844,66 +5196,74 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 } } __pyx_pybuffernd_Darr.diminfo[0].strides = __pyx_pybuffernd_Darr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Darr.diminfo[0].shape = __pyx_pybuffernd_Darr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Darr.diminfo[1].strides = __pyx_pybuffernd_Darr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Darr.diminfo[1].shape = __pyx_pybuffernd_Darr.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = 0; __pyx_v_Darr = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":381 + /* "sklearn/neighbors/dist_metrics.pyx":386 * Darr = np.zeros((Xarr.shape[0], Xarr.shape[0]), * dtype=DTYPE, order='C') * self.pdist(get_memview_DTYPE_2D(Xarr), # <<<<<<<<<<<<<< * get_memview_DTYPE_2D(Darr)) * else: */ - __pyx_t_13 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Xarr)); if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Xarr)); if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/neighbors/dist_metrics.pyx":382 + /* "sklearn/neighbors/dist_metrics.pyx":387 * dtype=DTYPE, order='C') * self.pdist(get_memview_DTYPE_2D(Xarr), * get_memview_DTYPE_2D(Darr)) # <<<<<<<<<<<<<< * else: * Yarr = np.asarray(Y, dtype=DTYPE, order='C') */ - __pyx_t_14 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Darr)); if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->pdist(__pyx_v_self, __pyx_t_13, __pyx_t_14); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Darr)); if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/neighbors/dist_metrics.pyx":386 + * Darr = np.zeros((Xarr.shape[0], Xarr.shape[0]), + * dtype=DTYPE, order='C') + * self.pdist(get_memview_DTYPE_2D(Xarr), # <<<<<<<<<<<<<< + * get_memview_DTYPE_2D(Darr)) + * else: + */ + __pyx_t_6 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->pdist(__pyx_v_self, __pyx_t_13, __pyx_t_14); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1); goto __pyx_L3; } /*else*/ { - /* "sklearn/neighbors/dist_metrics.pyx":384 + /* "sklearn/neighbors/dist_metrics.pyx":389 * get_memview_DTYPE_2D(Darr)) * else: * Yarr = np.asarray(Y, dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * Darr = np.zeros((Xarr.shape[0], Yarr.shape[0]), * dtype=DTYPE, order='C') */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_Y); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_Y); __Pyx_GIVEREF(__pyx_v_Y); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __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[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_order, __pyx_n_s_C) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __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_4)); __pyx_t_4 = 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[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__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[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4919,29 +5279,29 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 } } __pyx_pybuffernd_Yarr.diminfo[0].strides = __pyx_pybuffernd_Yarr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Yarr.diminfo[0].shape = __pyx_pybuffernd_Yarr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Yarr.diminfo[1].strides = __pyx_pybuffernd_Yarr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Yarr.diminfo[1].shape = __pyx_pybuffernd_Yarr.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_15 = 0; __pyx_v_Yarr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":385 + /* "sklearn/neighbors/dist_metrics.pyx":390 * else: * Yarr = np.asarray(Y, dtype=DTYPE, order='C') * Darr = np.zeros((Xarr.shape[0], Yarr.shape[0]), # <<<<<<<<<<<<<< * dtype=DTYPE, order='C') * self.cdist(get_memview_DTYPE_2D(Xarr), */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __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_PyInt_to_py_Py_intptr_t((__pyx_v_Xarr->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_Xarr->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Yarr->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_Yarr->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __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); @@ -4949,32 +5309,40 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 385; __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 = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + 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[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/neighbors/dist_metrics.pyx":386 + /* "sklearn/neighbors/dist_metrics.pyx":391 * Yarr = np.asarray(Y, dtype=DTYPE, order='C') * Darr = np.zeros((Xarr.shape[0], Yarr.shape[0]), * dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * self.cdist(get_memview_DTYPE_2D(Xarr), * get_memview_DTYPE_2D(Yarr), */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 391; __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[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __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[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_C) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/neighbors/dist_metrics.pyx":390 + * else: + * Yarr = np.asarray(Y, dtype=DTYPE, order='C') + * Darr = np.zeros((Xarr.shape[0], Yarr.shape[0]), # <<<<<<<<<<<<<< + * dtype=DTYPE, order='C') + * self.cdist(get_memview_DTYPE_2D(Xarr), + */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __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_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[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __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[1]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4990,46 +5358,54 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 } } __pyx_pybuffernd_Darr.diminfo[0].strides = __pyx_pybuffernd_Darr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Darr.diminfo[0].shape = __pyx_pybuffernd_Darr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Darr.diminfo[1].strides = __pyx_pybuffernd_Darr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Darr.diminfo[1].shape = __pyx_pybuffernd_Darr.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = 0; __pyx_v_Darr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":387 + /* "sklearn/neighbors/dist_metrics.pyx":392 * Darr = np.zeros((Xarr.shape[0], Yarr.shape[0]), * dtype=DTYPE, order='C') * self.cdist(get_memview_DTYPE_2D(Xarr), # <<<<<<<<<<<<<< * get_memview_DTYPE_2D(Yarr), * get_memview_DTYPE_2D(Darr)) */ - __pyx_t_14 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Xarr)); if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Xarr)); if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/neighbors/dist_metrics.pyx":388 + /* "sklearn/neighbors/dist_metrics.pyx":393 * dtype=DTYPE, order='C') * self.cdist(get_memview_DTYPE_2D(Xarr), * get_memview_DTYPE_2D(Yarr), # <<<<<<<<<<<<<< * get_memview_DTYPE_2D(Darr)) * return Darr */ - __pyx_t_13 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Yarr)); if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Yarr)); if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/neighbors/dist_metrics.pyx":389 + /* "sklearn/neighbors/dist_metrics.pyx":394 * self.cdist(get_memview_DTYPE_2D(Xarr), * get_memview_DTYPE_2D(Yarr), * get_memview_DTYPE_2D(Darr)) # <<<<<<<<<<<<<< * return Darr * */ - __pyx_t_16 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Darr)); if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->cdist(__pyx_v_self, __pyx_t_14, __pyx_t_13, __pyx_t_16); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_memview_DTYPE_2D(((PyArrayObject *)__pyx_v_Darr)); if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/neighbors/dist_metrics.pyx":392 + * Darr = np.zeros((Xarr.shape[0], Yarr.shape[0]), + * dtype=DTYPE, order='C') + * self.cdist(get_memview_DTYPE_2D(Xarr), # <<<<<<<<<<<<<< + * get_memview_DTYPE_2D(Yarr), + * get_memview_DTYPE_2D(Darr)) + */ + __pyx_t_6 = ((struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self->__pyx_vtab)->cdist(__pyx_v_self, __pyx_t_14, __pyx_t_13, __pyx_t_16); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1); } __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":390 + /* "sklearn/neighbors/dist_metrics.pyx":395 * get_memview_DTYPE_2D(Yarr), * get_memview_DTYPE_2D(Darr)) * return Darr # <<<<<<<<<<<<<< @@ -5041,8 +5417,15 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 __pyx_r = ((PyObject *)__pyx_v_Darr); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":358 + * return dist + * + * def pairwise(self, X, Y=None): # <<<<<<<<<<<<<< + * """Compute the pairwise distances between X and Y + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -5073,6 +5456,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16 return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":407 + * D(x, y) = \sqrt{ \sum_i (x_i - y_i) ^ 2 } + * """ + * def __init__(self): # <<<<<<<<<<<<<< + * self.p = 2 + * + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -5083,24 +5474,18 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_1__in __Pyx_RaiseArgtupleInvalid("__init__", 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, "__init__", 0))) return -1; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance___init__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":402 - * D(x, y) = \sqrt{ \sum_i (x_i - y_i) ^ 2 } - * """ - * def __init__(self): # <<<<<<<<<<<<<< - * self.p = 2 - * - */ - static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance___init__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/neighbors/dist_metrics.pyx":403 + /* "sklearn/neighbors/dist_metrics.pyx":408 * """ * def __init__(self): * self.p = 2 # <<<<<<<<<<<<<< @@ -5109,12 +5494,21 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance___ini */ __pyx_v_self->__pyx_base.p = 2.0; + /* "sklearn/neighbors/dist_metrics.pyx":407 + * D(x, y) = \sqrt{ \sum_i (x_i - y_i) ^ 2 } + * """ + * def __init__(self): # <<<<<<<<<<<<<< + * self.p = 2 + * + */ + + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":405 +/* "sklearn/neighbors/dist_metrics.pyx":410 * self.p = 2 * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -5131,19 +5525,26 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":407 + /* "sklearn/neighbors/dist_metrics.pyx":412 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * return euclidean_dist(x1, x2, size) # <<<<<<<<<<<<<< * * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, */ - __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_euclidean_dist(__pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_euclidean_dist(__pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_t_1; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":410 + * self.p = 2 + * + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * return euclidean_dist(x1, x2, size) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.EuclideanDistance.dist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1.0; @@ -5152,7 +5553,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":409 +/* "sklearn/neighbors/dist_metrics.pyx":414 * return euclidean_dist(x1, x2, size) * * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -5169,19 +5570,26 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":411 + /* "sklearn/neighbors/dist_metrics.pyx":416 * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * return euclidean_rdist(x1, x2, size) # <<<<<<<<<<<<<< * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: */ - __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_euclidean_rdist(__pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_euclidean_rdist(__pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_t_1; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":414 + * return euclidean_dist(x1, x2, size) + * + * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * return euclidean_rdist(x1, x2, size) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.EuclideanDistance.rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1.0; @@ -5190,7 +5598,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":413 +/* "sklearn/neighbors/dist_metrics.pyx":418 * return euclidean_rdist(x1, x2, size) * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< @@ -5203,7 +5611,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":414 + /* "sklearn/neighbors/dist_metrics.pyx":419 * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: * return sqrt(rdist) # <<<<<<<<<<<<<< @@ -5213,13 +5621,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = sqrt(__pyx_v_rdist); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":418 + * return euclidean_rdist(x1, x2, size) + * + * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< + * return sqrt(rdist) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":416 +/* "sklearn/neighbors/dist_metrics.pyx":421 * return sqrt(rdist) * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< @@ -5232,7 +5648,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":417 + /* "sklearn/neighbors/dist_metrics.pyx":422 * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: * return dist * dist # <<<<<<<<<<<<<< @@ -5242,12 +5658,28 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = (__pyx_v_dist * __pyx_v_dist); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":421 + * return sqrt(rdist) + * + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< + * return dist * dist + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":424 + * return dist * dist + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return np.sqrt(rdist) + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist) { @@ -5255,30 +5687,25 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rdist_to_dist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_2rdist_to_dist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *)__pyx_v_self), ((PyObject *)__pyx_v_rdist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":419 - * return dist * dist - * - * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< - * return np.sqrt(rdist) - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_2rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *__pyx_v_self, PyObject *__pyx_v_rdist) { 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":420 + /* "sklearn/neighbors/dist_metrics.pyx":425 * * def rdist_to_dist(self, rdist): * return np.sqrt(rdist) # <<<<<<<<<<<<<< @@ -5286,38 +5713,70 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance * def dist_to_rdist(self, dist): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; __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[1]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_rdist); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rdist); - __Pyx_GIVEREF(__pyx_v_rdist); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; __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_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_rdist); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; __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 = NULL; + __Pyx_INCREF(__pyx_v_rdist); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_rdist); + __Pyx_GIVEREF(__pyx_v_rdist); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.EuclideanDistance.rdist_to_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + /* "sklearn/neighbors/dist_metrics.pyx":424 + * return dist * dist + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return np.sqrt(rdist) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.EuclideanDistance.rdist_to_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":427 + * return np.sqrt(rdist) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** 2 + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist) { @@ -5325,18 +5784,12 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dist_to_rdist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_4dist_to_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *)__pyx_v_self), ((PyObject *)__pyx_v_dist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":422 - * return np.sqrt(rdist) - * - * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< - * return dist ** 2 - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_4dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *__pyx_v_self, PyObject *__pyx_v_dist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5346,7 +5799,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":423 + /* "sklearn/neighbors/dist_metrics.pyx":428 * * def dist_to_rdist(self, dist): * return dist ** 2 # <<<<<<<<<<<<<< @@ -5354,14 +5807,21 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyNumber_Power(__pyx_v_dist, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(__pyx_v_dist, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":427 + * return np.sqrt(rdist) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** 2 + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.EuclideanDistance.dist_to_rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -5372,6 +5832,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":440 + * D(x, y) = \sqrt{ \sum_i \frac{ (x_i - y_i) ^ 2}{V_i} } + * """ + * def __init__(self, V): # <<<<<<<<<<<<<< + * self.vec = np.asarray(V, dtype=DTYPE) + * self.vec_ptr = get_vec_ptr(self.vec) + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -5383,7 +5851,7 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_1__i __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__V,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_V,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -5396,11 +5864,11 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_1__i kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 435; __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[1]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -5411,25 +5879,19 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_1__i } 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[1]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.SEuclideanDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance___init__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *)__pyx_v_self), __pyx_v_V); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":435 - * D(x, y) = \sqrt{ \sum_i \frac{ (x_i - y_i) ^ 2}{V_i} } - * """ - * def __init__(self, V): # <<<<<<<<<<<<<< - * self.vec = np.asarray(V, dtype=DTYPE) - * self.vec_ptr = get_vec_ptr(self.vec) - */ - static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance___init__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *__pyx_v_self, PyObject *__pyx_v_V) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -5442,42 +5904,42 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance___in int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/neighbors/dist_metrics.pyx":436 + /* "sklearn/neighbors/dist_metrics.pyx":441 * """ * def __init__(self, V): * self.vec = np.asarray(V, dtype=DTYPE) # <<<<<<<<<<<<<< * self.vec_ptr = get_vec_ptr(self.vec) * self.size = self.vec.shape[0] */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __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[1]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_V); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_V); __Pyx_GIVEREF(__pyx_v_V); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __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[1]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __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[1]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __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[1]; __pyx_lineno = 436; __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; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->__pyx_base.vec); __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.vec)); __pyx_v_self->__pyx_base.vec = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":437 + /* "sklearn/neighbors/dist_metrics.pyx":442 * def __init__(self, V): * self.vec = np.asarray(V, dtype=DTYPE) * self.vec_ptr = get_vec_ptr(self.vec) # <<<<<<<<<<<<<< @@ -5489,7 +5951,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance___in __pyx_v_self->__pyx_base.vec_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_vec_ptr(((PyArrayObject *)__pyx_t_4)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":438 + /* "sklearn/neighbors/dist_metrics.pyx":443 * self.vec = np.asarray(V, dtype=DTYPE) * self.vec_ptr = get_vec_ptr(self.vec) * self.size = self.vec.shape[0] # <<<<<<<<<<<<<< @@ -5498,7 +5960,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance___in */ __pyx_v_self->__pyx_base.size = (__pyx_v_self->__pyx_base.vec->dimensions[0]); - /* "sklearn/neighbors/dist_metrics.pyx":439 + /* "sklearn/neighbors/dist_metrics.pyx":444 * self.vec_ptr = get_vec_ptr(self.vec) * self.size = self.vec.shape[0] * self.p = 2 # <<<<<<<<<<<<<< @@ -5507,6 +5969,15 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance___in */ __pyx_v_self->__pyx_base.p = 2.0; + /* "sklearn/neighbors/dist_metrics.pyx":440 + * D(x, y) = \sqrt{ \sum_i \frac{ (x_i - y_i) ^ 2}{V_i} } + * """ + * def __init__(self, V): # <<<<<<<<<<<<<< + * self.vec = np.asarray(V, dtype=DTYPE) + * self.vec_ptr = get_vec_ptr(self.vec) + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -5521,7 +5992,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance___in return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":441 +/* "sklearn/neighbors/dist_metrics.pyx":446 * self.p = 2 * * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -5544,7 +6015,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":443 + /* "sklearn/neighbors/dist_metrics.pyx":448 * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * if size != self.size: # <<<<<<<<<<<<<< @@ -5554,23 +6025,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_1 = ((__pyx_v_size != __pyx_v_self->__pyx_base.size) != 0); if (__pyx_t_1) { - /* "sklearn/neighbors/dist_metrics.pyx":444 + /* "sklearn/neighbors/dist_metrics.pyx":449 * ITYPE_t size) except -1: * if size != self.size: * raise ValueError('SEuclidean dist: size of V does not match') # <<<<<<<<<<<<<< * cdef DTYPE_t tmp, d=0 * cdef np.intp_t j */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 449; __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[1]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":445 + /* "sklearn/neighbors/dist_metrics.pyx":450 * if size != self.size: * raise ValueError('SEuclidean dist: size of V does not match') * cdef DTYPE_t tmp, d=0 # <<<<<<<<<<<<<< @@ -5579,7 +6048,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_d = 0.0; - /* "sklearn/neighbors/dist_metrics.pyx":447 + /* "sklearn/neighbors/dist_metrics.pyx":452 * cdef DTYPE_t tmp, d=0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -5590,7 +6059,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/neighbors/dist_metrics.pyx":448 + /* "sklearn/neighbors/dist_metrics.pyx":453 * cdef np.intp_t j * for j in range(size): * tmp = x1[j] - x2[j] # <<<<<<<<<<<<<< @@ -5599,7 +6068,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tmp = ((__pyx_v_x1[__pyx_v_j]) - (__pyx_v_x2[__pyx_v_j])); - /* "sklearn/neighbors/dist_metrics.pyx":449 + /* "sklearn/neighbors/dist_metrics.pyx":454 * for j in range(size): * tmp = x1[j] - x2[j] * d += tmp * tmp / self.vec_ptr[j] # <<<<<<<<<<<<<< @@ -5609,7 +6078,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_d = (__pyx_v_d + ((__pyx_v_tmp * __pyx_v_tmp) / (__pyx_v_self->__pyx_base.vec_ptr[__pyx_v_j]))); } - /* "sklearn/neighbors/dist_metrics.pyx":450 + /* "sklearn/neighbors/dist_metrics.pyx":455 * tmp = x1[j] - x2[j] * d += tmp * tmp / self.vec_ptr[j] * return d # <<<<<<<<<<<<<< @@ -5619,8 +6088,15 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = __pyx_v_d; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":446 + * self.p = 2 + * + * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * if size != self.size: + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.SEuclideanDistance.rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -5630,7 +6106,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":452 +/* "sklearn/neighbors/dist_metrics.pyx":457 * return d * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -5647,19 +6123,26 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":454 + /* "sklearn/neighbors/dist_metrics.pyx":459 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * return sqrt(self.rdist(x1, x2, size)) # <<<<<<<<<<<<<< * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: */ - __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = sqrt(__pyx_t_1); goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":457 + * return d + * + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * return sqrt(self.rdist(x1, x2, size)) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.SEuclideanDistance.dist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1.0; @@ -5668,7 +6151,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":456 +/* "sklearn/neighbors/dist_metrics.pyx":461 * return sqrt(self.rdist(x1, x2, size)) * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< @@ -5681,7 +6164,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":457 + /* "sklearn/neighbors/dist_metrics.pyx":462 * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: * return sqrt(rdist) # <<<<<<<<<<<<<< @@ -5691,13 +6174,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = sqrt(__pyx_v_rdist); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":461 + * return sqrt(self.rdist(x1, x2, size)) + * + * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< + * return sqrt(rdist) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":459 +/* "sklearn/neighbors/dist_metrics.pyx":464 * return sqrt(rdist) * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< @@ -5710,7 +6201,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":460 + /* "sklearn/neighbors/dist_metrics.pyx":465 * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: * return dist * dist # <<<<<<<<<<<<<< @@ -5720,12 +6211,28 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = (__pyx_v_dist * __pyx_v_dist); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":464 + * return sqrt(rdist) + * + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< + * return dist * dist + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":467 + * return dist * dist + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return np.sqrt(rdist) + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist) { @@ -5733,30 +6240,25 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistanc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rdist_to_dist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_2rdist_to_dist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *)__pyx_v_self), ((PyObject *)__pyx_v_rdist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":462 - * return dist * dist - * - * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< - * return np.sqrt(rdist) - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_2rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *__pyx_v_self, PyObject *__pyx_v_rdist) { 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":463 + /* "sklearn/neighbors/dist_metrics.pyx":468 * * def rdist_to_dist(self, rdist): * return np.sqrt(rdist) # <<<<<<<<<<<<<< @@ -5764,30 +6266,54 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistanc * def dist_to_rdist(self, dist): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 468; __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[1]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_rdist); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rdist); - __Pyx_GIVEREF(__pyx_v_rdist); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_rdist); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 468; __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 = NULL; + __Pyx_INCREF(__pyx_v_rdist); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_rdist); + __Pyx_GIVEREF(__pyx_v_rdist); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":467 + * return dist * dist + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return np.sqrt(rdist) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.SEuclideanDistance.rdist_to_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -5796,6 +6322,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistanc return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":470 + * return np.sqrt(rdist) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** 2 + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist) { @@ -5803,18 +6337,12 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistanc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dist_to_rdist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_4dist_to_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *)__pyx_v_self), ((PyObject *)__pyx_v_dist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":465 - * return np.sqrt(rdist) - * - * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< - * return dist ** 2 - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_4dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *__pyx_v_self, PyObject *__pyx_v_dist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5824,7 +6352,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistanc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":466 + /* "sklearn/neighbors/dist_metrics.pyx":471 * * def dist_to_rdist(self, dist): * return dist ** 2 # <<<<<<<<<<<<<< @@ -5832,14 +6360,21 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistanc * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyNumber_Power(__pyx_v_dist, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(__pyx_v_dist, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":470 + * return np.sqrt(rdist) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** 2 + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.SEuclideanDistance.dist_to_rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -5850,6 +6385,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistanc return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":483 + * D(x, y) = \sum_i |x_i - y_i| + * """ + * def __init__(self): # <<<<<<<<<<<<<< + * self.p = 1 + * + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -5860,24 +6403,18 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance_1__in __Pyx_RaiseArgtupleInvalid("__init__", 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, "__init__", 0))) return -1; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance___init__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":478 - * D(x, y) = \sum_i |x_i - y_i| - * """ - * def __init__(self): # <<<<<<<<<<<<<< - * self.p = 1 - * - */ - static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance___init__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/neighbors/dist_metrics.pyx":479 + /* "sklearn/neighbors/dist_metrics.pyx":484 * """ * def __init__(self): * self.p = 1 # <<<<<<<<<<<<<< @@ -5886,12 +6423,21 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance___ini */ __pyx_v_self->__pyx_base.p = 1.0; + /* "sklearn/neighbors/dist_metrics.pyx":483 + * D(x, y) = \sum_i |x_i - y_i| + * """ + * def __init__(self): # <<<<<<<<<<<<<< + * self.p = 1 + * + */ + + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":481 +/* "sklearn/neighbors/dist_metrics.pyx":486 * self.p = 1 * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -5908,7 +6454,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_5numpy_intp_t __pyx_t_2; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":483 + /* "sklearn/neighbors/dist_metrics.pyx":488 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef DTYPE_t d = 0 # <<<<<<<<<<<<<< @@ -5917,7 +6463,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_d = 0.0; - /* "sklearn/neighbors/dist_metrics.pyx":485 + /* "sklearn/neighbors/dist_metrics.pyx":490 * cdef DTYPE_t d = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -5928,7 +6474,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":486 + /* "sklearn/neighbors/dist_metrics.pyx":491 * cdef np.intp_t j * for j in range(size): * d += fabs(x1[j] - x2[j]) # <<<<<<<<<<<<<< @@ -5938,7 +6484,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_d = (__pyx_v_d + fabs(((__pyx_v_x1[__pyx_v_j]) - (__pyx_v_x2[__pyx_v_j])))); } - /* "sklearn/neighbors/dist_metrics.pyx":487 + /* "sklearn/neighbors/dist_metrics.pyx":492 * for j in range(size): * d += fabs(x1[j] - x2[j]) * return d # <<<<<<<<<<<<<< @@ -5948,12 +6494,28 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = __pyx_v_d; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":486 + * self.p = 1 + * + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef DTYPE_t d = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":504 + * D(x, y) = max_i (|x_i - y_i|) + * """ + * def __init__(self): # <<<<<<<<<<<<<< + * self.p = INF + * + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -5964,24 +6526,18 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance_1__in __Pyx_RaiseArgtupleInvalid("__init__", 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, "__init__", 0))) return -1; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance___init__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":499 - * D(x, y) = max_i (|x_i - y_i|) - * """ - * def __init__(self): # <<<<<<<<<<<<<< - * self.p = INF - * - */ - static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance___init__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/neighbors/dist_metrics.pyx":500 + /* "sklearn/neighbors/dist_metrics.pyx":505 * """ * def __init__(self): * self.p = INF # <<<<<<<<<<<<<< @@ -5990,12 +6546,21 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance___ini */ __pyx_v_self->__pyx_base.p = __pyx_v_7sklearn_9neighbors_12dist_metrics_INF; + /* "sklearn/neighbors/dist_metrics.pyx":504 + * D(x, y) = max_i (|x_i - y_i|) + * """ + * def __init__(self): # <<<<<<<<<<<<<< + * self.p = INF + * + */ + + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":502 +/* "sklearn/neighbors/dist_metrics.pyx":507 * self.p = INF * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -6012,7 +6577,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_5numpy_intp_t __pyx_t_2; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":504 + /* "sklearn/neighbors/dist_metrics.pyx":509 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef DTYPE_t d = 0 # <<<<<<<<<<<<<< @@ -6021,7 +6586,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_d = 0.0; - /* "sklearn/neighbors/dist_metrics.pyx":506 + /* "sklearn/neighbors/dist_metrics.pyx":511 * cdef DTYPE_t d = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -6032,7 +6597,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":507 + /* "sklearn/neighbors/dist_metrics.pyx":512 * cdef np.intp_t j * for j in range(size): * d = fmax(d, fabs(x1[j] - x2[j])) # <<<<<<<<<<<<<< @@ -6042,7 +6607,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_d = __pyx_f_7sklearn_9neighbors_12dist_metrics_fmax(__pyx_v_d, fabs(((__pyx_v_x1[__pyx_v_j]) - (__pyx_v_x2[__pyx_v_j])))); } - /* "sklearn/neighbors/dist_metrics.pyx":508 + /* "sklearn/neighbors/dist_metrics.pyx":513 * for j in range(size): * d = fmax(d, fabs(x1[j] - x2[j])) * return d # <<<<<<<<<<<<<< @@ -6052,12 +6617,28 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = __pyx_v_d; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":507 + * self.p = INF + * + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef DTYPE_t d = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":530 + * p=2, EuclideanDistance is more efficient. + * """ + * def __init__(self, p): # <<<<<<<<<<<<<< + * if p < 1: + * raise ValueError("p must be greater than 1") + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -6069,7 +6650,7 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_1__in __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -6082,11 +6663,11 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_1__in kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 525; __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[1]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -6097,25 +6678,19 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_1__in } 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[1]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.MinkowskiDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance___init__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *)__pyx_v_self), __pyx_v_p); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":525 - * p=2, EuclideanDistance is more efficient. - * """ - * def __init__(self, p): # <<<<<<<<<<<<<< - * if p < 1: - * raise ValueError("p must be greater than 1") - */ - static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance___init__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *__pyx_v_self, PyObject *__pyx_v_p) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -6123,96 +6698,120 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance___ini int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_t_5; + PyObject *__pyx_t_5 = NULL; + __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/neighbors/dist_metrics.pyx":526 + /* "sklearn/neighbors/dist_metrics.pyx":531 * """ * def __init__(self, p): * if p < 1: # <<<<<<<<<<<<<< * raise ValueError("p must be greater than 1") * elif np.isinf(p): */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 526; __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[1]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 531; __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[1]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":527 + /* "sklearn/neighbors/dist_metrics.pyx":532 * def __init__(self, p): * if p < 1: * raise ValueError("p must be greater than 1") # <<<<<<<<<<<<<< * elif np.isinf(p): * raise ValueError("MinkowskiDistance requires finite p. " */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 532; __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[1]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "sklearn/neighbors/dist_metrics.pyx":528 + /* "sklearn/neighbors/dist_metrics.pyx":533 * if p < 1: * raise ValueError("p must be greater than 1") * elif np.isinf(p): # <<<<<<<<<<<<<< * raise ValueError("MinkowskiDistance requires finite p. " * "For p=inf, use ChebyshevDistance.") */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__isinf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 533; __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[1]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_p); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_p); - __Pyx_GIVEREF(__pyx_v_p); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isinf); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 533; __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 = NULL; + __Pyx_INCREF(__pyx_v_p); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_p); + __Pyx_GIVEREF(__pyx_v_p); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":529 + /* "sklearn/neighbors/dist_metrics.pyx":534 * raise ValueError("p must be greater than 1") * elif np.isinf(p): * raise ValueError("MinkowskiDistance requires finite p. " # <<<<<<<<<<<<<< * "For p=inf, use ChebyshevDistance.") * self.p = p */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 529; __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 = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 534; __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[1]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":531 + /* "sklearn/neighbors/dist_metrics.pyx":536 * raise ValueError("MinkowskiDistance requires finite p. " * "For p=inf, use ChebyshevDistance.") * self.p = p # <<<<<<<<<<<<<< * * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, */ - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_p); if (unlikely((__pyx_t_5 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->__pyx_base.p = __pyx_t_5; + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_p); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->__pyx_base.p = __pyx_t_6; + + /* "sklearn/neighbors/dist_metrics.pyx":530 + * p=2, EuclideanDistance is more efficient. + * """ + * def __init__(self, p): # <<<<<<<<<<<<<< + * if p < 1: + * raise ValueError("p must be greater than 1") + */ + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.MinkowskiDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -6220,7 +6819,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance___ini return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":533 +/* "sklearn/neighbors/dist_metrics.pyx":538 * self.p = p * * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -6237,7 +6836,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_5numpy_intp_t __pyx_t_2; __Pyx_RefNannySetupContext("rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":535 + /* "sklearn/neighbors/dist_metrics.pyx":540 * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef DTYPE_t d=0 # <<<<<<<<<<<<<< @@ -6246,7 +6845,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_d = 0.0; - /* "sklearn/neighbors/dist_metrics.pyx":537 + /* "sklearn/neighbors/dist_metrics.pyx":542 * cdef DTYPE_t d=0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -6257,7 +6856,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":538 + /* "sklearn/neighbors/dist_metrics.pyx":543 * cdef np.intp_t j * for j in range(size): * d += pow(fabs(x1[j] - x2[j]), self.p) # <<<<<<<<<<<<<< @@ -6267,7 +6866,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_d = (__pyx_v_d + pow(fabs(((__pyx_v_x1[__pyx_v_j]) - (__pyx_v_x2[__pyx_v_j]))), __pyx_v_self->__pyx_base.p)); } - /* "sklearn/neighbors/dist_metrics.pyx":539 + /* "sklearn/neighbors/dist_metrics.pyx":544 * for j in range(size): * d += pow(fabs(x1[j] - x2[j]), self.p) * return d # <<<<<<<<<<<<<< @@ -6277,13 +6876,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = __pyx_v_d; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":538 + * self.p = p + * + * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef DTYPE_t d=0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":541 +/* "sklearn/neighbors/dist_metrics.pyx":546 * return d * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -6300,19 +6907,26 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":543 + /* "sklearn/neighbors/dist_metrics.pyx":548 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * return pow(self.rdist(x1, x2, size), 1. / self.p) # <<<<<<<<<<<<<< * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: */ - __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = pow(__pyx_t_1, (1. / __pyx_v_self->__pyx_base.p)); goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":546 + * return d + * + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * return pow(self.rdist(x1, x2, size), 1. / self.p) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.MinkowskiDistance.dist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1.0; @@ -6321,7 +6935,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":545 +/* "sklearn/neighbors/dist_metrics.pyx":550 * return pow(self.rdist(x1, x2, size), 1. / self.p) * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< @@ -6334,7 +6948,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":546 + /* "sklearn/neighbors/dist_metrics.pyx":551 * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: * return pow(rdist, 1. / self.p) # <<<<<<<<<<<<<< @@ -6344,13 +6958,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = pow(__pyx_v_rdist, (1. / __pyx_v_self->__pyx_base.p)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":550 + * return pow(self.rdist(x1, x2, size), 1. / self.p) + * + * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< + * return pow(rdist, 1. / self.p) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":548 +/* "sklearn/neighbors/dist_metrics.pyx":553 * return pow(rdist, 1. / self.p) * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< @@ -6363,7 +6985,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":549 + /* "sklearn/neighbors/dist_metrics.pyx":554 * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: * return pow(dist, self.p) # <<<<<<<<<<<<<< @@ -6373,12 +6995,28 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = pow(__pyx_v_dist, __pyx_v_self->__pyx_base.p); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":553 + * return pow(rdist, 1. / self.p) + * + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< + * return pow(dist, self.p) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":556 + * return pow(dist, self.p) + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return rdist ** (1. / self.p) + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist) { @@ -6386,18 +7024,12 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rdist_to_dist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_2rdist_to_dist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *)__pyx_v_self), ((PyObject *)__pyx_v_rdist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":551 - * return pow(dist, self.p) - * - * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< - * return rdist ** (1. / self.p) - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_2rdist_to_dist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *__pyx_v_self, PyObject *__pyx_v_rdist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6408,7 +7040,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":552 + /* "sklearn/neighbors/dist_metrics.pyx":557 * * def rdist_to_dist(self, rdist): * return rdist ** (1. / self.p) # <<<<<<<<<<<<<< @@ -6416,17 +7048,24 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance * def dist_to_rdist(self, dist): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble((1. / __pyx_v_self->__pyx_base.p)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((1. / __pyx_v_self->__pyx_base.p)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Power(__pyx_v_rdist, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_v_rdist, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":556 + * return pow(dist, self.p) + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return rdist ** (1. / self.p) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -6438,6 +7077,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":559 + * return rdist ** (1. / self.p) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** self.p + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist) { @@ -6445,18 +7092,12 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dist_to_rdist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_4dist_to_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *)__pyx_v_self), ((PyObject *)__pyx_v_dist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":554 - * return rdist ** (1. / self.p) - * - * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< - * return dist ** self.p - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_4dist_to_rdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *__pyx_v_self, PyObject *__pyx_v_dist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6467,7 +7108,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":555 + /* "sklearn/neighbors/dist_metrics.pyx":560 * * def dist_to_rdist(self, dist): * return dist ** self.p # <<<<<<<<<<<<<< @@ -6475,17 +7116,24 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Power(__pyx_v_dist, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_v_dist, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":559 + * return rdist ** (1. / self.p) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** self.p + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -6497,6 +7145,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":582 + * + * """ + * def __init__(self, p, w): # <<<<<<<<<<<<<< + * if p < 1: + * raise ValueError("p must be greater than 1") + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -6509,7 +7165,7 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_1__i __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__w,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_w,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -6523,16 +7179,16 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_1__i kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 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: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 577; __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[1]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6545,25 +7201,19 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_1__i } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.WMinkowskiDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance___init__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *)__pyx_v_self), __pyx_v_p, __pyx_v_w); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":577 - * - * """ - * def __init__(self, p, w): # <<<<<<<<<<<<<< - * if p < 1: - * raise ValueError("p must be greater than 1") - */ - static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance___init__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_w) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -6571,139 +7221,152 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance___in int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_5 = NULL; + __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/neighbors/dist_metrics.pyx":578 + /* "sklearn/neighbors/dist_metrics.pyx":583 * """ * def __init__(self, p, w): * if p < 1: # <<<<<<<<<<<<<< * raise ValueError("p must be greater than 1") * elif np.isinf(p): */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 578; __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[1]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 583; __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[1]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":579 + /* "sklearn/neighbors/dist_metrics.pyx":584 * def __init__(self, p, w): * if p < 1: * raise ValueError("p must be greater than 1") # <<<<<<<<<<<<<< * elif np.isinf(p): * raise ValueError("WMinkowskiDistance requires finite p. " */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 584; __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[1]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "sklearn/neighbors/dist_metrics.pyx":580 + /* "sklearn/neighbors/dist_metrics.pyx":585 * if p < 1: * raise ValueError("p must be greater than 1") * elif np.isinf(p): # <<<<<<<<<<<<<< * raise ValueError("WMinkowskiDistance requires finite p. " * "For p=inf, use ChebyshevDistance.") */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__isinf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 585; __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[1]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_p); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_p); - __Pyx_GIVEREF(__pyx_v_p); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isinf); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 585; __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 = NULL; + __Pyx_INCREF(__pyx_v_p); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_p); + __Pyx_GIVEREF(__pyx_v_p); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":581 + /* "sklearn/neighbors/dist_metrics.pyx":586 * raise ValueError("p must be greater than 1") * elif np.isinf(p): * raise ValueError("WMinkowskiDistance requires finite p. " # <<<<<<<<<<<<<< * "For p=inf, use ChebyshevDistance.") * self.p = p */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __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 = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 586; __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[1]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":583 + /* "sklearn/neighbors/dist_metrics.pyx":588 * raise ValueError("WMinkowskiDistance requires finite p. " * "For p=inf, use ChebyshevDistance.") * self.p = p # <<<<<<<<<<<<<< * self.vec = np.asarray(w, dtype=DTYPE) * self.vec_ptr = get_vec_ptr(self.vec) */ - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_p); if (unlikely((__pyx_t_5 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->__pyx_base.p = __pyx_t_5; + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_p); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->__pyx_base.p = __pyx_t_6; - /* "sklearn/neighbors/dist_metrics.pyx":584 + /* "sklearn/neighbors/dist_metrics.pyx":589 * "For p=inf, use ChebyshevDistance.") * self.p = p * self.vec = np.asarray(w, dtype=DTYPE) # <<<<<<<<<<<<<< * self.vec_ptr = get_vec_ptr(self.vec) * self.size = self.vec.shape[0] */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 589; __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[1]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_w); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_w); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_w); __Pyx_GIVEREF(__pyx_v_w); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 584; __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_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 589; __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_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[1]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->__pyx_base.vec); __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.vec)); - __pyx_v_self->__pyx_base.vec = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_v_self->__pyx_base.vec = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":585 + /* "sklearn/neighbors/dist_metrics.pyx":590 * self.p = p * self.vec = np.asarray(w, dtype=DTYPE) * self.vec_ptr = get_vec_ptr(self.vec) # <<<<<<<<<<<<<< * self.size = self.vec.shape[0] * */ - __pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base.vec); - __Pyx_INCREF(__pyx_t_6); - __pyx_v_self->__pyx_base.vec_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_vec_ptr(((PyArrayObject *)__pyx_t_6)); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base.vec); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_self->__pyx_base.vec_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_vec_ptr(((PyArrayObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":586 + /* "sklearn/neighbors/dist_metrics.pyx":591 * self.vec = np.asarray(w, dtype=DTYPE) * self.vec_ptr = get_vec_ptr(self.vec) * self.size = self.vec.shape[0] # <<<<<<<<<<<<<< @@ -6712,13 +7375,22 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance___in */ __pyx_v_self->__pyx_base.size = (__pyx_v_self->__pyx_base.vec->dimensions[0]); + /* "sklearn/neighbors/dist_metrics.pyx":582 + * + * """ + * def __init__(self, p, w): # <<<<<<<<<<<<<< + * if p < 1: + * raise ValueError("p must be greater than 1") + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.WMinkowskiDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -6726,7 +7398,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance___in return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":588 +/* "sklearn/neighbors/dist_metrics.pyx":593 * self.size = self.vec.shape[0] * * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -6748,7 +7420,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":590 + /* "sklearn/neighbors/dist_metrics.pyx":595 * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * if size != self.size: # <<<<<<<<<<<<<< @@ -6758,23 +7430,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_1 = ((__pyx_v_size != __pyx_v_self->__pyx_base.size) != 0); if (__pyx_t_1) { - /* "sklearn/neighbors/dist_metrics.pyx":591 + /* "sklearn/neighbors/dist_metrics.pyx":596 * ITYPE_t size) except -1: * if size != self.size: * raise ValueError('WMinkowskiDistance dist: ' # <<<<<<<<<<<<<< * 'size of w does not match') * cdef DTYPE_t d=0 */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 596; __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[1]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":593 + /* "sklearn/neighbors/dist_metrics.pyx":598 * raise ValueError('WMinkowskiDistance dist: ' * 'size of w does not match') * cdef DTYPE_t d=0 # <<<<<<<<<<<<<< @@ -6783,7 +7453,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_d = 0.0; - /* "sklearn/neighbors/dist_metrics.pyx":595 + /* "sklearn/neighbors/dist_metrics.pyx":600 * cdef DTYPE_t d=0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -6794,7 +7464,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/neighbors/dist_metrics.pyx":596 + /* "sklearn/neighbors/dist_metrics.pyx":601 * cdef np.intp_t j * for j in range(size): * d += pow(self.vec_ptr[j] * fabs(x1[j] - x2[j]), self.p) # <<<<<<<<<<<<<< @@ -6804,7 +7474,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_d = (__pyx_v_d + pow(((__pyx_v_self->__pyx_base.vec_ptr[__pyx_v_j]) * fabs(((__pyx_v_x1[__pyx_v_j]) - (__pyx_v_x2[__pyx_v_j])))), __pyx_v_self->__pyx_base.p)); } - /* "sklearn/neighbors/dist_metrics.pyx":597 + /* "sklearn/neighbors/dist_metrics.pyx":602 * for j in range(size): * d += pow(self.vec_ptr[j] * fabs(x1[j] - x2[j]), self.p) * return d # <<<<<<<<<<<<<< @@ -6814,8 +7484,15 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = __pyx_v_d; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":593 + * self.size = self.vec.shape[0] + * + * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * if size != self.size: + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.WMinkowskiDistance.rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -6825,7 +7502,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":599 +/* "sklearn/neighbors/dist_metrics.pyx":604 * return d * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -6842,19 +7519,26 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":601 + /* "sklearn/neighbors/dist_metrics.pyx":606 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * return pow(self.rdist(x1, x2, size), 1. / self.p) # <<<<<<<<<<<<<< * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: */ - __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = pow(__pyx_t_1, (1. / __pyx_v_self->__pyx_base.p)); goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":604 + * return d + * + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * return pow(self.rdist(x1, x2, size), 1. / self.p) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.WMinkowskiDistance.dist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1.0; @@ -6863,7 +7547,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":603 +/* "sklearn/neighbors/dist_metrics.pyx":608 * return pow(self.rdist(x1, x2, size), 1. / self.p) * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< @@ -6876,7 +7560,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":604 + /* "sklearn/neighbors/dist_metrics.pyx":609 * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: * return pow(rdist, 1. / self.p) # <<<<<<<<<<<<<< @@ -6886,13 +7570,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = pow(__pyx_v_rdist, (1. / __pyx_v_self->__pyx_base.p)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":608 + * return pow(self.rdist(x1, x2, size), 1. / self.p) + * + * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< + * return pow(rdist, 1. / self.p) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":606 +/* "sklearn/neighbors/dist_metrics.pyx":611 * return pow(rdist, 1. / self.p) * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< @@ -6905,7 +7597,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":607 + /* "sklearn/neighbors/dist_metrics.pyx":612 * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: * return pow(dist, self.p) # <<<<<<<<<<<<<< @@ -6915,12 +7607,28 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = pow(__pyx_v_dist, __pyx_v_self->__pyx_base.p); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":611 + * return pow(rdist, 1. / self.p) + * + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< + * return pow(dist, self.p) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":614 + * return pow(dist, self.p) + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return rdist ** (1. / self.p) + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist) { @@ -6928,18 +7636,12 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistanc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rdist_to_dist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_2rdist_to_dist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *)__pyx_v_self), ((PyObject *)__pyx_v_rdist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":609 - * return pow(dist, self.p) - * - * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< - * return rdist ** (1. / self.p) - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_2rdist_to_dist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *__pyx_v_self, PyObject *__pyx_v_rdist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6950,7 +7652,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistanc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":610 + /* "sklearn/neighbors/dist_metrics.pyx":615 * * def rdist_to_dist(self, rdist): * return rdist ** (1. / self.p) # <<<<<<<<<<<<<< @@ -6958,17 +7660,24 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistanc * def dist_to_rdist(self, dist): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble((1. / __pyx_v_self->__pyx_base.p)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((1. / __pyx_v_self->__pyx_base.p)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Power(__pyx_v_rdist, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_v_rdist, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":614 + * return pow(dist, self.p) + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return rdist ** (1. / self.p) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -6980,6 +7689,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistanc return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":617 + * return rdist ** (1. / self.p) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** self.p + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist) { @@ -6987,18 +7704,12 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistanc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dist_to_rdist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_4dist_to_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *)__pyx_v_self), ((PyObject *)__pyx_v_dist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":612 - * return rdist ** (1. / self.p) - * - * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< - * return dist ** self.p - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_4dist_to_rdist(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *__pyx_v_self, PyObject *__pyx_v_dist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7009,7 +7720,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistanc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":613 + /* "sklearn/neighbors/dist_metrics.pyx":618 * * def dist_to_rdist(self, dist): * return dist ** self.p # <<<<<<<<<<<<<< @@ -7017,17 +7728,24 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistanc * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Power(__pyx_v_dist, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_v_dist, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":617 + * return rdist ** (1. / self.p) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** self.p + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -7039,6 +7757,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistanc return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":639 + * then V is not referenced. + * """ + * def __init__(self, V=None, VI=None): # <<<<<<<<<<<<<< + * if VI is None: + * VI = np.linalg.inv(V) + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -7051,16 +7777,8 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_1__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__V,&__pyx_n_s__VI,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_V,&__pyx_n_s_VI,0}; PyObject* values[2] = {0,0}; - - /* "sklearn/neighbors/dist_metrics.pyx":634 - * then V is not referenced. - * """ - * def __init__(self, V=None, VI=None): # <<<<<<<<<<<<<< - * if VI is None: - * VI = np.linalg.inv(V) - */ values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { @@ -7076,17 +7794,17 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_1__ switch (pos_args) { case 0: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_V); if (value) { values[0] = value; kw_args--; } } case 1: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VI); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VI); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 634; __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[1]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -7101,13 +7819,15 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_1__ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.MahalanobisDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance___init__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *)__pyx_v_self), __pyx_v_V, __pyx_v_VI); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -7120,15 +7840,14 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance___i PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); __Pyx_INCREF(__pyx_v_VI); - /* "sklearn/neighbors/dist_metrics.pyx":635 + /* "sklearn/neighbors/dist_metrics.pyx":640 * """ * def __init__(self, V=None, VI=None): * if VI is None: # <<<<<<<<<<<<<< @@ -7139,134 +7858,149 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance___i __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":636 + /* "sklearn/neighbors/dist_metrics.pyx":641 * def __init__(self, V=None, VI=None): * if VI is None: * VI = np.linalg.inv(V) # <<<<<<<<<<<<<< * if VI.ndim != 2 or VI.shape[0] != VI.shape[1]: * raise ValueError("V/VI must be square") */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__linalg); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 641; __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_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__inv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_linalg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 641; __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[1]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_inv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_V); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_V); - __Pyx_GIVEREF(__pyx_v_V); - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_VI); - __pyx_v_VI = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_V); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 641; __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 = NULL; + __Pyx_INCREF(__pyx_v_V); + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_V); + __Pyx_GIVEREF(__pyx_v_V); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_VI, __pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L3; } __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":637 + /* "sklearn/neighbors/dist_metrics.pyx":642 * if VI is None: * VI = np.linalg.inv(V) * if VI.ndim != 2 or VI.shape[0] != VI.shape[1]: # <<<<<<<<<<<<<< * raise ValueError("V/VI must be square") * */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_VI, __pyx_n_s__ndim); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_int_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_VI, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_int_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_2) { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_VI, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 637; __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, 0, 0, 0); if (!__pyx_t_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 637; __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_PyObject_GetAttrStr(__pyx_v_VI, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 637; __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, 0, 0, 0); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 637; __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_RichCompare(__pyx_t_5, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __pyx_t_1; + if (!__pyx_t_1) { } else { - __pyx_t_6 = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + goto __pyx_L5_bool_binop_done; } - if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_VI, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 642; __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_PyObject_GetAttrStr(__pyx_v_VI, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_t_1; + __pyx_L5_bool_binop_done:; + if (__pyx_t_2) { - /* "sklearn/neighbors/dist_metrics.pyx":638 + /* "sklearn/neighbors/dist_metrics.pyx":643 * VI = np.linalg.inv(V) * if VI.ndim != 2 or VI.shape[0] != VI.shape[1]: * raise ValueError("V/VI must be square") # <<<<<<<<<<<<<< * * self.mat = np.asarray(VI, dtype=float, order='C') */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 643; __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 = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L4:; - /* "sklearn/neighbors/dist_metrics.pyx":640 + /* "sklearn/neighbors/dist_metrics.pyx":645 * raise ValueError("V/VI must be square") * * self.mat = np.asarray(VI, dtype=float, order='C') # <<<<<<<<<<<<<< * self.mat_ptr = get_mat_ptr(self.mat) * */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__asarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 645; __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[1]; __pyx_lineno = 640; __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 = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_VI); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_VI); __Pyx_GIVEREF(__pyx_v_VI); - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 640; __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 *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_s_C) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 645; __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_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_7); + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_5); __Pyx_GOTREF(__pyx_v_self->__pyx_base.mat); __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.mat)); - __pyx_v_self->__pyx_base.mat = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_v_self->__pyx_base.mat = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":641 + /* "sklearn/neighbors/dist_metrics.pyx":646 * * self.mat = np.asarray(VI, dtype=float, order='C') * self.mat_ptr = get_mat_ptr(self.mat) # <<<<<<<<<<<<<< * * self.size = self.mat.shape[0] */ - __pyx_t_7 = ((PyObject *)__pyx_v_self->__pyx_base.mat); - __Pyx_INCREF(__pyx_t_7); - __pyx_v_self->__pyx_base.mat_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_mat_ptr(((PyArrayObject *)__pyx_t_7)); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = ((PyObject *)__pyx_v_self->__pyx_base.mat); + __Pyx_INCREF(__pyx_t_5); + __pyx_v_self->__pyx_base.mat_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_mat_ptr(((PyArrayObject *)__pyx_t_5)); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":643 + /* "sklearn/neighbors/dist_metrics.pyx":648 * self.mat_ptr = get_mat_ptr(self.mat) * * self.size = self.mat.shape[0] # <<<<<<<<<<<<<< @@ -7275,62 +8009,71 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance___i */ __pyx_v_self->__pyx_base.size = (__pyx_v_self->__pyx_base.mat->dimensions[0]); - /* "sklearn/neighbors/dist_metrics.pyx":646 + /* "sklearn/neighbors/dist_metrics.pyx":651 * * # we need vec as a work buffer * self.vec = np.zeros(self.size, dtype=DTYPE) # <<<<<<<<<<<<<< * self.vec_ptr = get_vec_ptr(self.vec) * */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 651; __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_self->__pyx_base.size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 646; __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[1]; __pyx_lineno = 646; __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[1]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 651; __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[1]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 651; __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[1]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 651; __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_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 646; __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_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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[1]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_3); + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->__pyx_base.vec); __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.vec)); - __pyx_v_self->__pyx_base.vec = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_self->__pyx_base.vec = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":647 + /* "sklearn/neighbors/dist_metrics.pyx":652 * # we need vec as a work buffer * self.vec = np.zeros(self.size, dtype=DTYPE) * self.vec_ptr = get_vec_ptr(self.vec) # <<<<<<<<<<<<<< * * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, */ - __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base.vec); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_self->__pyx_base.vec_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_vec_ptr(((PyArrayObject *)__pyx_t_3)); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base.vec); + __Pyx_INCREF(__pyx_t_6); + __pyx_v_self->__pyx_base.vec_ptr = __pyx_f_7sklearn_9neighbors_12dist_metrics_get_vec_ptr(((PyArrayObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "sklearn/neighbors/dist_metrics.pyx":639 + * then V is not referenced. + * """ + * def __init__(self, V=None, VI=None): # <<<<<<<<<<<<<< + * if VI is None: + * VI = np.linalg.inv(V) + */ + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.MahalanobisDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -7339,7 +8082,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance___i return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":649 +/* "sklearn/neighbors/dist_metrics.pyx":654 * self.vec_ptr = get_vec_ptr(self.vec) * * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -7365,7 +8108,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":651 + /* "sklearn/neighbors/dist_metrics.pyx":656 * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * if size != self.size: # <<<<<<<<<<<<<< @@ -7375,23 +8118,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_1 = ((__pyx_v_size != __pyx_v_self->__pyx_base.size) != 0); if (__pyx_t_1) { - /* "sklearn/neighbors/dist_metrics.pyx":652 + /* "sklearn/neighbors/dist_metrics.pyx":657 * ITYPE_t size) except -1: * if size != self.size: * raise ValueError('Mahalanobis dist: size of V does not match') # <<<<<<<<<<<<<< * * cdef DTYPE_t tmp, d = 0 */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 657; __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[1]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":654 + /* "sklearn/neighbors/dist_metrics.pyx":659 * raise ValueError('Mahalanobis dist: size of V does not match') * * cdef DTYPE_t tmp, d = 0 # <<<<<<<<<<<<<< @@ -7400,7 +8141,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_d = 0.0; - /* "sklearn/neighbors/dist_metrics.pyx":658 + /* "sklearn/neighbors/dist_metrics.pyx":663 * * # compute (x1 - x2).T * VI * (x1 - x2) * for i in range(size): # <<<<<<<<<<<<<< @@ -7411,7 +8152,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "sklearn/neighbors/dist_metrics.pyx":659 + /* "sklearn/neighbors/dist_metrics.pyx":664 * # compute (x1 - x2).T * VI * (x1 - x2) * for i in range(size): * self.vec_ptr[i] = x1[i] - x2[i] # <<<<<<<<<<<<<< @@ -7421,7 +8162,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors (__pyx_v_self->__pyx_base.vec_ptr[__pyx_v_i]) = ((__pyx_v_x1[__pyx_v_i]) - (__pyx_v_x2[__pyx_v_i])); } - /* "sklearn/neighbors/dist_metrics.pyx":661 + /* "sklearn/neighbors/dist_metrics.pyx":666 * self.vec_ptr[i] = x1[i] - x2[i] * * for i in range(size): # <<<<<<<<<<<<<< @@ -7432,7 +8173,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "sklearn/neighbors/dist_metrics.pyx":662 + /* "sklearn/neighbors/dist_metrics.pyx":667 * * for i in range(size): * tmp = 0 # <<<<<<<<<<<<<< @@ -7441,7 +8182,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tmp = 0.0; - /* "sklearn/neighbors/dist_metrics.pyx":663 + /* "sklearn/neighbors/dist_metrics.pyx":668 * for i in range(size): * tmp = 0 * for j in range(size): # <<<<<<<<<<<<<< @@ -7452,7 +8193,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6; - /* "sklearn/neighbors/dist_metrics.pyx":664 + /* "sklearn/neighbors/dist_metrics.pyx":669 * tmp = 0 * for j in range(size): * tmp += self.mat_ptr[i * size + j] * self.vec_ptr[j] # <<<<<<<<<<<<<< @@ -7462,7 +8203,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_tmp = (__pyx_v_tmp + ((__pyx_v_self->__pyx_base.mat_ptr[((__pyx_v_i * __pyx_v_size) + __pyx_v_j)]) * (__pyx_v_self->__pyx_base.vec_ptr[__pyx_v_j]))); } - /* "sklearn/neighbors/dist_metrics.pyx":665 + /* "sklearn/neighbors/dist_metrics.pyx":670 * for j in range(size): * tmp += self.mat_ptr[i * size + j] * self.vec_ptr[j] * d += tmp * self.vec_ptr[i] # <<<<<<<<<<<<<< @@ -7472,7 +8213,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_d = (__pyx_v_d + (__pyx_v_tmp * (__pyx_v_self->__pyx_base.vec_ptr[__pyx_v_i]))); } - /* "sklearn/neighbors/dist_metrics.pyx":666 + /* "sklearn/neighbors/dist_metrics.pyx":671 * tmp += self.mat_ptr[i * size + j] * self.vec_ptr[j] * d += tmp * self.vec_ptr[i] * return d # <<<<<<<<<<<<<< @@ -7482,8 +8223,15 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = __pyx_v_d; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":654 + * self.vec_ptr = get_vec_ptr(self.vec) + * + * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * if size != self.size: + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.MahalanobisDistance.rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -7493,7 +8241,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":668 +/* "sklearn/neighbors/dist_metrics.pyx":673 * return d * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -7510,19 +8258,26 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":670 + /* "sklearn/neighbors/dist_metrics.pyx":675 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * return sqrt(self.rdist(x1, x2, size)) # <<<<<<<<<<<<<< * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: */ - __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)__pyx_v_self), __pyx_v_x1, __pyx_v_x2, __pyx_v_size); if (unlikely(__pyx_t_1 == -1.0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = sqrt(__pyx_t_1); goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":673 + * return d + * + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * return sqrt(self.rdist(x1, x2, size)) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.MahalanobisDistance.dist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1.0; @@ -7531,7 +8286,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":672 +/* "sklearn/neighbors/dist_metrics.pyx":677 * return sqrt(self.rdist(x1, x2, size)) * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< @@ -7544,7 +8299,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":673 + /* "sklearn/neighbors/dist_metrics.pyx":678 * * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: * return sqrt(rdist) # <<<<<<<<<<<<<< @@ -7554,13 +8309,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = sqrt(__pyx_v_rdist); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":677 + * return sqrt(self.rdist(x1, x2, size)) + * + * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< + * return sqrt(rdist) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":675 +/* "sklearn/neighbors/dist_metrics.pyx":680 * return sqrt(rdist) * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< @@ -7573,7 +8336,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":676 + /* "sklearn/neighbors/dist_metrics.pyx":681 * * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: * return dist * dist # <<<<<<<<<<<<<< @@ -7583,12 +8346,28 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = (__pyx_v_dist * __pyx_v_dist); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":680 + * return sqrt(rdist) + * + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< + * return dist * dist + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":683 + * return dist * dist + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return np.sqrt(rdist) + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_3rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist) { @@ -7596,30 +8375,25 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistan __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rdist_to_dist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_2rdist_to_dist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *)__pyx_v_self), ((PyObject *)__pyx_v_rdist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":678 - * return dist * dist - * - * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< - * return np.sqrt(rdist) - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_2rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *__pyx_v_self, PyObject *__pyx_v_rdist) { 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":679 + /* "sklearn/neighbors/dist_metrics.pyx":684 * * def rdist_to_dist(self, rdist): * return np.sqrt(rdist) # <<<<<<<<<<<<<< @@ -7627,30 +8401,54 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistan * def dist_to_rdist(self, dist): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 684; __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[1]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_rdist); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rdist); - __Pyx_GIVEREF(__pyx_v_rdist); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 684; __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_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_rdist); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 684; __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 = NULL; + __Pyx_INCREF(__pyx_v_rdist); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_rdist); + __Pyx_GIVEREF(__pyx_v_rdist); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":683 + * return dist * dist + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return np.sqrt(rdist) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.MahalanobisDistance.rdist_to_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -7659,6 +8457,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistan return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":686 + * return np.sqrt(rdist) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** 2 + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_5dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist) { @@ -7666,18 +8472,12 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistan __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dist_to_rdist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_4dist_to_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *)__pyx_v_self), ((PyObject *)__pyx_v_dist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":681 - * return np.sqrt(rdist) - * - * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< - * return dist ** 2 - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_4dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *__pyx_v_self, PyObject *__pyx_v_dist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7687,7 +8487,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistan int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":682 + /* "sklearn/neighbors/dist_metrics.pyx":687 * * def dist_to_rdist(self, dist): * return dist ** 2 # <<<<<<<<<<<<<< @@ -7695,14 +8495,21 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistan * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyNumber_Power(__pyx_v_dist, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(__pyx_v_dist, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":686 + * return np.sqrt(rdist) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * return dist ** 2 + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.MahalanobisDistance.dist_to_rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -7713,7 +8520,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistan return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":697 +/* "sklearn/neighbors/dist_metrics.pyx":702 * D(x, y) = \frac{1}{N} \sum_i \delta_{x_i, y_i} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -7731,7 +8538,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_t_3; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":699 + /* "sklearn/neighbors/dist_metrics.pyx":704 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef int n_unequal = 0 # <<<<<<<<<<<<<< @@ -7740,7 +8547,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_n_unequal = 0; - /* "sklearn/neighbors/dist_metrics.pyx":701 + /* "sklearn/neighbors/dist_metrics.pyx":706 * cdef int n_unequal = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -7751,7 +8558,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":702 + /* "sklearn/neighbors/dist_metrics.pyx":707 * cdef np.intp_t j * for j in range(size): * if x1[j] != x2[j]: # <<<<<<<<<<<<<< @@ -7761,7 +8568,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_3 = (((__pyx_v_x1[__pyx_v_j]) != (__pyx_v_x2[__pyx_v_j])) != 0); if (__pyx_t_3) { - /* "sklearn/neighbors/dist_metrics.pyx":703 + /* "sklearn/neighbors/dist_metrics.pyx":708 * for j in range(size): * if x1[j] != x2[j]: * n_unequal += 1 # <<<<<<<<<<<<<< @@ -7774,7 +8581,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_L5:; } - /* "sklearn/neighbors/dist_metrics.pyx":704 + /* "sklearn/neighbors/dist_metrics.pyx":709 * if x1[j] != x2[j]: * n_unequal += 1 * return float(n_unequal) / size # <<<<<<<<<<<<<< @@ -7784,13 +8591,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = (((double)__pyx_v_n_unequal) / __pyx_v_size); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":702 + * D(x, y) = \frac{1}{N} \sum_i \delta_{x_i, y_i} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef int n_unequal = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":719 +/* "sklearn/neighbors/dist_metrics.pyx":724 * D(x, y) = \sum_i \frac{|x_i - y_i|}{|x_i| + |y_i|} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -7809,7 +8624,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_t_3; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":721 + /* "sklearn/neighbors/dist_metrics.pyx":726 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef DTYPE_t denom, d = 0 # <<<<<<<<<<<<<< @@ -7818,7 +8633,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_d = 0.0; - /* "sklearn/neighbors/dist_metrics.pyx":723 + /* "sklearn/neighbors/dist_metrics.pyx":728 * cdef DTYPE_t denom, d = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -7829,7 +8644,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":724 + /* "sklearn/neighbors/dist_metrics.pyx":729 * cdef np.intp_t j * for j in range(size): * denom = abs(x1[j]) + abs(x2[j]) # <<<<<<<<<<<<<< @@ -7838,7 +8653,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_denom = (fabs((__pyx_v_x1[__pyx_v_j])) + fabs((__pyx_v_x2[__pyx_v_j]))); - /* "sklearn/neighbors/dist_metrics.pyx":725 + /* "sklearn/neighbors/dist_metrics.pyx":730 * for j in range(size): * denom = abs(x1[j]) + abs(x2[j]) * if denom > 0: # <<<<<<<<<<<<<< @@ -7848,7 +8663,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_3 = ((__pyx_v_denom > 0.0) != 0); if (__pyx_t_3) { - /* "sklearn/neighbors/dist_metrics.pyx":726 + /* "sklearn/neighbors/dist_metrics.pyx":731 * denom = abs(x1[j]) + abs(x2[j]) * if denom > 0: * d += abs(x1[j] - x2[j]) / denom # <<<<<<<<<<<<<< @@ -7861,7 +8676,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_L5:; } - /* "sklearn/neighbors/dist_metrics.pyx":727 + /* "sklearn/neighbors/dist_metrics.pyx":732 * if denom > 0: * d += abs(x1[j] - x2[j]) / denom * return d # <<<<<<<<<<<<<< @@ -7871,13 +8686,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = __pyx_v_d; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":724 + * D(x, y) = \sum_i \frac{|x_i - y_i|}{|x_i| + |y_i|} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef DTYPE_t denom, d = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":742 +/* "sklearn/neighbors/dist_metrics.pyx":747 * D(x, y) = \frac{\sum_i |x_i - y_i|}{\sum_i(|x_i| + |y_i|)} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -7896,7 +8719,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_t_3; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":744 + /* "sklearn/neighbors/dist_metrics.pyx":749 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef DTYPE_t num = 0, denom = 0 # <<<<<<<<<<<<<< @@ -7906,7 +8729,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_num = 0.0; __pyx_v_denom = 0.0; - /* "sklearn/neighbors/dist_metrics.pyx":746 + /* "sklearn/neighbors/dist_metrics.pyx":751 * cdef DTYPE_t num = 0, denom = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -7917,7 +8740,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":747 + /* "sklearn/neighbors/dist_metrics.pyx":752 * cdef np.intp_t j * for j in range(size): * num += abs(x1[j] - x2[j]) # <<<<<<<<<<<<<< @@ -7926,7 +8749,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_num = (__pyx_v_num + fabs(((__pyx_v_x1[__pyx_v_j]) - (__pyx_v_x2[__pyx_v_j])))); - /* "sklearn/neighbors/dist_metrics.pyx":748 + /* "sklearn/neighbors/dist_metrics.pyx":753 * for j in range(size): * num += abs(x1[j] - x2[j]) * denom += abs(x1[j]) + abs(x2[j]) # <<<<<<<<<<<<<< @@ -7936,7 +8759,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_denom = (__pyx_v_denom + (fabs((__pyx_v_x1[__pyx_v_j])) + fabs((__pyx_v_x2[__pyx_v_j])))); } - /* "sklearn/neighbors/dist_metrics.pyx":749 + /* "sklearn/neighbors/dist_metrics.pyx":754 * num += abs(x1[j] - x2[j]) * denom += abs(x1[j]) + abs(x2[j]) * if denom > 0: # <<<<<<<<<<<<<< @@ -7946,7 +8769,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_3 = ((__pyx_v_denom > 0.0) != 0); if (__pyx_t_3) { - /* "sklearn/neighbors/dist_metrics.pyx":750 + /* "sklearn/neighbors/dist_metrics.pyx":755 * denom += abs(x1[j]) + abs(x2[j]) * if denom > 0: * return num / denom # <<<<<<<<<<<<<< @@ -7955,11 +8778,10 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_r = (__pyx_v_num / __pyx_v_denom); goto __pyx_L0; - goto __pyx_L5; } /*else*/ { - /* "sklearn/neighbors/dist_metrics.pyx":752 + /* "sklearn/neighbors/dist_metrics.pyx":757 * return num / denom * else: * return 0.0 # <<<<<<<<<<<<<< @@ -7969,15 +8791,22 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = 0.0; goto __pyx_L0; } - __pyx_L5:; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":747 + * D(x, y) = \frac{\sum_i |x_i - y_i|}{\sum_i(|x_i| + |y_i|)} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef DTYPE_t num = 0, denom = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":768 +/* "sklearn/neighbors/dist_metrics.pyx":773 * D(x, y) = \frac{N_{TF} + N_{FT}}{N_{TT} + N_{TF} + N_{FT}} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -7998,7 +8827,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_t_3; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":770 + /* "sklearn/neighbors/dist_metrics.pyx":775 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef int tf1, tf2, n_eq = 0, nnz = 0 # <<<<<<<<<<<<<< @@ -8008,7 +8837,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_n_eq = 0; __pyx_v_nnz = 0; - /* "sklearn/neighbors/dist_metrics.pyx":772 + /* "sklearn/neighbors/dist_metrics.pyx":777 * cdef int tf1, tf2, n_eq = 0, nnz = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -8019,7 +8848,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":773 + /* "sklearn/neighbors/dist_metrics.pyx":778 * cdef np.intp_t j * for j in range(size): * tf1 = x1[j] != 0 # <<<<<<<<<<<<<< @@ -8028,7 +8857,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf1 = ((__pyx_v_x1[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":774 + /* "sklearn/neighbors/dist_metrics.pyx":779 * for j in range(size): * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 # <<<<<<<<<<<<<< @@ -8037,7 +8866,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf2 = ((__pyx_v_x2[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":775 + /* "sklearn/neighbors/dist_metrics.pyx":780 * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 * nnz += (tf1 or tf2) # <<<<<<<<<<<<<< @@ -8045,13 +8874,15 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors * return (nnz - n_eq) * 1.0 / nnz */ if (!__pyx_v_tf1) { - __pyx_t_3 = __pyx_v_tf2; } else { __pyx_t_3 = __pyx_v_tf1; + goto __pyx_L5_bool_binop_done; } + __pyx_t_3 = __pyx_v_tf2; + __pyx_L5_bool_binop_done:; __pyx_v_nnz = (__pyx_v_nnz + __pyx_t_3); - /* "sklearn/neighbors/dist_metrics.pyx":776 + /* "sklearn/neighbors/dist_metrics.pyx":781 * tf2 = x2[j] != 0 * nnz += (tf1 or tf2) * n_eq += (tf1 and tf2) # <<<<<<<<<<<<<< @@ -8059,14 +8890,16 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors * */ if (__pyx_v_tf1) { - __pyx_t_3 = __pyx_v_tf2; } else { __pyx_t_3 = __pyx_v_tf1; + goto __pyx_L7_bool_binop_done; } + __pyx_t_3 = __pyx_v_tf2; + __pyx_L7_bool_binop_done:; __pyx_v_n_eq = (__pyx_v_n_eq + __pyx_t_3); } - /* "sklearn/neighbors/dist_metrics.pyx":777 + /* "sklearn/neighbors/dist_metrics.pyx":782 * nnz += (tf1 or tf2) * n_eq += (tf1 and tf2) * return (nnz - n_eq) * 1.0 / nnz # <<<<<<<<<<<<<< @@ -8076,13 +8909,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = (((__pyx_v_nnz - __pyx_v_n_eq) * 1.0) / __pyx_v_nnz); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":773 + * D(x, y) = \frac{N_{TF} + N_{FT}}{N_{TT} + N_{TF} + N_{FT}} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef int tf1, tf2, n_eq = 0, nnz = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":793 +/* "sklearn/neighbors/dist_metrics.pyx":798 * D(x, y) = \frac{N_{TF} + N_{FT}}{N} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -8101,7 +8942,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_5numpy_intp_t __pyx_t_2; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":795 + /* "sklearn/neighbors/dist_metrics.pyx":800 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef int tf1, tf2, n_neq = 0 # <<<<<<<<<<<<<< @@ -8110,7 +8951,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_n_neq = 0; - /* "sklearn/neighbors/dist_metrics.pyx":797 + /* "sklearn/neighbors/dist_metrics.pyx":802 * cdef int tf1, tf2, n_neq = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -8121,7 +8962,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":798 + /* "sklearn/neighbors/dist_metrics.pyx":803 * cdef np.intp_t j * for j in range(size): * tf1 = x1[j] != 0 # <<<<<<<<<<<<<< @@ -8130,7 +8971,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf1 = ((__pyx_v_x1[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":799 + /* "sklearn/neighbors/dist_metrics.pyx":804 * for j in range(size): * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 # <<<<<<<<<<<<<< @@ -8139,7 +8980,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf2 = ((__pyx_v_x2[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":800 + /* "sklearn/neighbors/dist_metrics.pyx":805 * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) # <<<<<<<<<<<<<< @@ -8149,7 +8990,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_n_neq = (__pyx_v_n_neq + (__pyx_v_tf1 != __pyx_v_tf2)); } - /* "sklearn/neighbors/dist_metrics.pyx":801 + /* "sklearn/neighbors/dist_metrics.pyx":806 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) * return n_neq * 1. / size # <<<<<<<<<<<<<< @@ -8159,13 +9000,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = ((__pyx_v_n_neq * 1.) / __pyx_v_size); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":798 + * D(x, y) = \frac{N_{TF} + N_{FT}}{N} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef int tf1, tf2, n_neq = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":817 +/* "sklearn/neighbors/dist_metrics.pyx":822 * D(x, y) = \frac{N_{TF} + N_{FT}}{2 * N_{TT} + N_{TF} + N_{FT}} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -8186,7 +9035,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_t_3; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":819 + /* "sklearn/neighbors/dist_metrics.pyx":824 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef int tf1, tf2, n_neq = 0, ntt = 0 # <<<<<<<<<<<<<< @@ -8196,7 +9045,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_n_neq = 0; __pyx_v_ntt = 0; - /* "sklearn/neighbors/dist_metrics.pyx":821 + /* "sklearn/neighbors/dist_metrics.pyx":826 * cdef int tf1, tf2, n_neq = 0, ntt = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -8207,7 +9056,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":822 + /* "sklearn/neighbors/dist_metrics.pyx":827 * cdef np.intp_t j * for j in range(size): * tf1 = x1[j] != 0 # <<<<<<<<<<<<<< @@ -8216,7 +9065,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf1 = ((__pyx_v_x1[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":823 + /* "sklearn/neighbors/dist_metrics.pyx":828 * for j in range(size): * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 # <<<<<<<<<<<<<< @@ -8225,7 +9074,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf2 = ((__pyx_v_x2[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":824 + /* "sklearn/neighbors/dist_metrics.pyx":829 * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 * ntt += (tf1 and tf2) # <<<<<<<<<<<<<< @@ -8233,13 +9082,15 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors * return n_neq / (2.0 * ntt + n_neq) */ if (__pyx_v_tf1) { - __pyx_t_3 = __pyx_v_tf2; } else { __pyx_t_3 = __pyx_v_tf1; + goto __pyx_L5_bool_binop_done; } + __pyx_t_3 = __pyx_v_tf2; + __pyx_L5_bool_binop_done:; __pyx_v_ntt = (__pyx_v_ntt + __pyx_t_3); - /* "sklearn/neighbors/dist_metrics.pyx":825 + /* "sklearn/neighbors/dist_metrics.pyx":830 * tf2 = x2[j] != 0 * ntt += (tf1 and tf2) * n_neq += (tf1 != tf2) # <<<<<<<<<<<<<< @@ -8249,7 +9100,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_n_neq = (__pyx_v_n_neq + (__pyx_v_tf1 != __pyx_v_tf2)); } - /* "sklearn/neighbors/dist_metrics.pyx":826 + /* "sklearn/neighbors/dist_metrics.pyx":831 * ntt += (tf1 and tf2) * n_neq += (tf1 != tf2) * return n_neq / (2.0 * ntt + n_neq) # <<<<<<<<<<<<<< @@ -8259,13 +9110,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = (__pyx_v_n_neq / ((2.0 * __pyx_v_ntt) + __pyx_v_n_neq)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":822 + * D(x, y) = \frac{N_{TF} + N_{FT}}{2 * N_{TT} + N_{TF} + N_{FT}} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef int tf1, tf2, n_neq = 0, ntt = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":842 +/* "sklearn/neighbors/dist_metrics.pyx":847 * D(x, y) = 1 - \frac{N_{TT}}{N + N_{TF} + N_{FT}} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -8286,7 +9145,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_t_3; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":844 + /* "sklearn/neighbors/dist_metrics.pyx":849 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef int tf1, tf2, ntt = 0, n_neq = 0 # <<<<<<<<<<<<<< @@ -8296,7 +9155,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_ntt = 0; __pyx_v_n_neq = 0; - /* "sklearn/neighbors/dist_metrics.pyx":846 + /* "sklearn/neighbors/dist_metrics.pyx":851 * cdef int tf1, tf2, ntt = 0, n_neq = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -8307,7 +9166,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":847 + /* "sklearn/neighbors/dist_metrics.pyx":852 * cdef np.intp_t j * for j in range(size): * tf1 = x1[j] != 0 # <<<<<<<<<<<<<< @@ -8316,7 +9175,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf1 = ((__pyx_v_x1[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":848 + /* "sklearn/neighbors/dist_metrics.pyx":853 * for j in range(size): * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 # <<<<<<<<<<<<<< @@ -8325,7 +9184,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf2 = ((__pyx_v_x2[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":849 + /* "sklearn/neighbors/dist_metrics.pyx":854 * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) # <<<<<<<<<<<<<< @@ -8334,7 +9193,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_n_neq = (__pyx_v_n_neq + (__pyx_v_tf1 != __pyx_v_tf2)); - /* "sklearn/neighbors/dist_metrics.pyx":850 + /* "sklearn/neighbors/dist_metrics.pyx":855 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) * ntt += (tf1 and tf2) # <<<<<<<<<<<<<< @@ -8342,14 +9201,16 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors * */ if (__pyx_v_tf1) { - __pyx_t_3 = __pyx_v_tf2; } else { __pyx_t_3 = __pyx_v_tf1; + goto __pyx_L5_bool_binop_done; } + __pyx_t_3 = __pyx_v_tf2; + __pyx_L5_bool_binop_done:; __pyx_v_ntt = (__pyx_v_ntt + __pyx_t_3); } - /* "sklearn/neighbors/dist_metrics.pyx":851 + /* "sklearn/neighbors/dist_metrics.pyx":856 * n_neq += (tf1 != tf2) * ntt += (tf1 and tf2) * return (n_neq - ntt + size) * 1.0 / (n_neq + size) # <<<<<<<<<<<<<< @@ -8359,13 +9220,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = ((((__pyx_v_n_neq - __pyx_v_ntt) + __pyx_v_size) * 1.0) / (__pyx_v_n_neq + __pyx_v_size)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":847 + * D(x, y) = 1 - \frac{N_{TT}}{N + N_{TF} + N_{FT}} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef int tf1, tf2, ntt = 0, n_neq = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":867 +/* "sklearn/neighbors/dist_metrics.pyx":872 * D(x, y) = \frac{2 (N_{TF} + N_{FT})}{N + N_{TF} + N_{FT}} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -8384,7 +9253,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_5numpy_intp_t __pyx_t_2; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":869 + /* "sklearn/neighbors/dist_metrics.pyx":874 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef int tf1, tf2, n_neq = 0 # <<<<<<<<<<<<<< @@ -8393,7 +9262,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_n_neq = 0; - /* "sklearn/neighbors/dist_metrics.pyx":871 + /* "sklearn/neighbors/dist_metrics.pyx":876 * cdef int tf1, tf2, n_neq = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -8404,7 +9273,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":872 + /* "sklearn/neighbors/dist_metrics.pyx":877 * cdef np.intp_t j * for j in range(size): * tf1 = x1[j] != 0 # <<<<<<<<<<<<<< @@ -8413,7 +9282,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf1 = ((__pyx_v_x1[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":873 + /* "sklearn/neighbors/dist_metrics.pyx":878 * for j in range(size): * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 # <<<<<<<<<<<<<< @@ -8422,7 +9291,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf2 = ((__pyx_v_x2[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":874 + /* "sklearn/neighbors/dist_metrics.pyx":879 * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) # <<<<<<<<<<<<<< @@ -8432,7 +9301,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_n_neq = (__pyx_v_n_neq + (__pyx_v_tf1 != __pyx_v_tf2)); } - /* "sklearn/neighbors/dist_metrics.pyx":875 + /* "sklearn/neighbors/dist_metrics.pyx":880 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) * return (2.0 * n_neq) / (size + n_neq) # <<<<<<<<<<<<<< @@ -8442,13 +9311,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = ((2.0 * __pyx_v_n_neq) / (__pyx_v_size + __pyx_v_n_neq)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":872 + * D(x, y) = \frac{2 (N_{TF} + N_{FT})}{N + N_{TF} + N_{FT}} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef int tf1, tf2, n_neq = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":891 +/* "sklearn/neighbors/dist_metrics.pyx":896 * D(x, y) = \frac{N - N_{TT}}{N} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -8468,7 +9345,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_t_3; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":893 + /* "sklearn/neighbors/dist_metrics.pyx":898 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef int tf1, tf2, ntt = 0 # <<<<<<<<<<<<<< @@ -8477,7 +9354,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_ntt = 0; - /* "sklearn/neighbors/dist_metrics.pyx":895 + /* "sklearn/neighbors/dist_metrics.pyx":900 * cdef int tf1, tf2, ntt = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -8488,7 +9365,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":896 + /* "sklearn/neighbors/dist_metrics.pyx":901 * cdef np.intp_t j * for j in range(size): * tf1 = x1[j] != 0 # <<<<<<<<<<<<<< @@ -8497,7 +9374,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf1 = ((__pyx_v_x1[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":897 + /* "sklearn/neighbors/dist_metrics.pyx":902 * for j in range(size): * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 # <<<<<<<<<<<<<< @@ -8506,7 +9383,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf2 = ((__pyx_v_x2[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":898 + /* "sklearn/neighbors/dist_metrics.pyx":903 * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 * ntt += (tf1 and tf2) # <<<<<<<<<<<<<< @@ -8514,14 +9391,16 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors * */ if (__pyx_v_tf1) { - __pyx_t_3 = __pyx_v_tf2; } else { __pyx_t_3 = __pyx_v_tf1; + goto __pyx_L5_bool_binop_done; } + __pyx_t_3 = __pyx_v_tf2; + __pyx_L5_bool_binop_done:; __pyx_v_ntt = (__pyx_v_ntt + __pyx_t_3); } - /* "sklearn/neighbors/dist_metrics.pyx":899 + /* "sklearn/neighbors/dist_metrics.pyx":904 * tf2 = x2[j] != 0 * ntt += (tf1 and tf2) * return (size - ntt) * 1. / size # <<<<<<<<<<<<<< @@ -8531,13 +9410,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = (((__pyx_v_size - __pyx_v_ntt) * 1.) / __pyx_v_size); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":896 + * D(x, y) = \frac{N - N_{TT}}{N} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef int tf1, tf2, ntt = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":915 +/* "sklearn/neighbors/dist_metrics.pyx":920 * D(x, y) = \frac{2 (N_{TF} + N_{FT})}{N + N_{TF} + N_{FT}} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -8556,7 +9443,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_5numpy_intp_t __pyx_t_2; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":917 + /* "sklearn/neighbors/dist_metrics.pyx":922 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef int tf1, tf2, n_neq = 0 # <<<<<<<<<<<<<< @@ -8565,7 +9452,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_n_neq = 0; - /* "sklearn/neighbors/dist_metrics.pyx":919 + /* "sklearn/neighbors/dist_metrics.pyx":924 * cdef int tf1, tf2, n_neq = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -8576,7 +9463,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":920 + /* "sklearn/neighbors/dist_metrics.pyx":925 * cdef np.intp_t j * for j in range(size): * tf1 = x1[j] != 0 # <<<<<<<<<<<<<< @@ -8585,7 +9472,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf1 = ((__pyx_v_x1[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":921 + /* "sklearn/neighbors/dist_metrics.pyx":926 * for j in range(size): * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 # <<<<<<<<<<<<<< @@ -8594,7 +9481,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf2 = ((__pyx_v_x2[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":922 + /* "sklearn/neighbors/dist_metrics.pyx":927 * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) # <<<<<<<<<<<<<< @@ -8604,7 +9491,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_n_neq = (__pyx_v_n_neq + (__pyx_v_tf1 != __pyx_v_tf2)); } - /* "sklearn/neighbors/dist_metrics.pyx":923 + /* "sklearn/neighbors/dist_metrics.pyx":928 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) * return (2.0 * n_neq) / (size + n_neq) # <<<<<<<<<<<<<< @@ -8614,13 +9501,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = ((2.0 * __pyx_v_n_neq) / (__pyx_v_size + __pyx_v_n_neq)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":920 + * D(x, y) = \frac{2 (N_{TF} + N_{FT})}{N + N_{TF} + N_{FT}} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef int tf1, tf2, n_neq = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":939 +/* "sklearn/neighbors/dist_metrics.pyx":944 * D(x, y) = \frac{N_{TF} + N_{FT}}{N_{TT} / 2 + N_{TF} + N_{FT}} * """ * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -8641,7 +9536,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_t_3; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":941 + /* "sklearn/neighbors/dist_metrics.pyx":946 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef int tf1, tf2, ntt = 0, n_neq = 0 # <<<<<<<<<<<<<< @@ -8651,7 +9546,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_v_ntt = 0; __pyx_v_n_neq = 0; - /* "sklearn/neighbors/dist_metrics.pyx":943 + /* "sklearn/neighbors/dist_metrics.pyx":948 * cdef int tf1, tf2, ntt = 0, n_neq = 0 * cdef np.intp_t j * for j in range(size): # <<<<<<<<<<<<<< @@ -8662,7 +9557,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/neighbors/dist_metrics.pyx":944 + /* "sklearn/neighbors/dist_metrics.pyx":949 * cdef np.intp_t j * for j in range(size): * tf1 = x1[j] != 0 # <<<<<<<<<<<<<< @@ -8671,7 +9566,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf1 = ((__pyx_v_x1[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":945 + /* "sklearn/neighbors/dist_metrics.pyx":950 * for j in range(size): * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 # <<<<<<<<<<<<<< @@ -8680,7 +9575,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_tf2 = ((__pyx_v_x2[__pyx_v_j]) != 0.0); - /* "sklearn/neighbors/dist_metrics.pyx":946 + /* "sklearn/neighbors/dist_metrics.pyx":951 * tf1 = x1[j] != 0 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) # <<<<<<<<<<<<<< @@ -8689,7 +9584,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_n_neq = (__pyx_v_n_neq + (__pyx_v_tf1 != __pyx_v_tf2)); - /* "sklearn/neighbors/dist_metrics.pyx":947 + /* "sklearn/neighbors/dist_metrics.pyx":952 * tf2 = x2[j] != 0 * n_neq += (tf1 != tf2) * ntt += (tf1 and tf2) # <<<<<<<<<<<<<< @@ -8697,14 +9592,16 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors * */ if (__pyx_v_tf1) { - __pyx_t_3 = __pyx_v_tf2; } else { __pyx_t_3 = __pyx_v_tf1; + goto __pyx_L5_bool_binop_done; } + __pyx_t_3 = __pyx_v_tf2; + __pyx_L5_bool_binop_done:; __pyx_v_ntt = (__pyx_v_ntt + __pyx_t_3); } - /* "sklearn/neighbors/dist_metrics.pyx":948 + /* "sklearn/neighbors/dist_metrics.pyx":953 * n_neq += (tf1 != tf2) * ntt += (tf1 and tf2) * return n_neq / (0.5 * ntt + n_neq) # <<<<<<<<<<<<<< @@ -8714,13 +9611,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = (__pyx_v_n_neq / ((0.5 * __pyx_v_ntt) + __pyx_v_n_neq)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":944 + * D(x, y) = \frac{N_{TF} + N_{FT}}{N_{TT} / 2 + N_{TF} + N_{FT}} + * """ + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef int tf1, tf2, ntt = 0, n_neq = 0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":967 +/* "sklearn/neighbors/dist_metrics.pyx":972 * + cos(x1)cos(y1)sin^2((x2 - y2) / 2)}] * """ * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -8740,7 +9645,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":969 + /* "sklearn/neighbors/dist_metrics.pyx":974 * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * if size != 2: # <<<<<<<<<<<<<< @@ -8750,23 +9655,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_1 = ((__pyx_v_size != 2) != 0); if (__pyx_t_1) { - /* "sklearn/neighbors/dist_metrics.pyx":970 + /* "sklearn/neighbors/dist_metrics.pyx":975 * ITYPE_t size) except -1: * if size != 2: * raise ValueError("Haversine distance only valid in 2 dimensions") # <<<<<<<<<<<<<< * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) * cdef DTYPE_t sin_1 = sin(0.5 * (x1[1] - x2[1])) */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 975; __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[1]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":971 + /* "sklearn/neighbors/dist_metrics.pyx":976 * if size != 2: * raise ValueError("Haversine distance only valid in 2 dimensions") * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) # <<<<<<<<<<<<<< @@ -8775,7 +9678,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_sin_0 = sin((0.5 * ((__pyx_v_x1[0]) - (__pyx_v_x2[0])))); - /* "sklearn/neighbors/dist_metrics.pyx":972 + /* "sklearn/neighbors/dist_metrics.pyx":977 * raise ValueError("Haversine distance only valid in 2 dimensions") * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) * cdef DTYPE_t sin_1 = sin(0.5 * (x1[1] - x2[1])) # <<<<<<<<<<<<<< @@ -8784,7 +9687,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_sin_1 = sin((0.5 * ((__pyx_v_x1[1]) - (__pyx_v_x2[1])))); - /* "sklearn/neighbors/dist_metrics.pyx":973 + /* "sklearn/neighbors/dist_metrics.pyx":978 * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) * cdef DTYPE_t sin_1 = sin(0.5 * (x1[1] - x2[1])) * return (sin_0 * sin_0 + cos(x1[0]) * cos(x2[0]) * sin_1 * sin_1) # <<<<<<<<<<<<<< @@ -8794,8 +9697,15 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = ((__pyx_v_sin_0 * __pyx_v_sin_0) + (((cos((__pyx_v_x1[0])) * cos((__pyx_v_x2[0]))) * __pyx_v_sin_1) * __pyx_v_sin_1)); goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":972 + * + cos(x1)cos(y1)sin^2((x2 - y2) / 2)}] + * """ + * cdef inline DTYPE_t rdist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * if size != 2: + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.HaversineDistance.rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -8805,7 +9715,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":975 +/* "sklearn/neighbors/dist_metrics.pyx":980 * return (sin_0 * sin_0 + cos(x1[0]) * cos(x2[0]) * sin_1 * sin_1) * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -8825,7 +9735,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":977 + /* "sklearn/neighbors/dist_metrics.pyx":982 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * if size != 2: # <<<<<<<<<<<<<< @@ -8835,23 +9745,21 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_t_1 = ((__pyx_v_size != 2) != 0); if (__pyx_t_1) { - /* "sklearn/neighbors/dist_metrics.pyx":978 + /* "sklearn/neighbors/dist_metrics.pyx":983 * ITYPE_t size) except -1: * if size != 2: * raise ValueError("Haversine distance only valid in 2 dimensions") # <<<<<<<<<<<<<< * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) * cdef DTYPE_t sin_1 = sin(0.5 * (x1[1] - x2[1])) */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 983; __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[1]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/neighbors/dist_metrics.pyx":979 + /* "sklearn/neighbors/dist_metrics.pyx":984 * if size != 2: * raise ValueError("Haversine distance only valid in 2 dimensions") * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) # <<<<<<<<<<<<<< @@ -8860,7 +9768,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_sin_0 = sin((0.5 * ((__pyx_v_x1[0]) - (__pyx_v_x2[0])))); - /* "sklearn/neighbors/dist_metrics.pyx":980 + /* "sklearn/neighbors/dist_metrics.pyx":985 * raise ValueError("Haversine distance only valid in 2 dimensions") * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) * cdef DTYPE_t sin_1 = sin(0.5 * (x1[1] - x2[1])) # <<<<<<<<<<<<<< @@ -8869,18 +9777,25 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors */ __pyx_v_sin_1 = sin((0.5 * ((__pyx_v_x1[1]) - (__pyx_v_x2[1])))); - /* "sklearn/neighbors/dist_metrics.pyx":982 + /* "sklearn/neighbors/dist_metrics.pyx":986 + * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) * cdef DTYPE_t sin_1 = sin(0.5 * (x1[1] - x2[1])) - * return 2 * asin(sqrt(sin_0 * sin_0 - * + cos(x1[0]) * cos(x2[0]) * sin_1 * sin_1)) # <<<<<<<<<<<<<< + * return 2 * asin(sqrt(sin_0 * sin_0 # <<<<<<<<<<<<<< + * + cos(x1[0]) * cos(x2[0]) * sin_1 * sin_1)) * - * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist): */ __pyx_r = (2.0 * asin(sqrt(((__pyx_v_sin_0 * __pyx_v_sin_0) + (((cos((__pyx_v_x1[0])) * cos((__pyx_v_x2[0]))) * __pyx_v_sin_1) * __pyx_v_sin_1))))); goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":980 + * return (sin_0 * sin_0 + cos(x1[0]) * cos(x2[0]) * sin_1 * sin_1) + * + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * if size != 2: + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.HaversineDistance.dist", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -8890,10 +9805,10 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":984 +/* "sklearn/neighbors/dist_metrics.pyx":989 * + cos(x1[0]) * cos(x2[0]) * sin_1 * sin_1)) * - * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist): # <<<<<<<<<<<<<< + * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< * return 2 * asin(sqrt(rdist)) * */ @@ -8903,26 +9818,34 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":985 + /* "sklearn/neighbors/dist_metrics.pyx":990 * - * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist): + * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: * return 2 * asin(sqrt(rdist)) # <<<<<<<<<<<<<< * - * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist): + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: */ __pyx_r = (2.0 * asin(sqrt(__pyx_v_rdist))); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":989 + * + cos(x1[0]) * cos(x2[0]) * sin_1 * sin_1)) + * + * cdef inline DTYPE_t _rdist_to_dist(self, DTYPE_t rdist) except -1: # <<<<<<<<<<<<<< + * return 2 * asin(sqrt(rdist)) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":987 +/* "sklearn/neighbors/dist_metrics.pyx":992 * return 2 * asin(sqrt(rdist)) * - * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist): # <<<<<<<<<<<<<< + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< * cdef DTYPE_t tmp = sin(0.5 * dist) * return tmp * tmp */ @@ -8933,17 +9856,17 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":988 + /* "sklearn/neighbors/dist_metrics.pyx":993 * - * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist): + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: * cdef DTYPE_t tmp = sin(0.5 * dist) # <<<<<<<<<<<<<< * return tmp * tmp * */ __pyx_v_tmp = sin((0.5 * __pyx_v_dist)); - /* "sklearn/neighbors/dist_metrics.pyx":989 - * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist): + /* "sklearn/neighbors/dist_metrics.pyx":994 + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: * cdef DTYPE_t tmp = sin(0.5 * dist) * return tmp * tmp # <<<<<<<<<<<<<< * @@ -8952,12 +9875,28 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __pyx_r = (__pyx_v_tmp * __pyx_v_tmp); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":992 + * return 2 * asin(sqrt(rdist)) + * + * cdef inline DTYPE_t _dist_to_rdist(self, DTYPE_t dist) except -1: # <<<<<<<<<<<<<< + * cdef DTYPE_t tmp = sin(0.5 * dist) + * return tmp * tmp + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":996 + * return tmp * tmp + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return 2 * np.arcsin(np.sqrt(rdist)) + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_1rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist); /*proto*/ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_1rdist_to_dist(PyObject *__pyx_v_self, PyObject *__pyx_v_rdist) { @@ -8965,18 +9904,12 @@ static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rdist_to_dist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_rdist_to_dist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *)__pyx_v_self), ((PyObject *)__pyx_v_rdist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":991 - * return tmp * tmp - * - * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< - * return 2 * np.arcsin(np.sqrt(rdist)) - * - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_rdist_to_dist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *__pyx_v_self, PyObject *__pyx_v_rdist) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8984,12 +9917,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rdist_to_dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":992 + /* "sklearn/neighbors/dist_metrics.pyx":997 * * def rdist_to_dist(self, rdist): * return 2 * np.arcsin(np.sqrt(rdist)) # <<<<<<<<<<<<<< @@ -8997,48 +9932,90 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance * def dist_to_rdist(self, dist): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__arcsin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __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_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arcsin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __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[1]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_rdist); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rdist); - __Pyx_GIVEREF(__pyx_v_rdist); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 992; __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[1]; __pyx_lineno = 992; __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_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (!__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_rdist); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __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 = NULL; + __Pyx_INCREF(__pyx_v_rdist); + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_rdist); + __Pyx_GIVEREF(__pyx_v_rdist); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __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 = NULL; + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":996 + * return tmp * tmp + * + * def rdist_to_dist(self, rdist): # <<<<<<<<<<<<<< + * return 2 * np.arcsin(np.sqrt(rdist)) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.HaversineDistance.rdist_to_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -9047,25 +10024,27 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance return __pyx_r; } -/* Python wrapper */ -static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_3dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist); /*proto*/ -static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_3dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist) { +/* "sklearn/neighbors/dist_metrics.pyx":999 + * return 2 * np.arcsin(np.sqrt(rdist)) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * tmp = np.sin(0.5 * dist) + * return tmp * tmp + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_3dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist); /*proto*/ +static PyObject *__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_3dist_to_rdist(PyObject *__pyx_v_self, PyObject *__pyx_v_dist) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dist_to_rdist (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_2dist_to_rdist(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *)__pyx_v_self), ((PyObject *)__pyx_v_dist)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":994 - * return 2 * np.arcsin(np.sqrt(rdist)) - * - * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< - * tmp = np.sin(0.5 * dist) - * return tmp * tmp - */ - static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_2dist_to_rdist(CYTHON_UNUSED struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *__pyx_v_self, PyObject *__pyx_v_dist) { PyObject *__pyx_v_tmp = NULL; PyObject *__pyx_r = NULL; @@ -9073,41 +10052,57 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist_to_rdist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":995 + /* "sklearn/neighbors/dist_metrics.pyx":1000 * * def dist_to_rdist(self, dist): * tmp = np.sin(0.5 * dist) # <<<<<<<<<<<<<< * return tmp * tmp * */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1000; __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(0.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_dist); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 995; __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[1]; __pyx_lineno = 995; __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_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1000; __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_v_tmp = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = PyNumber_Multiply(__pyx_float_0_5, __pyx_v_dist); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1000; __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 = NULL; + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_tmp = __pyx_t_1; + __pyx_t_1 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":996 + /* "sklearn/neighbors/dist_metrics.pyx":1001 * def dist_to_rdist(self, dist): * tmp = np.sin(0.5 * dist) * return tmp * tmp # <<<<<<<<<<<<<< @@ -9115,18 +10110,27 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_tmp, __pyx_v_tmp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_v_tmp, __pyx_v_tmp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":999 + * return 2 * np.arcsin(np.sqrt(rdist)) + * + * def dist_to_rdist(self, dist): # <<<<<<<<<<<<<< + * tmp = np.sin(0.5 * dist) + * return tmp * tmp + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.HaversineDistance.dist_to_rdist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -9136,6 +10140,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_12dist_metrics_17HaversineDistance return __pyx_r; } +/* "sklearn/neighbors/dist_metrics.pyx":1079 + * func should take two numpy arrays as input, and return a distance. + * """ + * def __init__(self, func, **kwargs): # <<<<<<<<<<<<<< + * self.func = func + * x = np.random.random(10) + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -9150,7 +10162,7 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance_1__init_ __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; __Pyx_GOTREF(__pyx_v_kwargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__func,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -9163,11 +10175,11 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance_1__init_ kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_func)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -9178,7 +10190,7 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance_1__init_ } 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[1]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.PyFuncDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -9186,19 +10198,13 @@ static int __pyx_pw_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance_1__init_ return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__(((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_PyFuncDistance *)__pyx_v_self), __pyx_v_func, __pyx_v_kwargs); + + /* function exit code */ __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":1074 - * func should take two numpy arrays as input, and return a distance. - * """ - * def __init__(self, func, **kwargs): # <<<<<<<<<<<<<< - * self.func = func - * x = np.random.random(10) - */ - static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_PyFuncDistance *__pyx_v_self, PyObject *__pyx_v_func, PyObject *__pyx_v_kwargs) { PyObject *__pyx_v_x = NULL; PyObject *__pyx_v_d = NULL; @@ -9218,7 +10224,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/neighbors/dist_metrics.pyx":1075 + /* "sklearn/neighbors/dist_metrics.pyx":1080 * """ * def __init__(self, func, **kwargs): * self.func = func # <<<<<<<<<<<<<< @@ -9231,28 +10237,28 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ __Pyx_DECREF(__pyx_v_self->__pyx_base.func); __pyx_v_self->__pyx_base.func = __pyx_v_func; - /* "sklearn/neighbors/dist_metrics.pyx":1076 + /* "sklearn/neighbors/dist_metrics.pyx":1081 * def __init__(self, func, **kwargs): * self.func = func * x = np.random.random(10) # <<<<<<<<<<<<<< * try: * d = self.func(x, x, **kwargs) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__random); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_random); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1081; __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_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_x = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":1077 + /* "sklearn/neighbors/dist_metrics.pyx":1082 * self.func = func * x = np.random.random(10) * try: # <<<<<<<<<<<<<< @@ -9266,14 +10272,14 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { - /* "sklearn/neighbors/dist_metrics.pyx":1078 + /* "sklearn/neighbors/dist_metrics.pyx":1083 * x = np.random.random(10) * try: * d = self.func(x, x, **kwargs) # <<<<<<<<<<<<<< * except TypeError: * raise ValueError("func must be a callable taking two arrays") */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_x); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x); @@ -9281,12 +10287,12 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ __Pyx_INCREF(__pyx_v_x); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); - __pyx_t_1 = ((PyObject *)__pyx_v_kwargs); + __pyx_t_1 = __pyx_v_kwargs; __Pyx_INCREF(__pyx_t_1); - __pyx_t_6 = PyObject_Call(__pyx_v_self->__pyx_base.func, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_self->__pyx_base.func, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_d = __pyx_t_6; __pyx_t_6 = 0; } @@ -9299,7 +10305,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":1079 + /* "sklearn/neighbors/dist_metrics.pyx":1084 * try: * d = self.func(x, x, **kwargs) * except TypeError: # <<<<<<<<<<<<<< @@ -9309,43 +10315,35 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_TypeError); if (__pyx_t_7) { __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.PyFuncDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/neighbors/dist_metrics.pyx":1080 + /* "sklearn/neighbors/dist_metrics.pyx":1085 * d = self.func(x, x, **kwargs) * except TypeError: * raise ValueError("func must be a callable taking two arrays") # <<<<<<<<<<<<<< * * try: */ - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L4_exception_handled; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} } + goto __pyx_L5_except_error; __pyx_L5_except_error:; __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L1_error; - __pyx_L4_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); __pyx_L10_try_end:; } - /* "sklearn/neighbors/dist_metrics.pyx":1082 + /* "sklearn/neighbors/dist_metrics.pyx":1087 * raise ValueError("func must be a callable taking two arrays") * * try: # <<<<<<<<<<<<<< @@ -9359,18 +10357,17 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "sklearn/neighbors/dist_metrics.pyx":1083 + /* "sklearn/neighbors/dist_metrics.pyx":1088 * * try: * d = float(d) # <<<<<<<<<<<<<< * except TypeError: * raise ValueError("func must return a float") */ - __pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_v_d); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L13_error;} - __pyx_t_2 = PyFloat_FromDouble(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_v_d); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L13_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_d); - __pyx_v_d = __pyx_t_2; + __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_2); __pyx_t_2 = 0; } __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9383,7 +10380,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":1084 + /* "sklearn/neighbors/dist_metrics.pyx":1089 * try: * d = float(d) * except TypeError: # <<<<<<<<<<<<<< @@ -9393,55 +10390,56 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_TypeError); if (__pyx_t_7) { __Pyx_AddTraceback("sklearn.neighbors.dist_metrics.PyFuncDistance.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_6); - /* "sklearn/neighbors/dist_metrics.pyx":1085 + /* "sklearn/neighbors/dist_metrics.pyx":1090 * d = float(d) * except TypeError: * raise ValueError("func must return a float") # <<<<<<<<<<<<<< * * self.kwargs = kwargs */ - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L14_exception_handled; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} } + goto __pyx_L15_except_error; __pyx_L15_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); goto __pyx_L1_error; - __pyx_L14_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); __pyx_L20_try_end:; } - /* "sklearn/neighbors/dist_metrics.pyx":1087 + /* "sklearn/neighbors/dist_metrics.pyx":1092 * raise ValueError("func must return a float") * * self.kwargs = kwargs # <<<<<<<<<<<<<< * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, */ - __Pyx_INCREF(((PyObject *)__pyx_v_kwargs)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_kwargs)); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); __Pyx_GOTREF(__pyx_v_self->__pyx_base.kwargs); __Pyx_DECREF(__pyx_v_self->__pyx_base.kwargs); - __pyx_v_self->__pyx_base.kwargs = ((PyObject *)__pyx_v_kwargs); + __pyx_v_self->__pyx_base.kwargs = __pyx_v_kwargs; + + /* "sklearn/neighbors/dist_metrics.pyx":1079 + * func should take two numpy arrays as input, and return a distance. + * """ + * def __init__(self, func, **kwargs): # <<<<<<<<<<<<<< + * self.func = func + * x = np.random.random(10) + */ + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -9458,7 +10456,7 @@ static int __pyx_pf_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance___init__ return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":1089 +/* "sklearn/neighbors/dist_metrics.pyx":1094 * self.kwargs = kwargs * * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< @@ -9480,38 +10478,38 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/dist_metrics.pyx":1091 + /* "sklearn/neighbors/dist_metrics.pyx":1096 * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, * ITYPE_t size) except -1: * cdef np.ndarray x1arr = _buffer_to_ndarray(x1, size) # <<<<<<<<<<<<<< * cdef np.ndarray x2arr = _buffer_to_ndarray(x2, size) * return self.func(x1arr, x2arr, **self.kwargs) */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_9neighbors_12dist_metrics__buffer_to_ndarray(__pyx_v_x1, __pyx_v_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_9neighbors_12dist_metrics__buffer_to_ndarray(__pyx_v_x1, __pyx_v_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_x1arr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":1092 + /* "sklearn/neighbors/dist_metrics.pyx":1097 * ITYPE_t size) except -1: * cdef np.ndarray x1arr = _buffer_to_ndarray(x1, size) * cdef np.ndarray x2arr = _buffer_to_ndarray(x2, size) # <<<<<<<<<<<<<< * return self.func(x1arr, x2arr, **self.kwargs) * */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_9neighbors_12dist_metrics__buffer_to_ndarray(__pyx_v_x2, __pyx_v_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_9neighbors_12dist_metrics__buffer_to_ndarray(__pyx_v_x2, __pyx_v_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_x2arr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":1093 + /* "sklearn/neighbors/dist_metrics.pyx":1098 * cdef np.ndarray x1arr = _buffer_to_ndarray(x1, size) * cdef np.ndarray x2arr = _buffer_to_ndarray(x2, size) * return self.func(x1arr, x2arr, **self.kwargs) # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_x1arr)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_x1arr)); @@ -9521,26 +10519,33 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors __Pyx_GIVEREF(((PyObject *)__pyx_v_x2arr)); if (unlikely(__pyx_v_self->__pyx_base.kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (likely(PyDict_Check(__pyx_v_self->__pyx_base.kwargs))) { __pyx_t_2 = __pyx_v_self->__pyx_base.kwargs; __Pyx_INCREF(__pyx_t_2); } else { - __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_self->__pyx_base.kwargs, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_self->__pyx_base.kwargs, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_3 = PyObject_Call(__pyx_v_self->__pyx_base.func, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_self->__pyx_base.func, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1093; __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_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "sklearn/neighbors/dist_metrics.pyx":1094 + * self.kwargs = kwargs + * + * cdef inline DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef np.ndarray x1arr = _buffer_to_ndarray(x1, size) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -9554,7 +10559,7 @@ static __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7sklearn_9neighbors return __pyx_r; } -/* "sklearn/neighbors/dist_metrics.pyx":1096 +/* "sklearn/neighbors/dist_metrics.pyx":1101 * * * cdef inline double fmax(double a, double b): # <<<<<<<<<<<<<< @@ -9569,7 +10574,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_9neighbors_12dist_metrics_fmax(doub double __pyx_t_3; __Pyx_RefNannySetupContext("fmax", 0); - /* "sklearn/neighbors/dist_metrics.pyx":1097 + /* "sklearn/neighbors/dist_metrics.pyx":1102 * * cdef inline double fmax(double a, double b): * return max(a, b) # <<<<<<<<<<<<<< @@ -9584,7 +10589,14 @@ static CYTHON_INLINE double __pyx_f_7sklearn_9neighbors_12dist_metrics_fmax(doub __pyx_r = __pyx_t_3; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pyx":1101 + * + * + * cdef inline double fmax(double a, double b): # <<<<<<<<<<<<<< + * return max(a, b) + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -9657,7 +10669,15 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7skle __pyx_r = sqrt(__pyx_v_d); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pxd":18 + * # We use these for the default (euclidean) case so that they can be + * # inlined. This leads to faster computation for the most common case + * cdef inline DTYPE_t euclidean_dist(DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef DTYPE_t tmp, d=0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -9730,7 +10750,15 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7skle __pyx_r = __pyx_v_d; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pxd":28 + * + * + * cdef inline DTYPE_t euclidean_rdist(DTYPE_t* x1, DTYPE_t* x2, # <<<<<<<<<<<<<< + * ITYPE_t size) except -1: + * cdef DTYPE_t tmp, d=0 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -9759,7 +10787,15 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7skle __pyx_r = (__pyx_v_dist * __pyx_v_dist); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pxd":38 + * + * + * cdef inline DTYPE_t euclidean_dist_to_rdist(DTYPE_t dist) except -1: # <<<<<<<<<<<<<< + * return dist * dist + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -9788,12 +10824,28 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t __pyx_f_7skle __pyx_r = sqrt(__pyx_v_dist); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/neighbors/dist_metrics.pxd":42 + * + * + * cdef inline DTYPE_t euclidean_rdist_to_dist(DTYPE_t dist) except -1: # <<<<<<<<<<<<<< + * return sqrt(dist) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { @@ -9801,18 +10853,12 @@ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numpy.pxd":194 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; @@ -9828,13 +10874,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - char *__pyx_t_9; + PyObject *__pyx_t_6 = NULL; + char *__pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9844,7 +10888,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":200 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -9855,11 +10899,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "numpy.pxd":203 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -9868,7 +10910,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":204 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -9877,7 +10919,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":206 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -9886,7 +10928,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":208 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -9896,7 +10938,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "numpy.pxd":209 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -9908,7 +10950,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":211 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -9919,87 +10961,87 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L4:; - /* "numpy.pxd":213 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":213 * copy_shape = 0 * * 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_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); - if (__pyx_t_1) { + __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } - /* "numpy.pxd":214 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { - /* "numpy.pxd":215 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; } - __pyx_L5:; - /* "numpy.pxd":217 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); - if (__pyx_t_3) { + __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L9_bool_binop_done; + } - /* "numpy.pxd":218 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); - __pyx_t_2 = __pyx_t_1; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (__pyx_t_2) { + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L9_bool_binop_done:; + if (__pyx_t_1) { - /* "numpy.pxd":219 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; } - __pyx_L6:; - /* "numpy.pxd":221 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -10008,7 +11050,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":222 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -10017,17 +11059,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":223 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ - __pyx_t_2 = (__pyx_v_copy_shape != 0); - if (__pyx_t_2) { + __pyx_t_1 = (__pyx_v_copy_shape != 0); + if (__pyx_t_1) { - /* "numpy.pxd":226 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -10036,7 +11078,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":227 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -10045,18 +11087,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":228 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_5 = __pyx_v_ndim; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __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; - /* "numpy.pxd":229 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -10065,7 +11107,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":230 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -10074,11 +11116,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L7; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":232 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -10087,7 +11129,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":233 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -10096,9 +11138,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L7:; + __pyx_L11:; - /* "numpy.pxd":234 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -10107,7 +11149,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":235 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -10116,7 +11158,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":236 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -10125,7 +11167,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - /* "numpy.pxd":239 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -10134,19 +11176,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_f = NULL; - /* "numpy.pxd":240 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __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; + __pyx_t_3 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; - /* "numpy.pxd":244 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -10155,7 +11197,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":246 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -10164,14 +11206,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { - __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); - __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; + goto __pyx_L15_bool_binop_done; } + __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L15_bool_binop_done:; if (__pyx_t_1) { - /* "numpy.pxd":248 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -10183,11 +11227,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L10; + goto __pyx_L14; } /*else*/ { - /* "numpy.pxd":251 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -10200,9 +11244,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L10:; + __pyx_L14:; - /* "numpy.pxd":253 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -10212,68 +11256,69 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { - /* "numpy.pxd":254 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.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_t_5 = __pyx_v_descr->type_num; - __pyx_v_t = __pyx_t_5; + __pyx_t_4 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_4; - /* "numpy.pxd":255 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":255 * if not hasfields: * t = descr.type_num * 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 == '>') != 0); - if (__pyx_t_1) { - __pyx_t_2 = (__pyx_v_little_endian != 0); + __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0); + if (!__pyx_t_2) { + goto __pyx_L20_next_or; } else { - __pyx_t_2 = __pyx_t_1; } + __pyx_t_2 = (__pyx_v_little_endian != 0); if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L19_bool_binop_done; + } + __pyx_L20_next_or:; - /* "numpy.pxd":256 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); - if (__pyx_t_1) { - __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_7 = __pyx_t_3; - } else { - __pyx_t_7 = __pyx_t_1; - } - __pyx_t_1 = __pyx_t_7; + __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0); + if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; + goto __pyx_L19_bool_binop_done; } + __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L19_bool_binop_done:; if (__pyx_t_1) { - /* "numpy.pxd":257 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L12; } - __pyx_L12:; - /* "numpy.pxd":274 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -10282,7 +11327,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ switch (__pyx_v_t) { - /* "numpy.pxd":258 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -10290,10 +11335,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_SHORT: f = "h" */ case NPY_BYTE: - __pyx_v_f = __pyx_k__b; + __pyx_v_f = __pyx_k_b; break; - /* "numpy.pxd":259 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -10301,10 +11346,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_USHORT: f = "H" */ case NPY_UBYTE: - __pyx_v_f = __pyx_k__B; + __pyx_v_f = __pyx_k_B; break; - /* "numpy.pxd":260 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -10312,10 +11357,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_INT: f = "i" */ case NPY_SHORT: - __pyx_v_f = __pyx_k__h; + __pyx_v_f = __pyx_k_h; break; - /* "numpy.pxd":261 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -10323,10 +11368,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_UINT: f = "I" */ case NPY_USHORT: - __pyx_v_f = __pyx_k__H; + __pyx_v_f = __pyx_k_H; break; - /* "numpy.pxd":262 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -10334,10 +11379,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_LONG: f = "l" */ case NPY_INT: - __pyx_v_f = __pyx_k__i; + __pyx_v_f = __pyx_k_i; break; - /* "numpy.pxd":263 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -10345,10 +11390,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_ULONG: f = "L" */ case NPY_UINT: - __pyx_v_f = __pyx_k__I; + __pyx_v_f = __pyx_k_I; break; - /* "numpy.pxd":264 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -10356,10 +11401,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_LONGLONG: f = "q" */ case NPY_LONG: - __pyx_v_f = __pyx_k__l; + __pyx_v_f = __pyx_k_l; break; - /* "numpy.pxd":265 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -10367,10 +11412,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_ULONGLONG: f = "Q" */ case NPY_ULONG: - __pyx_v_f = __pyx_k__L; + __pyx_v_f = __pyx_k_L; break; - /* "numpy.pxd":266 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -10378,10 +11423,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_FLOAT: f = "f" */ case NPY_LONGLONG: - __pyx_v_f = __pyx_k__q; + __pyx_v_f = __pyx_k_q; break; - /* "numpy.pxd":267 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -10389,10 +11434,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_DOUBLE: f = "d" */ case NPY_ULONGLONG: - __pyx_v_f = __pyx_k__Q; + __pyx_v_f = __pyx_k_Q; break; - /* "numpy.pxd":268 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -10400,10 +11445,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_LONGDOUBLE: f = "g" */ case NPY_FLOAT: - __pyx_v_f = __pyx_k__f; + __pyx_v_f = __pyx_k_f; break; - /* "numpy.pxd":269 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -10411,10 +11456,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_CFLOAT: f = "Zf" */ case NPY_DOUBLE: - __pyx_v_f = __pyx_k__d; + __pyx_v_f = __pyx_k_d; break; - /* "numpy.pxd":270 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -10422,10 +11467,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_CDOUBLE: f = "Zd" */ case NPY_LONGDOUBLE: - __pyx_v_f = __pyx_k__g; + __pyx_v_f = __pyx_k_g; break; - /* "numpy.pxd":271 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -10433,10 +11478,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_CLONGDOUBLE: f = "Zg" */ case NPY_CFLOAT: - __pyx_v_f = __pyx_k__Zf; + __pyx_v_f = __pyx_k_Zf; break; - /* "numpy.pxd":272 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -10444,10 +11489,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_OBJECT: f = "O" */ case NPY_CDOUBLE: - __pyx_v_f = __pyx_k__Zd; + __pyx_v_f = __pyx_k_Zd; break; - /* "numpy.pxd":273 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -10455,10 +11500,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * else: */ case NPY_CLONGDOUBLE: - __pyx_v_f = __pyx_k__Zg; + __pyx_v_f = __pyx_k_Zg; break; - /* "numpy.pxd":274 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -10466,37 +11511,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ case NPY_OBJECT: - __pyx_v_f = __pyx_k__O; + __pyx_v_f = __pyx_k_O; break; default: - /* "numpy.pxd":276 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_39), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_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_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __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 = 276; __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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - /* "numpy.pxd":277 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -10505,7 +11550,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":278 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -10514,11 +11559,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":280 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -10527,7 +11571,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":281 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -10536,7 +11580,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":282 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -10545,17 +11589,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_offset = 0; - /* "numpy.pxd":285 - * f = _util_dtypestring(descr, info.format + 1, + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":283 + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< * info.format + _buffer_format_string_len, - * &offset) # <<<<<<<<<<<<<< - * f[0] = c'\0' # Terminate format string - * + * &offset) */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_9; + __pyx_t_7 = __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_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_7; - /* "numpy.pxd":286 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< @@ -10564,13 +11608,21 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_f[0]) = '\x00'; } - __pyx_L11:; + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { @@ -10589,29 +11641,31 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P return __pyx_r; } +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":288 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":289 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -10621,7 +11675,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { - /* "numpy.pxd":290 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -10633,7 +11687,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L3:; - /* "numpy.pxd":291 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -10643,7 +11697,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "numpy.pxd":292 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -10655,10 +11709,19 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L4:; + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":768 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -10675,7 +11738,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":769 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -10689,8 +11752,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":768 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10701,7 +11771,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":771 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -10718,7 +11788,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":772 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -10732,8 +11802,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":771 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10744,7 +11821,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":774 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -10761,7 +11838,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":775 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -10775,8 +11852,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":774 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10787,7 +11871,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":777 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -10804,7 +11888,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":778 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -10818,8 +11902,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":777 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10830,7 +11921,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":780 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -10847,7 +11938,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":781 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -10861,8 +11952,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":780 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10873,7 +11971,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":783 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -10895,20 +11993,17 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_5; + int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - long __pyx_t_11; - char *__pyx_t_12; + long __pyx_t_8; + char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":790 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -10917,7 +12012,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":791 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -10926,18 +12021,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":794 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + if (unlikely(__pyx_v_descr->names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON @@ -10945,33 +12040,31 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_childname); - __pyx_v_childname = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":795 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject*)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; - /* "numpy.pxd":796 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * - * if (end - f) - (new_offset - offset[0]) < 15: + * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { - PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (likely(__pyx_v_fields != Py_None)) { + PyObject* sequence = __pyx_v_fields; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else @@ -10993,78 +12086,47 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif - } else if (1) { + } else { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else - { - Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; + __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; - /* "numpy.pxd":798 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":798 * child, new_offset = fields * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); + if (__pyx_t_6) { - /* "numpy.pxd":799 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":799 * - * if (end - f) - (new_offset - offset[0]) < 15: + * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; } - __pyx_L7:; - /* "numpy.pxd":801 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -11072,50 +12134,51 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_little_endian != 0); + if (!__pyx_t_7) { + goto __pyx_L8_next_or; } else { - __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_8) { + __pyx_t_7 = (__pyx_v_little_endian != 0); + if (!__pyx_t_7) { + } else { + __pyx_t_6 = __pyx_t_7; + goto __pyx_L7_bool_binop_done; + } + __pyx_L8_next_or:; - /* "numpy.pxd":802 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); - if (__pyx_t_7) { - __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_10 = __pyx_t_9; - } else { - __pyx_t_10 = __pyx_t_7; - } - __pyx_t_7 = __pyx_t_10; + __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); + if (__pyx_t_7) { } else { - __pyx_t_7 = __pyx_t_8; + __pyx_t_6 = __pyx_t_7; + goto __pyx_L7_bool_binop_done; } - if (__pyx_t_7) { + __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0); + __pyx_t_6 = __pyx_t_7; + __pyx_L7_bool_binop_done:; + if (__pyx_t_6) { - /* "numpy.pxd":803 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; } - __pyx_L8:; - /* "numpy.pxd":813 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -11123,15 +12186,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_7) break; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_6) break; - /* "numpy.pxd":814 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -11140,7 +12203,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":815 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -11149,413 +12212,410 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":816 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_11 = 0; - (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); + __pyx_t_8 = 0; + (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); } - /* "numpy.pxd":818 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_11 = 0; - (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); + __pyx_t_8 = 0; + (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); - /* "numpy.pxd":820 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); - if (__pyx_t_7) { + __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); + if (__pyx_t_6) { - /* "numpy.pxd":821 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":822 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); - if (__pyx_t_7) { + __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); + if (__pyx_t_6) { - /* "numpy.pxd":823 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L12; } - __pyx_L12:; - /* "numpy.pxd":826 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 98; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":827 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 66; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":828 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 104; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":829 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 72; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":830 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 105; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":831 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 73; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":832 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 108; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":833 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 76; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":834 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 113; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":835 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 81; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":836 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 102; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":837 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 100; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":838 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 103; - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":839 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":840 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":841 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; + goto __pyx_L15; } - /* "numpy.pxd":842 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 79; - goto __pyx_L13; + goto __pyx_L15; } /*else*/ { - /* "numpy.pxd":844 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_39), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L13:; + __pyx_L15:; - /* "numpy.pxd":845 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -11563,25 +12623,33 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":849 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_12; + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; } - __pyx_L11:; + __pyx_L13:; + + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":794 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":850 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -11591,13 +12659,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = __pyx_v_f; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":783 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -11610,7 +12684,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":965 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":966 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -11625,7 +12699,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":967 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":968 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -11636,7 +12710,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "numpy.pxd":968 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":969 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -11648,7 +12722,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":970 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":971 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -11657,7 +12731,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":971 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":972 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -11668,7 +12742,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":972 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":973 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -11677,7 +12751,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":973 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":974 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -11686,10 +12760,19 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":966 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":975 +/* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":976 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -11703,7 +12786,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":976 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":977 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -11713,7 +12796,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { - /* "numpy.pxd":977 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":978 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -11724,11 +12807,10 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; - goto __pyx_L3; } /*else*/ { - /* "numpy.pxd":979 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":980 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -11738,15 +12820,30 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } - __pyx_L3:; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":976 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "View.MemoryView":116 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ + /* Python wrapper */ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -11762,9 +12859,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shape,&__pyx_n_s__itemsize,&__pyx_n_s__format,&__pyx_n_s__mode,&__pyx_n_s__allocate_buffer,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_u__c); + values[3] = ((PyObject *)__pyx_n_s_c); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); @@ -11780,31 +12877,31 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shape)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__itemsize)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__allocate_buffer); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_allocate_buffer); if (value) { values[4] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __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[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -11818,17 +12915,17 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P } } __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_format = values[2]; __pyx_v_mode = values[3]; if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "View.MemoryView":114 + /* "View.MemoryView":117 * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode=u"c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< * * cdef int idx */ @@ -11837,17 +12934,27 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument 'format' must not be None"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_r = __pyx_array_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":116 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -11856,65 +12963,54 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P return __pyx_r; } -/* "View.MemoryView":113 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode=u"c", bint allocate_buffer=True): - * - */ - static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { int __pyx_v_idx; Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_dim; PyObject **__pyx_v_p; - PyObject *__pyx_v_encode = NULL; - PyObject *__pyx_v_dim = NULL; char __pyx_v_order; - PyObject *__pyx_v_decode = NULL; int __pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; - int __pyx_t_5; + int __pyx_t_4; + char *__pyx_t_5; int __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; + PyObject *__pyx_t_10 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); __Pyx_INCREF(__pyx_v_format); - __Pyx_INCREF(__pyx_v_mode); - /* "View.MemoryView":120 + /* "View.MemoryView":123 * cdef PyObject **p * - * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.ndim = len(shape) # <<<<<<<<<<<<<< * self.itemsize = itemsize * */ - if (unlikely(((PyObject *)__pyx_v_shape) == Py_None)) { + if (unlikely(__pyx_v_shape == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->ndim = __pyx_t_1; + __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "View.MemoryView":121 + /* "View.MemoryView":124 * - * self.ndim = len(shape) + * self.ndim = len(shape) * self.itemsize = itemsize # <<<<<<<<<<<<<< * * if not self.ndim: */ __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "View.MemoryView":123 + /* "View.MemoryView":126 * self.itemsize = itemsize * * if not self.ndim: # <<<<<<<<<<<<<< @@ -11924,362 +13020,322 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":124 + /* "View.MemoryView":127 * * if not self.ndim: * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< * - * if self.itemsize <= 0: + * if itemsize <= 0: */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "View.MemoryView":126 + /* "View.MemoryView":129 * raise ValueError("Empty shape tuple for cython.array") * - * if self.itemsize <= 0: # <<<<<<<<<<<<<< + * if itemsize <= 0: # <<<<<<<<<<<<<< * raise ValueError("itemsize <= 0 for cython.array") * */ - __pyx_t_2 = ((__pyx_v_self->itemsize <= 0) != 0); + __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":127 + /* "View.MemoryView":130 * - * if self.itemsize <= 0: + * if itemsize <= 0: * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * - * encode = getattr(format, 'encode', None) + * if isinstance(format, unicode): */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_48), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __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[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L4:; - /* "View.MemoryView":129 + /* "View.MemoryView":132 * raise ValueError("itemsize <= 0 for cython.array") * - * encode = getattr(format, 'encode', None) # <<<<<<<<<<<<<< - * if encode: - * format = encode('ASCII') + * if isinstance(format, unicode): # <<<<<<<<<<<<<< + * format = (format).encode('ASCII') + * self._format = format # keep a reference to the byte string */ - __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_encode = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = PyUnicode_Check(__pyx_v_format); + __pyx_t_4 = (__pyx_t_2 != 0); + if (__pyx_t_4) { - /* "View.MemoryView":130 + /* "View.MemoryView":133 * - * encode = getattr(format, 'encode', None) - * if encode: # <<<<<<<<<<<<<< - * format = encode('ASCII') - * self._format = format - */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encode); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { - - /* "View.MemoryView":131 - * encode = getattr(format, 'encode', None) - * if encode: - * format = encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format + * if isinstance(format, unicode): + * format = (format).encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string * self.format = self._format */ - __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_v_format == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode"); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyUnicode_AsASCIIString(((PyObject*)__pyx_v_format)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_format); - __pyx_v_format = __pyx_t_3; + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); __pyx_t_3 = 0; goto __pyx_L5; } __pyx_L5:; - /* "View.MemoryView":132 - * if encode: - * format = encode('ASCII') - * self._format = format # <<<<<<<<<<<<<< + /* "View.MemoryView":134 + * if isinstance(format, unicode): + * format = (format).encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< * self.format = self._format * */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_format)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_format); - __Pyx_GIVEREF(__pyx_v_format); + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(((PyObject *)__pyx_v_self->_format)); - __pyx_v_self->_format = ((PyObject*)__pyx_v_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":133 - * format = encode('ASCII') - * self._format = format + /* "View.MemoryView":135 + * format = (format).encode('ASCII') + * self._format = format # keep a reference to the byte string * self.format = self._format # <<<<<<<<<<<<<< * - * self._shape = malloc(sizeof(Py_ssize_t)*self.ndim) + * */ - __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->format = __pyx_t_4; + __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_self->_format); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->format = __pyx_t_5; - /* "View.MemoryView":135 - * self.format = self._format + /* "View.MemoryView":138 * - * self._shape = malloc(sizeof(Py_ssize_t)*self.ndim) # <<<<<<<<<<<<<< - * self._strides = malloc(sizeof(Py_ssize_t)*self.ndim) + * + * self._shape = PyMem_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim * */ - __pyx_v_self->_shape = ((Py_ssize_t *)malloc(((sizeof(Py_ssize_t)) * __pyx_v_self->ndim))); + __pyx_v_self->_shape = ((Py_ssize_t *)PyMem_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "View.MemoryView":136 + /* "View.MemoryView":139 * - * self._shape = malloc(sizeof(Py_ssize_t)*self.ndim) - * self._strides = malloc(sizeof(Py_ssize_t)*self.ndim) # <<<<<<<<<<<<<< + * self._shape = PyMem_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< * - * if not self._shape or not self._strides: + * if not self._shape: */ - __pyx_v_self->_strides = ((Py_ssize_t *)malloc(((sizeof(Py_ssize_t)) * __pyx_v_self->ndim))); + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - /* "View.MemoryView":138 - * self._strides = malloc(sizeof(Py_ssize_t)*self.ndim) + /* "View.MemoryView":141 + * self._strides = self._shape + self.ndim * - * if not self._shape or not self._strides: # <<<<<<<<<<<<<< - * free(self._shape) - * free(self._strides) - */ - __pyx_t_2 = ((!(__pyx_v_self->_shape != 0)) != 0); - if (!__pyx_t_2) { - __pyx_t_5 = ((!(__pyx_v_self->_strides != 0)) != 0); - __pyx_t_6 = __pyx_t_5; - } else { - __pyx_t_6 = __pyx_t_2; - } - if (__pyx_t_6) { - - /* "View.MemoryView":139 + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError("unable to allocate shape and strides.") * - * if not self._shape or not self._strides: - * free(self._shape) # <<<<<<<<<<<<<< - * free(self._strides) - * raise MemoryError("unable to allocate shape or strides.") */ - free(__pyx_v_self->_shape); + __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); + if (__pyx_t_4) { - /* "View.MemoryView":140 - * if not self._shape or not self._strides: - * free(self._shape) - * free(self._strides) # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape or strides.") + /* "View.MemoryView":142 * - */ - free(__pyx_v_self->_strides); - - /* "View.MemoryView":141 - * free(self._shape) - * free(self._strides) - * raise MemoryError("unable to allocate shape or strides.") # <<<<<<<<<<<<<< + * if not self._shape: + * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __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[3]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L6:; - - /* "View.MemoryView":144 - * - * - * idx = 0 # <<<<<<<<<<<<<< - * for idx, dim in enumerate(shape): - * if dim <= 0: - */ - __pyx_v_idx = 0; /* "View.MemoryView":145 * - * idx = 0 + * * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ - __pyx_t_7 = 0; - __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + __pyx_t_6 = 0; + __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; for (;;) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_dim); + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_dim = __pyx_t_8; - __pyx_t_8 = 0; - __pyx_v_idx = __pyx_t_7; - __pyx_t_7 = (__pyx_t_7 + 1); + __pyx_v_idx = __pyx_t_6; + __pyx_t_6 = (__pyx_t_6 + 1); /* "View.MemoryView":146 - * idx = 0 + * * for idx, dim in enumerate(shape): * if dim <= 0: # <<<<<<<<<<<<<< * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * + * self._shape[idx] = dim */ - __pyx_t_8 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __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[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_6) { + __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); + if (__pyx_t_4) { /* "View.MemoryView":147 * for idx, dim in enumerate(shape): * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< - * * self._shape[idx] = dim + * */ - __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_dim); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim); - __Pyx_GIVEREF(__pyx_v_dim); - __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_7 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L9; } - __pyx_L9:; - /* "View.MemoryView":149 + /* "View.MemoryView":148 + * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * * self._shape[idx] = dim # <<<<<<<<<<<<<< - * idx += 1 * + * cdef char order */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_t_10; + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - /* "View.MemoryView":150 + /* "View.MemoryView":145 * - * self._shape[idx] = dim - * idx += 1 # <<<<<<<<<<<<<< * - * if mode not in ("fortran", "c"): + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ - __pyx_v_idx = (__pyx_v_idx + 1); } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":152 - * idx += 1 - * - * if mode not in ("fortran", "c"): # <<<<<<<<<<<<<< - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) + /* "View.MemoryView":151 * + * cdef char order + * if mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __Pyx_INCREF(__pyx_v_mode); - __pyx_t_3 = __pyx_v_mode; - __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (((int)__pyx_t_6)) { - __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_5 = ((int)__pyx_t_2); - } else { - __pyx_t_5 = ((int)__pyx_t_6); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { - /* "View.MemoryView":153 - * - * if mode not in ("fortran", "c"): - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":152 * cdef char order + * if mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * elif mode == 'c': */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_order = 'F'; + + /* "View.MemoryView":153 + * if mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * elif mode == 'c': + * order = b'C' + */ + __Pyx_INCREF(__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_fortran; goto __pyx_L10; } - __pyx_L10:; - /* "View.MemoryView":156 - * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = 'F' + /* "View.MemoryView":154 + * order = b'F' + * self.mode = u'fortran' + * elif mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' + */ + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "View.MemoryView":155 + * self.mode = u'fortran' + * elif mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' * else: */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_v_order = 'C'; - /* "View.MemoryView":157 - * cdef char order - * if mode == 'fortran': - * order = 'F' # <<<<<<<<<<<<<< + /* "View.MemoryView":156 + * elif mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< * else: - * order = 'C' + * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) */ - __pyx_v_order = 'F'; - goto __pyx_L11; + __Pyx_INCREF(__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_c; + goto __pyx_L10; } /*else*/ { - /* "View.MemoryView":159 - * order = 'F' + /* "View.MemoryView":158 + * self.mode = u'c' * else: - * order = 'C' # <<<<<<<<<<<<<< + * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< * * self.len = fill_contig_strides_array(self._shape, self._strides, */ - __pyx_v_order = 'C'; + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L10:; - /* "View.MemoryView":161 - * order = 'C' + /* "View.MemoryView":160 + * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) * * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< * itemsize, self.ndim, order) @@ -12287,135 +13343,81 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx */ __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - /* "View.MemoryView":164 + /* "View.MemoryView":163 * itemsize, self.ndim, order) * - * decode = getattr(mode, 'decode', None) # <<<<<<<<<<<<<< - * if decode: - * mode = decode('ASCII') + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * if allocate_buffer: */ - __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_decode = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_self->free_data = __pyx_v_allocate_buffer; - /* "View.MemoryView":165 + /* "View.MemoryView":164 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * if allocate_buffer: * - * decode = getattr(mode, 'decode', None) - * if decode: # <<<<<<<<<<<<<< - * mode = decode('ASCII') - * self.mode = mode */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_6) { - - /* "View.MemoryView":166 - * decode = getattr(mode, 'decode', None) - * if decode: - * mode = decode('ASCII') # <<<<<<<<<<<<<< - * self.mode = mode - * - */ - __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_mode); - __pyx_v_mode = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L12; - } - __pyx_L12:; - - /* "View.MemoryView":167 - * if decode: - * mode = decode('ASCII') - * self.mode = mode # <<<<<<<<<<<<<< - * - * self.free_data = allocate_buffer - */ - if (!(likely(PyUnicode_CheckExact(__pyx_v_mode))||((__pyx_v_mode) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected unicode, got %.200s", Py_TYPE(__pyx_v_mode)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_mode); - __Pyx_GIVEREF(__pyx_v_mode); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(((PyObject *)__pyx_v_self->mode)); - __pyx_v_self->mode = ((PyObject*)__pyx_v_mode); - - /* "View.MemoryView":169 - * self.mode = mode - * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * if allocate_buffer: - */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; - - /* "View.MemoryView":170 - * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * if allocate_buffer: - * self.data = malloc(self.len) - */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_6; + __pyx_v_self->dtype_is_object = __pyx_t_4; - /* "View.MemoryView":171 + /* "View.MemoryView":165 * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' * if allocate_buffer: # <<<<<<<<<<<<<< - * self.data = malloc(self.len) - * if not self.data: + * + * */ - __pyx_t_6 = (__pyx_v_allocate_buffer != 0); - if (__pyx_t_6) { + __pyx_t_4 = (__pyx_v_allocate_buffer != 0); + if (__pyx_t_4) { - /* "View.MemoryView":172 - * self.dtype_is_object = format == b'O' - * if allocate_buffer: + /* "View.MemoryView":168 + * + * * self.data = malloc(self.len) # <<<<<<<<<<<<<< * if not self.data: * raise MemoryError("unable to allocate array data.") */ __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - /* "View.MemoryView":173 - * if allocate_buffer: + /* "View.MemoryView":169 + * * self.data = malloc(self.len) * if not self.data: # <<<<<<<<<<<<<< * raise MemoryError("unable to allocate array data.") * */ - __pyx_t_6 = ((!(__pyx_v_self->data != 0)) != 0); - if (__pyx_t_6) { + __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); + if (__pyx_t_4) { - /* "View.MemoryView":174 + /* "View.MemoryView":170 * self.data = malloc(self.len) * if not self.data: * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< * * if self.dtype_is_object: */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __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[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; - /* "View.MemoryView":176 + /* "View.MemoryView":172 * raise MemoryError("unable to allocate array data.") * * if self.dtype_is_object: # <<<<<<<<<<<<<< * p = self.data * for i in range(self.len / itemsize): */ - __pyx_t_6 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_6) { + __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); + if (__pyx_t_4) { - /* "View.MemoryView":177 + /* "View.MemoryView":173 * * if self.dtype_is_object: * p = self.data # <<<<<<<<<<<<<< @@ -12424,7 +13426,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx */ __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "View.MemoryView":178 + /* "View.MemoryView":174 * if self.dtype_is_object: * p = self.data * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< @@ -12435,27 +13437,27 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize); - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_1; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "View.MemoryView":179 + /* "View.MemoryView":175 * p = self.data * for i in range(self.len / itemsize): * p[i] = Py_None # <<<<<<<<<<<<<< @@ -12464,7 +13466,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx */ (__pyx_v_p[__pyx_v_i]) = Py_None; - /* "View.MemoryView":180 + /* "View.MemoryView":176 * for i in range(self.len / itemsize): * p[i] = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -12473,31 +13475,45 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx */ Py_INCREF(Py_None); } - goto __pyx_L15; + goto __pyx_L13; } - __pyx_L15:; - goto __pyx_L13; + __pyx_L13:; + goto __pyx_L11; } - __pyx_L13:; + __pyx_L11:; + + /* "View.MemoryView":116 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_encode); - __Pyx_XDECREF(__pyx_v_dim); - __Pyx_XDECREF(__pyx_v_decode); __Pyx_XDECREF(__pyx_v_format); - __Pyx_XDECREF(__pyx_v_mode); __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "View.MemoryView":179 + * + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< + * cdef int bufmode = -1 + * if self.mode == u"c": + */ + /* Python wrapper */ static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { @@ -12505,18 +13521,12 @@ static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":183 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == b"c": - */ - static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_bufmode; int __pyx_r; @@ -12537,51 +13547,51 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "View.MemoryView":184 + /* "View.MemoryView":180 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if self.mode == b"c": + * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ __pyx_v_bufmode = -1; - /* "View.MemoryView":185 + /* "View.MemoryView":181 * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 - * if self.mode == b"c": # <<<<<<<<<<<<<< + * if self.mode == u"c": # <<<<<<<<<<<<<< * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == b"fortran": + * elif self.mode == u"fortran": */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":186 + /* "View.MemoryView":182 * cdef int bufmode = -1 - * if self.mode == b"c": + * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == b"fortran": + * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); goto __pyx_L3; } - /* "View.MemoryView":187 - * if self.mode == b"c": + /* "View.MemoryView":183 + * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == b"fortran": # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":188 + /* "View.MemoryView":184 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == b"fortran": + * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") @@ -12591,8 +13601,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a } __pyx_L3:; - /* "View.MemoryView":189 - * elif self.mode == b"fortran": + /* "View.MemoryView":185 + * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): # <<<<<<<<<<<<<< * raise ValueError("Can only create a buffer that is contiguous in memory.") @@ -12601,23 +13611,21 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); if (__pyx_t_1) { - /* "View.MemoryView":190 + /* "View.MemoryView":186 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< * info.buf = self.data * info.len = self.len */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 186; __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[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L4:; - /* "View.MemoryView":191 + /* "View.MemoryView":187 * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data # <<<<<<<<<<<<<< @@ -12627,7 +13635,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __pyx_t_4 = __pyx_v_self->data; __pyx_v_info->buf = __pyx_t_4; - /* "View.MemoryView":192 + /* "View.MemoryView":188 * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data * info.len = self.len # <<<<<<<<<<<<<< @@ -12637,7 +13645,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __pyx_t_5 = __pyx_v_self->len; __pyx_v_info->len = __pyx_t_5; - /* "View.MemoryView":193 + /* "View.MemoryView":189 * info.buf = self.data * info.len = self.len * info.ndim = self.ndim # <<<<<<<<<<<<<< @@ -12647,7 +13655,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __pyx_t_6 = __pyx_v_self->ndim; __pyx_v_info->ndim = __pyx_t_6; - /* "View.MemoryView":194 + /* "View.MemoryView":190 * info.len = self.len * info.ndim = self.ndim * info.shape = self._shape # <<<<<<<<<<<<<< @@ -12657,7 +13665,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __pyx_t_7 = __pyx_v_self->_shape; __pyx_v_info->shape = __pyx_t_7; - /* "View.MemoryView":195 + /* "View.MemoryView":191 * info.ndim = self.ndim * info.shape = self._shape * info.strides = self._strides # <<<<<<<<<<<<<< @@ -12667,7 +13675,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __pyx_t_7 = __pyx_v_self->_strides; __pyx_v_info->strides = __pyx_t_7; - /* "View.MemoryView":196 + /* "View.MemoryView":192 * info.shape = self._shape * info.strides = self._strides * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -12676,7 +13684,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a */ __pyx_v_info->suboffsets = NULL; - /* "View.MemoryView":197 + /* "View.MemoryView":193 * info.strides = self._strides * info.suboffsets = NULL * info.itemsize = self.itemsize # <<<<<<<<<<<<<< @@ -12686,7 +13694,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __pyx_t_5 = __pyx_v_self->itemsize; __pyx_v_info->itemsize = __pyx_t_5; - /* "View.MemoryView":198 + /* "View.MemoryView":194 * info.suboffsets = NULL * info.itemsize = self.itemsize * info.readonly = 0 # <<<<<<<<<<<<<< @@ -12695,7 +13703,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a */ __pyx_v_info->readonly = 0; - /* "View.MemoryView":200 + /* "View.MemoryView":196 * info.readonly = 0 * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -12705,7 +13713,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":201 + /* "View.MemoryView":197 * * if flags & PyBUF_FORMAT: * info.format = self.format # <<<<<<<<<<<<<< @@ -12718,7 +13726,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a } /*else*/ { - /* "View.MemoryView":203 + /* "View.MemoryView":199 * info.format = self.format * else: * info.format = NULL # <<<<<<<<<<<<<< @@ -12729,7 +13737,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a } __pyx_L5:; - /* "View.MemoryView":205 + /* "View.MemoryView":201 * info.format = NULL * * info.obj = self # <<<<<<<<<<<<<< @@ -12742,6 +13750,15 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + /* "View.MemoryView":179 + * + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< + * cdef int bufmode = -1 + * if self.mode == u"c": + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -12763,29 +13780,31 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a return __pyx_r; } +/* "View.MemoryView":205 + * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + */ + /* Python wrapper */ static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_array_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":209 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") - * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - */ - static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":210 + /* "View.MemoryView":206 * * def __dealloc__(array self): * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< @@ -12795,7 +13814,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_ __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":211 + /* "View.MemoryView":207 * def __dealloc__(array self): * if self.callback_free_data != NULL: * self.callback_free_data(self.data) # <<<<<<<<<<<<<< @@ -12806,7 +13825,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_ goto __pyx_L3; } - /* "View.MemoryView":212 + /* "View.MemoryView":208 * if self.callback_free_data != NULL: * self.callback_free_data(self.data) * elif self.free_data: # <<<<<<<<<<<<<< @@ -12816,7 +13835,7 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_ __pyx_t_1 = (__pyx_v_self->free_data != 0); if (__pyx_t_1) { - /* "View.MemoryView":213 + /* "View.MemoryView":209 * self.callback_free_data(self.data) * elif self.free_data: * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -12826,51 +13845,59 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_ __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":215 + /* "View.MemoryView":210 + * elif self.free_data: * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< + * self._strides, self.ndim, False) * free(self.data) - * */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); goto __pyx_L4; } __pyx_L4:; - /* "View.MemoryView":216 + /* "View.MemoryView":212 * refcount_objects_in_slice(self.data, self._shape, * self._strides, self.ndim, False) * free(self.data) # <<<<<<<<<<<<<< + * PyMem_Free(self._shape) * - * free(self._strides) */ free(__pyx_v_self->data); goto __pyx_L3; } __pyx_L3:; - /* "View.MemoryView":218 + /* "View.MemoryView":213 + * self._strides, self.ndim, False) * free(self.data) + * PyMem_Free(self._shape) # <<<<<<<<<<<<<< * - * free(self._strides) # <<<<<<<<<<<<<< - * free(self._shape) - * + * property memview: */ - free(__pyx_v_self->_strides); + PyMem_Free(__pyx_v_self->_shape); - /* "View.MemoryView":219 - * - * free(self._strides) - * free(self._shape) # <<<<<<<<<<<<<< + /* "View.MemoryView":205 + * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") * - * property memview: + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ - free(__pyx_v_self->_shape); + /* function exit code */ __Pyx_RefNannyFinishContext(); } +/* "View.MemoryView":217 + * property memview: + * @cname('get_memview') + * def __get__(self): # <<<<<<<<<<<<<< + * + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + */ + /* Python wrapper */ static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/ static PyObject *get_memview(PyObject *__pyx_v_self) { @@ -12878,18 +13905,12 @@ static PyObject *get_memview(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = get_memview_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":223 - * property memview: - * @cname('get_memview') - * def __get__(self): # <<<<<<<<<<<<<< - * - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - */ - static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { int __pyx_v_flags; PyObject *__pyx_r = NULL; @@ -12902,7 +13923,7 @@ static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_arr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":225 + /* "View.MemoryView":219 * def __get__(self): * * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< @@ -12911,7 +13932,7 @@ static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_arr */ __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - /* "View.MemoryView":226 + /* "View.MemoryView":220 * * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< @@ -12919,11 +13940,11 @@ static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_arr * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); @@ -12934,15 +13955,22 @@ static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_arr __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":217 + * property memview: + * @cname('get_memview') + * def __get__(self): # <<<<<<<<<<<<<< + * + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -12955,6 +13983,14 @@ static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_arr return __pyx_r; } +/* "View.MemoryView":223 + * + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * + */ + /* Python wrapper */ static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { @@ -12962,18 +13998,12 @@ static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); __pyx_r = __pyx_array_MemoryView_5array_6__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":229 - * - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) - * - */ - static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -12984,7 +14014,7 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getattr__", 0); - /* "View.MemoryView":230 + /* "View.MemoryView":224 * * def __getattr__(self, attr): * return getattr(self.memview, attr) # <<<<<<<<<<<<<< @@ -12992,17 +14022,24 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o * def __getitem__(self, item): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":223 + * + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -13014,6 +14051,14 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o return __pyx_r; } +/* "View.MemoryView":226 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * + */ + /* Python wrapper */ static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { @@ -13021,18 +14066,12 @@ static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); __pyx_r = __pyx_array_MemoryView_5array_8__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":232 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * - */ - static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -13043,7 +14082,7 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "View.MemoryView":233 + /* "View.MemoryView":227 * * def __getitem__(self, item): * return self.memview[item] # <<<<<<<<<<<<<< @@ -13051,17 +14090,24 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o * def __setitem__(self, item, value): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":226 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -13073,6 +14119,14 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o return __pyx_r; } +/* "View.MemoryView":229 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * + */ + /* Python wrapper */ static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { @@ -13080,18 +14134,12 @@ static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_ite __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); __pyx_r = __pyx_array_MemoryView_5array_10__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":235 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value - * - */ - static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -13101,18 +14149,27 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "View.MemoryView":236 + /* "View.MemoryView":230 * * def __setitem__(self, item, value): * self.memview[item] = value # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* "View.MemoryView":229 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -13124,7 +14181,7 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_ return __pyx_r; } -/* "View.MemoryView":240 +/* "View.MemoryView":234 * * @cname("__pyx_array_new") * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< @@ -13146,7 +14203,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize int __pyx_clineno = 0; __Pyx_RefNannySetupContext("array_cwrapper", 0); - /* "View.MemoryView":244 + /* "View.MemoryView":238 * cdef array result * * if buf == NULL: # <<<<<<<<<<<<<< @@ -13156,91 +14213,96 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":245 + /* "View.MemoryView":239 * * if buf == NULL: * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_v_shape)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_shape)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_shape)); + __Pyx_INCREF(__pyx_v_shape); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":247 + /* "View.MemoryView":241 * result = array(shape, itemsize, format, mode.decode('ASCII')) * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< * allocate_buffer=False) * result.data = buf */ - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_shape)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_shape)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_shape)); + __Pyx_INCREF(__pyx_v_shape); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); - /* "View.MemoryView":248 + /* "View.MemoryView":242 * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), * allocate_buffer=False) # <<<<<<<<<<<<<< * result.data = buf * */ - __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__allocate_buffer), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "View.MemoryView":241 + * result = array(shape, itemsize, format, mode.decode('ASCII')) + * else: + * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< + * allocate_buffer=False) + * result.data = buf + */ + __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":249 + /* "View.MemoryView":243 * result = array(shape, itemsize, format, mode.decode('ASCII'), * allocate_buffer=False) * result.data = buf # <<<<<<<<<<<<<< @@ -13251,7 +14313,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize } __pyx_L3:; - /* "View.MemoryView":251 + /* "View.MemoryView":245 * result.data = buf * * return result # <<<<<<<<<<<<<< @@ -13263,8 +14325,15 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_r = __pyx_v_result; goto __pyx_L0; - __pyx_r = ((struct __pyx_array_obj *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":234 + * + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< + * char *mode, char *buf): + * cdef array result + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); @@ -13279,6 +14348,14 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize return __pyx_r; } +/* "View.MemoryView":271 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): + */ + /* Python wrapper */ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -13290,7 +14367,7 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name_2,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -13303,11 +14380,11 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name_2)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 277; __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[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -13318,31 +14395,25 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar } 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[3]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_MemviewEnum_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":277 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): - */ - static int __pyx_MemviewEnum_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "View.MemoryView":278 + /* "View.MemoryView":272 * cdef object name * def __init__(self, name): * self.name = name # <<<<<<<<<<<<<< @@ -13355,11 +14426,28 @@ static int __pyx_MemviewEnum_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_ __Pyx_DECREF(__pyx_v_self->name); __pyx_v_self->name = __pyx_v_name; + /* "View.MemoryView":271 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): + */ + + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "View.MemoryView":273 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * + */ + /* Python wrapper */ static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { @@ -13367,24 +14455,18 @@ static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_MemviewEnum_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":279 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - static PyObject *__pyx_MemviewEnum_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); - /* "View.MemoryView":280 + /* "View.MemoryView":274 * self.name = name * def __repr__(self): * return self.name # <<<<<<<<<<<<<< @@ -13396,14 +14478,22 @@ static PyObject *__pyx_MemviewEnum_MemoryView_4Enum_2__repr__(struct __pyx_Memvi __pyx_r = __pyx_v_self->name; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "View.MemoryView":273 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":294 +/* "View.MemoryView":288 * * @cname('__pyx_align_pointer') * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< @@ -13417,7 +14507,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) void *__pyx_r; int __pyx_t_1; - /* "View.MemoryView":296 + /* "View.MemoryView":290 * cdef void *align_pointer(void *memory, size_t alignment) nogil: * "Align pointer memory on a given boundary" * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< @@ -13426,7 +14516,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) */ __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); - /* "View.MemoryView":300 + /* "View.MemoryView":294 * * with cython.cdivision(True): * offset = aligned_p % alignment # <<<<<<<<<<<<<< @@ -13435,7 +14525,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) */ __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); - /* "View.MemoryView":302 + /* "View.MemoryView":296 * offset = aligned_p % alignment * * if offset > 0: # <<<<<<<<<<<<<< @@ -13445,7 +14535,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) __pyx_t_1 = ((__pyx_v_offset > 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":303 + /* "View.MemoryView":297 * * if offset > 0: * aligned_p += alignment - offset # <<<<<<<<<<<<<< @@ -13457,7 +14547,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) } __pyx_L3:; - /* "View.MemoryView":305 + /* "View.MemoryView":299 * aligned_p += alignment - offset * * return aligned_p # <<<<<<<<<<<<<< @@ -13467,11 +14557,27 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) __pyx_r = ((void *)__pyx_v_aligned_p); goto __pyx_L0; - __pyx_r = 0; + /* "View.MemoryView":288 + * + * @cname('__pyx_align_pointer') + * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< + * "Align pointer memory on a given boundary" + * cdef Py_intptr_t aligned_p = memory + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } +/* "View.MemoryView":317 + * cdef __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags + */ + /* Python wrapper */ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -13485,7 +14591,7 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s__flags,&__pyx_n_s__dtype_is_object,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -13500,21 +14606,21 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype_is_object); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dtype_is_object); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 323; __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[3]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -13526,30 +14632,24 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar } } __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - - /* "View.MemoryView":323 - * cdef __Pyx_TypeInfo *typeinfo - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags - */ __pyx_v_dtype_is_object = ((int)0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_memoryview_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -13568,7 +14668,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "View.MemoryView":324 + /* "View.MemoryView":318 * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): * self.obj = obj # <<<<<<<<<<<<<< @@ -13581,7 +14681,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor __Pyx_DECREF(__pyx_v_self->obj); __pyx_v_self->obj = __pyx_v_obj; - /* "View.MemoryView":325 + /* "View.MemoryView":319 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): * self.obj = obj * self.flags = flags # <<<<<<<<<<<<<< @@ -13590,42 +14690,46 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor */ __pyx_v_self->flags = __pyx_v_flags; - /* "View.MemoryView":326 + /* "View.MemoryView":320 * self.obj = obj * self.flags = flags * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: */ - __pyx_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type))); - if (!(__pyx_t_1 != 0)) { - __pyx_t_2 = (__pyx_v_obj != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type))); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { } else { - __pyx_t_3 = (__pyx_t_1 != 0); + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; } - if (__pyx_t_3) { + __pyx_t_3 = (__pyx_v_obj != Py_None); + __pyx_t_2 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":327 + /* "View.MemoryView":321 * self.flags = flags * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None */ - __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":328 + /* "View.MemoryView":322 * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: # <<<<<<<<<<<<<< * (<__pyx_buffer *> &self.view).obj = Py_None * Py_INCREF(Py_None) */ - __pyx_t_3 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); - if (__pyx_t_3) { + __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":329 + /* "View.MemoryView":323 * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< @@ -13634,7 +14738,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor */ ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "View.MemoryView":330 + /* "View.MemoryView":324 * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -13642,14 +14746,14 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor * self.lock = PyThread_allocate_lock() */ Py_INCREF(Py_None); - goto __pyx_L4; + goto __pyx_L6; } - __pyx_L4:; + __pyx_L6:; goto __pyx_L3; } __pyx_L3:; - /* "View.MemoryView":332 + /* "View.MemoryView":326 * Py_INCREF(Py_None) * * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< @@ -13658,57 +14762,55 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor */ __pyx_v_self->lock = PyThread_allocate_lock(); - /* "View.MemoryView":333 + /* "View.MemoryView":327 * * self.lock = PyThread_allocate_lock() * if self.lock == NULL: # <<<<<<<<<<<<<< * raise MemoryError * */ - __pyx_t_3 = ((__pyx_v_self->lock == NULL) != 0); - if (__pyx_t_3) { + __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":334 + /* "View.MemoryView":328 * self.lock = PyThread_allocate_lock() * if self.lock == NULL: * raise MemoryError # <<<<<<<<<<<<<< * * if flags & PyBUF_FORMAT: */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L5:; - /* "View.MemoryView":336 + /* "View.MemoryView":330 * raise MemoryError * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< * self.dtype_is_object = self.view.format == b'O' * else: */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_3) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":337 + /* "View.MemoryView":331 * * if flags & PyBUF_FORMAT: * self.dtype_is_object = self.view.format == b'O' # <<<<<<<<<<<<<< * else: * self.dtype_is_object = dtype_is_object */ - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_3; - goto __pyx_L6; + __pyx_v_self->dtype_is_object = __pyx_t_1; + goto __pyx_L8; } /*else*/ { - /* "View.MemoryView":339 + /* "View.MemoryView":333 * self.dtype_is_object = self.view.format == b'O' * else: * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< @@ -13717,9 +14819,9 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor */ __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; } - __pyx_L6:; + __pyx_L8:; - /* "View.MemoryView":341 + /* "View.MemoryView":335 * self.dtype_is_object = dtype_is_object * * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< @@ -13728,7 +14830,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor */ __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); - /* "View.MemoryView":343 + /* "View.MemoryView":337 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) * self.typeinfo = NULL # <<<<<<<<<<<<<< @@ -13737,6 +14839,15 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor */ __pyx_v_self->typeinfo = NULL; + /* "View.MemoryView":317 + * cdef __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -13749,30 +14860,32 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor return __pyx_r; } +/* "View.MemoryView":339 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + */ + /* Python wrapper */ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":345 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - */ - static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":346 + /* "View.MemoryView":340 * * def __dealloc__(memoryview self): * if self.obj is not None: # <<<<<<<<<<<<<< @@ -13783,7 +14896,7 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":347 + /* "View.MemoryView":341 * def __dealloc__(memoryview self): * if self.obj is not None: * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< @@ -13795,7 +14908,7 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m } __pyx_L3:; - /* "View.MemoryView":349 + /* "View.MemoryView":343 * __Pyx_ReleaseBuffer(&self.view) * * if self.lock != NULL: # <<<<<<<<<<<<<< @@ -13805,7 +14918,7 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); if (__pyx_t_2) { - /* "View.MemoryView":350 + /* "View.MemoryView":344 * * if self.lock != NULL: * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< @@ -13817,10 +14930,19 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m } __pyx_L4:; + /* "View.MemoryView":339 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":352 +/* "View.MemoryView":346 * PyThread_free_lock(self.lock) * * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< @@ -13846,7 +14968,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_item_pointer", 0); - /* "View.MemoryView":354 + /* "View.MemoryView":348 * cdef char *get_item_pointer(memoryview self, object index) except NULL: * cdef Py_ssize_t dim * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< @@ -13855,7 +14977,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py */ __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - /* "View.MemoryView":356 + /* "View.MemoryView":350 * cdef char *itemp = self.view.buf * * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< @@ -13863,60 +14985,70 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py * */ __pyx_t_1 = 0; - if (PyList_CheckExact(__pyx_v_index) || PyTuple_CheckExact(__pyx_v_index)) { + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } for (;;) { - if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } } else { __pyx_t_5 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_5)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_5); } - __Pyx_XDECREF(__pyx_v_idx); - __pyx_v_idx = __pyx_t_5; + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); __pyx_t_5 = 0; __pyx_v_dim = __pyx_t_1; __pyx_t_1 = (__pyx_t_1 + 1); - /* "View.MemoryView":357 + /* "View.MemoryView":351 * * for dim, idx in enumerate(index): * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< * * return itemp */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":350 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":359 + /* "View.MemoryView":353 * itemp = pybuffer_index(&self.view, itemp, idx, dim) * * return itemp # <<<<<<<<<<<<<< @@ -13926,8 +15058,15 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py __pyx_r = __pyx_v_itemp; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":346 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); @@ -13939,6 +15078,14 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py return __pyx_r; } +/* "View.MemoryView":356 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self + */ + /* Python wrapper */ static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { @@ -13946,18 +15093,12 @@ static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":362 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { PyObject *__pyx_v_have_slices = NULL; PyObject *__pyx_v_indices = NULL; @@ -13969,15 +15110,13 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *(*__pyx_t_7)(PyObject *); - char *__pyx_t_8; + char *__pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "View.MemoryView":363 + /* "View.MemoryView":357 * * def __getitem__(memoryview self, object index): * if index is Ellipsis: # <<<<<<<<<<<<<< @@ -13988,7 +15127,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":364 + /* "View.MemoryView":358 * def __getitem__(memoryview self, object index): * if index is Ellipsis: * return self # <<<<<<<<<<<<<< @@ -13999,20 +15138,18 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "View.MemoryView":366 + /* "View.MemoryView":360 * return self * * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * * cdef char *itemp */ - __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (likely(__pyx_t_3 != Py_None)) { PyObject* sequence = __pyx_t_3; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); @@ -14022,7 +15159,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); @@ -14030,52 +15167,31 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else if (1) { - __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else - { - Py_ssize_t index = -1; - __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = NULL; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L5_unpacking_done; - __pyx_L4_unpacking_failed:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L5_unpacking_done:; + } else { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_have_slices = __pyx_t_4; __pyx_t_4 = 0; __pyx_v_indices = __pyx_t_5; __pyx_t_5 = 0; - /* "View.MemoryView":369 + /* "View.MemoryView":363 * * cdef char *itemp * if have_slices: # <<<<<<<<<<<<<< * return memview_slice(self, indices) * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "View.MemoryView":370 + /* "View.MemoryView":364 * cdef char *itemp * if have_slices: * return memview_slice(self, indices) # <<<<<<<<<<<<<< @@ -14083,26 +15199,25 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ * itemp = self.get_item_pointer(indices) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - goto __pyx_L6; } /*else*/ { - /* "View.MemoryView":372 + /* "View.MemoryView":366 * return memview_slice(self, indices) * else: * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< * return self.convert_item_to_object(itemp) * */ - __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_itemp = __pyx_t_8; + __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_itemp = __pyx_t_6; - /* "View.MemoryView":373 + /* "View.MemoryView":367 * else: * itemp = self.get_item_pointer(indices) * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< @@ -14110,21 +15225,26 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ * def __setitem__(memoryview self, object index, object value): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; } - __pyx_L6:; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":356 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -14135,6 +15255,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ return __pyx_r; } +/* "View.MemoryView":369 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * have_slices, index = _unellipsify(index, self.view.ndim) + * + */ + /* Python wrapper */ static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { @@ -14142,18 +15270,12 @@ static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":375 - * return self.convert_item_to_object(itemp) - * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * have_slices, index = _unellipsify(index, self.view.ndim) - * - */ - static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { PyObject *__pyx_v_have_slices = NULL; PyObject *__pyx_v_obj = NULL; @@ -14162,25 +15284,23 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); __Pyx_INCREF(__pyx_v_index); - /* "View.MemoryView":376 + /* "View.MemoryView":370 * * def __setitem__(memoryview self, object index, object value): * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * * if have_slices: */ - __pyx_t_1 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (likely(__pyx_t_1 != Py_None)) { PyObject* sequence = __pyx_t_1; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); @@ -14190,7 +15310,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); @@ -14198,131 +15318,117 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me __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[3]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else if (1) { - __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else - { - Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L4_unpacking_done:; + } else { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_have_slices = __pyx_t_2; __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_index); - __pyx_v_index = __pyx_t_3; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":378 + /* "View.MemoryView":372 * have_slices, index = _unellipsify(index, self.view.ndim) * * if have_slices: # <<<<<<<<<<<<<< * obj = self.is_slice(value) * if obj: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { - /* "View.MemoryView":379 + /* "View.MemoryView":373 * * if have_slices: * obj = self.is_slice(value) # <<<<<<<<<<<<<< * if obj: * self.setitem_slice_assignment(self[index], obj) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_obj = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":380 + /* "View.MemoryView":374 * if have_slices: * obj = self.is_slice(value) * if obj: # <<<<<<<<<<<<<< * self.setitem_slice_assignment(self[index], obj) * else: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { - /* "View.MemoryView":381 + /* "View.MemoryView":375 * obj = self.is_slice(value) * if obj: * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< * else: * self.setitem_slice_assign_scalar(self[index], value) */ - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "View.MemoryView":383 + /* "View.MemoryView":377 * self.setitem_slice_assignment(self[index], obj) * else: * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< * else: * self.setitem_indexed(index, value) */ - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (!__pyx_t_3) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 377; __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_1); __pyx_t_1 = 0; } - __pyx_L6:; - goto __pyx_L5; + __pyx_L4:; + goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":385 + /* "View.MemoryView":379 * self.setitem_slice_assign_scalar(self[index], value) * else: * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< * * cdef is_slice(self, obj): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __pyx_L5:; + __pyx_L3:; + + /* "View.MemoryView":369 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * have_slices, index = _unellipsify(index, self.view.ndim) + * + */ + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -14333,7 +15439,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me return __pyx_r; } -/* "View.MemoryView":387 +/* "View.MemoryView":381 * self.setitem_indexed(index, value) * * cdef is_slice(self, obj): # <<<<<<<<<<<<<< @@ -14359,7 +15465,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_RefNannySetupContext("is_slice", 0); __Pyx_INCREF(__pyx_v_obj); - /* "View.MemoryView":388 + /* "View.MemoryView":382 * * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< @@ -14370,7 +15476,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":389 + /* "View.MemoryView":383 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< @@ -14384,26 +15490,34 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { - /* "View.MemoryView":390 + /* "View.MemoryView":384 * if not isinstance(obj, memoryview): * try: * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< * self.dtype_is_object) * except TypeError: */ - __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_6); - /* "View.MemoryView":391 + /* "View.MemoryView":385 * try: * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) # <<<<<<<<<<<<<< * except TypeError: * return None */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + + /* "View.MemoryView":384 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: + */ + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_obj); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); @@ -14414,11 +15528,10 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_GIVEREF(__pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_v_obj); - __pyx_v_obj = __pyx_t_7; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); __pyx_t_7 = 0; } __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -14430,7 +15543,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":392 + /* "View.MemoryView":386 * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) * except TypeError: # <<<<<<<<<<<<<< @@ -14440,12 +15553,12 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_TypeError); if (__pyx_t_9) { __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_6); - /* "View.MemoryView":393 + /* "View.MemoryView":387 * self.dtype_is_object) * except TypeError: * return None # <<<<<<<<<<<<<< @@ -14459,11 +15572,8 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L7_except_return; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L5_exception_handled; } + goto __pyx_L6_except_error; __pyx_L6_except_error:; __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); @@ -14476,18 +15586,13 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L0; - __pyx_L5_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); __pyx_L11_try_end:; } goto __pyx_L3; } __pyx_L3:; - /* "View.MemoryView":395 + /* "View.MemoryView":389 * return None * * return obj # <<<<<<<<<<<<<< @@ -14499,8 +15604,15 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_r = __pyx_v_obj; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":381 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); @@ -14514,7 +15626,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ return __pyx_r; } -/* "View.MemoryView":397 +/* "View.MemoryView":391 * return obj * * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< @@ -14536,41 +15648,58 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - /* "View.MemoryView":401 + /* "View.MemoryView":395 * cdef __Pyx_memviewslice src_slice * * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< * get_slice_from_memview(dst, &dst_slice)[0], * src.ndim, dst.ndim, self.dtype_is_object) */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":402 + /* "View.MemoryView":396 * * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< * src.ndim, dst.ndim, self.dtype_is_object) * */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":403 + /* "View.MemoryView":397 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], * get_slice_from_memview(dst, &dst_slice)[0], * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 397; __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[3]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 397; __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[3]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /* "View.MemoryView":395 + * cdef __Pyx_memviewslice src_slice + * + * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< + * get_slice_from_memview(dst, &dst_slice)[0], + * src.ndim, dst.ndim, self.dtype_is_object) + */ + __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "View.MemoryView":391 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -14583,7 +15712,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi return __pyx_r; } -/* "View.MemoryView":405 +/* "View.MemoryView":399 * src.ndim, dst.ndim, self.dtype_is_object) * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< @@ -14595,23 +15724,27 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor int __pyx_v_array[128]; void *__pyx_v_tmp; void *__pyx_v_item; - __Pyx_memviewslice __pyx_v_tmp_slice; __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_3; + int __pyx_t_4; + char const *__pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - /* "View.MemoryView":407 + /* "View.MemoryView":401 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): * cdef int array[128] * cdef void *tmp = NULL # <<<<<<<<<<<<<< @@ -14620,37 +15753,37 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_tmp = NULL; - /* "View.MemoryView":411 - * - * cdef __Pyx_memviewslice tmp_slice, *dst_slice + /* "View.MemoryView":406 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< * * if self.view.itemsize > sizeof(array): */ __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); - /* "View.MemoryView":413 + /* "View.MemoryView":408 * dst_slice = get_slice_from_memview(dst, &tmp_slice) * * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = malloc(self.view.itemsize) + * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: */ __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); if (__pyx_t_1) { - /* "View.MemoryView":414 + /* "View.MemoryView":409 * * if self.view.itemsize > sizeof(array): - * tmp = malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< * if tmp == NULL: * raise MemoryError */ - __pyx_v_tmp = malloc(__pyx_v_self->view.itemsize); + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - /* "View.MemoryView":415 + /* "View.MemoryView":410 * if self.view.itemsize > sizeof(array): - * tmp = malloc(self.view.itemsize) + * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: # <<<<<<<<<<<<<< * raise MemoryError * item = tmp @@ -14658,19 +15791,17 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":416 - * tmp = malloc(self.view.itemsize) + /* "View.MemoryView":411 + * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: * raise MemoryError # <<<<<<<<<<<<<< * item = tmp * else: */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L4:; - /* "View.MemoryView":417 + /* "View.MemoryView":412 * if tmp == NULL: * raise MemoryError * item = tmp # <<<<<<<<<<<<<< @@ -14682,176 +15813,153 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor } /*else*/ { - /* "View.MemoryView":419 + /* "View.MemoryView":414 * item = tmp * else: * item = array # <<<<<<<<<<<<<< * - * if self.dtype_is_object: + * try: */ __pyx_v_item = ((void *)__pyx_v_array); } __pyx_L3:; - /* "View.MemoryView":421 + /* "View.MemoryView":416 * item = array * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value */ - __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_1) { + /*try:*/ { - /* "View.MemoryView":422 + /* "View.MemoryView":417 * - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * try: + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - goto __pyx_L5; - } - /*else*/ { + __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); + if (__pyx_t_1) { - /* "View.MemoryView":424 - * ( item)[0] = value - * else: - * try: # <<<<<<<<<<<<<< + /* "View.MemoryView":418 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: * self.assign_item_from_object( item, value) - * except: */ - { - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + goto __pyx_L8; + } + /*else*/ { - /* "View.MemoryView":425 - * else: - * try: + /* "View.MemoryView":420 + * ( item)[0] = value + * else: * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< - * except: - * free(tmp) - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L6_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L13_try_end; - __pyx_L6_error:; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "View.MemoryView":426 - * try: - * self.assign_item_from_object( item, value) - * except: # <<<<<<<<<<<<<< - * free(tmp) - * raise - */ - /*except:*/ { - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "View.MemoryView":427 - * self.assign_item_from_object( item, value) - * except: - * free(tmp) # <<<<<<<<<<<<<< - * raise - * - */ - free(__pyx_v_tmp); - - /* "View.MemoryView":428 - * except: - * free(tmp) - * raise # <<<<<<<<<<<<<< * * */ - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7); - __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L7_exception_handled; - } - __pyx_L8_except_error:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L7_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - __pyx_L13_try_end:; + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - } - __pyx_L5:; + __pyx_L8:; - /* "View.MemoryView":432 + /* "View.MemoryView":424 * * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0); - if (__pyx_t_1) { + __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":433 + /* "View.MemoryView":425 * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) */ - __pyx_t_7 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L16; + __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "View.MemoryView":426 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: + */ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } - __pyx_L16:; - /* "View.MemoryView":435 - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) # <<<<<<<<<<<<<< - * free(tmp) + /* "View.MemoryView":429 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< * + * cdef setitem_indexed(self, index, value): */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + /*exception exit:*/{ + __pyx_L6_error:; + __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); + } + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8); + __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; + __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5; + goto __pyx_L1_error; + } + __pyx_L7:; + } - /* "View.MemoryView":436 - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) - * free(tmp) # <<<<<<<<<<<<<< + /* "View.MemoryView":399 + * src.ndim, dst.ndim, self.dtype_is_object) * - * cdef setitem_indexed(self, index, value): + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ - free(__pyx_v_tmp); + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -14860,8 +15968,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor return __pyx_r; } -/* "View.MemoryView":438 - * free(tmp) +/* "View.MemoryView":431 + * PyMem_Free(tmp) * * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< * cdef char *itemp = self.get_item_pointer(index) @@ -14879,27 +15987,36 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_indexed", 0); - /* "View.MemoryView":439 + /* "View.MemoryView":432 * * cdef setitem_indexed(self, index, value): * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< * self.assign_item_from_object(itemp, value) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_itemp = __pyx_t_1; - /* "View.MemoryView":440 + /* "View.MemoryView":433 * cdef setitem_indexed(self, index, value): * cdef char *itemp = self.get_item_pointer(index) * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< * * cdef convert_item_to_object(self, char *itemp): */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "View.MemoryView":431 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -14912,7 +16029,7 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ return __pyx_r; } -/* "View.MemoryView":442 +/* "View.MemoryView":435 * self.assign_item_from_object(itemp, value) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -14932,40 +16049,42 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - size_t __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "View.MemoryView":445 + /* "View.MemoryView":438 * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" * import struct # <<<<<<<<<<<<<< * cdef bytes bytesitem * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":448 + /* "View.MemoryView":441 * cdef bytes bytesitem * * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< * try: * result = struct.unpack(self.view.format, bytesitem) */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":449 + /* "View.MemoryView":442 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< @@ -14979,46 +16098,61 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __Pyx_XGOTREF(__pyx_t_4); /*try:*/ { - /* "View.MemoryView":450 + /* "View.MemoryView":443 * bytesitem = itemp[:self.view.itemsize] * try: * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< * except struct.error: * raise ValueError("Unable to convert item to object") */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(((PyObject *)__pyx_v_bytesitem)); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_bytesitem)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_bytesitem)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_v_result = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_9); + if (__pyx_t_7) { + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL; + } + PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_bytesitem); + PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); + __Pyx_GIVEREF(__pyx_v_bytesitem); + __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; } /*else:*/ { - /* "View.MemoryView":454 + /* "View.MemoryView":447 * raise ValueError("Unable to convert item to object") * else: * if len(self.view.format) == 1: # <<<<<<<<<<<<<< * return result[0] * return result */ - __pyx_t_7 = strlen(__pyx_v_self->view.format); - __pyx_t_8 = ((__pyx_t_7 == 1) != 0); - if (__pyx_t_8) { + __pyx_t_10 = strlen(__pyx_v_self->view.format); + __pyx_t_11 = ((__pyx_t_10 == 1) != 0); + if (__pyx_t_11) { - /* "View.MemoryView":455 + /* "View.MemoryView":448 * else: * if len(self.view.format) == 1: * return result[0] # <<<<<<<<<<<<<< @@ -15026,16 +16160,14 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_5) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}; + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L6_except_return; - goto __pyx_L11; } - __pyx_L11:; - /* "View.MemoryView":456 + /* "View.MemoryView":449 * if len(self.view.format) == 1: * return result[0] * return result # <<<<<<<<<<<<<< @@ -15047,50 +16179,45 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __pyx_r = __pyx_v_result; goto __pyx_L6_except_return; } - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L10_try_end; __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":451 + /* "View.MemoryView":444 * try: * result = struct.unpack(self.view.format, bytesitem) * except struct.error: # <<<<<<<<<<<<<< * raise ValueError("Unable to convert item to object") * else: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_9) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = PyErr_ExceptionMatches(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_12) { __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_9); - /* "View.MemoryView":452 + /* "View.MemoryView":445 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< * else: * if len(self.view.format) == 1: */ - __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L4_exception_handled; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} } + goto __pyx_L5_except_error; __pyx_L5_except_error:; __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); @@ -15103,21 +16230,23 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); goto __pyx_L0; - __pyx_L4_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - __pyx_L10_try_end:; } - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); + /* "View.MemoryView":435 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -15129,7 +16258,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview return __pyx_r; } -/* "View.MemoryView":458 +/* "View.MemoryView":451 * return result * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -15152,28 +16281,29 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie PyObject *__pyx_t_6 = NULL; Py_ssize_t __pyx_t_7; PyObject *__pyx_t_8 = NULL; - char *__pyx_t_9; + PyObject *__pyx_t_9 = NULL; char *__pyx_t_10; char *__pyx_t_11; char *__pyx_t_12; + char *__pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":461 + /* "View.MemoryView":454 * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" * import struct # <<<<<<<<<<<<<< * cdef char c * cdef bytes bytesvalue */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":466 + /* "View.MemoryView":459 * cdef Py_ssize_t i * * if isinstance(value, tuple): # <<<<<<<<<<<<<< @@ -15184,69 +16314,84 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "View.MemoryView":467 + /* "View.MemoryView":460 * * if isinstance(value, tuple): * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< * else: * bytesvalue = struct.pack(self.view.format, value) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 460; __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[3]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":469 + /* "View.MemoryView":462 * bytesvalue = struct.pack(self.view.format, *value) * else: * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< * * for i, c in enumerate(bytesvalue): */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_5 = NULL; + __pyx_t_7 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; + } + } + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_5) { + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; + } + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; } __pyx_L3:; - /* "View.MemoryView":471 + /* "View.MemoryView":464 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< @@ -15254,19 +16399,19 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie * */ __pyx_t_7 = 0; - if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) { + if (unlikely(__pyx_v_bytesvalue == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue)); - __pyx_t_8 = __pyx_v_bytesvalue; - __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); - __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); - for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { - __pyx_t_9 = __pyx_t_12; - __pyx_v_c = (__pyx_t_9[0]); + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_9 = __pyx_v_bytesvalue; + __pyx_t_11 = PyBytes_AS_STRING(__pyx_t_9); + __pyx_t_12 = (__pyx_t_11 + PyBytes_GET_SIZE(__pyx_t_9)); + for (__pyx_t_13 = __pyx_t_11; __pyx_t_13 < __pyx_t_12; __pyx_t_13++) { + __pyx_t_10 = __pyx_t_13; + __pyx_v_c = (__pyx_t_10[0]); - /* "View.MemoryView":472 + /* "View.MemoryView":465 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< @@ -15275,7 +16420,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ __pyx_v_i = __pyx_t_7; - /* "View.MemoryView":471 + /* "View.MemoryView":464 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< @@ -15284,7 +16429,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ __pyx_t_7 = (__pyx_t_7 + 1); - /* "View.MemoryView":472 + /* "View.MemoryView":465 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< @@ -15293,8 +16438,17 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; } - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "View.MemoryView":451 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -15302,7 +16456,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(((PyObject *)__pyx_t_8)); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -15313,6 +16468,14 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie return __pyx_r; } +/* "View.MemoryView":468 + * + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< + * if flags & PyBUF_STRIDES: + * info.shape = self.view.shape + */ + /* Python wrapper */ static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { @@ -15320,18 +16483,12 @@ static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_b __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":475 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_STRIDES: - * info.shape = self.view.shape - */ - static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -15347,7 +16504,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "View.MemoryView":476 + /* "View.MemoryView":469 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< @@ -15357,7 +16514,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); if (__pyx_t_1) { - /* "View.MemoryView":477 + /* "View.MemoryView":470 * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_STRIDES: * info.shape = self.view.shape # <<<<<<<<<<<<<< @@ -15370,7 +16527,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } /*else*/ { - /* "View.MemoryView":479 + /* "View.MemoryView":472 * info.shape = self.view.shape * else: * info.shape = NULL # <<<<<<<<<<<<<< @@ -15381,7 +16538,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } __pyx_L3:; - /* "View.MemoryView":481 + /* "View.MemoryView":474 * info.shape = NULL * * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< @@ -15391,7 +16548,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); if (__pyx_t_1) { - /* "View.MemoryView":482 + /* "View.MemoryView":475 * * if flags & PyBUF_STRIDES: * info.strides = self.view.strides # <<<<<<<<<<<<<< @@ -15404,7 +16561,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } /*else*/ { - /* "View.MemoryView":484 + /* "View.MemoryView":477 * info.strides = self.view.strides * else: * info.strides = NULL # <<<<<<<<<<<<<< @@ -15415,7 +16572,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } __pyx_L4:; - /* "View.MemoryView":486 + /* "View.MemoryView":479 * info.strides = NULL * * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< @@ -15425,7 +16582,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":487 + /* "View.MemoryView":480 * * if flags & PyBUF_INDIRECT: * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< @@ -15438,7 +16595,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } /*else*/ { - /* "View.MemoryView":489 + /* "View.MemoryView":482 * info.suboffsets = self.view.suboffsets * else: * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -15449,7 +16606,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } __pyx_L5:; - /* "View.MemoryView":491 + /* "View.MemoryView":484 * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -15459,7 +16616,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":492 + /* "View.MemoryView":485 * * if flags & PyBUF_FORMAT: * info.format = self.view.format # <<<<<<<<<<<<<< @@ -15472,7 +16629,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } /*else*/ { - /* "View.MemoryView":494 + /* "View.MemoryView":487 * info.format = self.view.format * else: * info.format = NULL # <<<<<<<<<<<<<< @@ -15483,7 +16640,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } __pyx_L6:; - /* "View.MemoryView":496 + /* "View.MemoryView":489 * info.format = NULL * * info.buf = self.view.buf # <<<<<<<<<<<<<< @@ -15493,7 +16650,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_4 = __pyx_v_self->view.buf; __pyx_v_info->buf = __pyx_t_4; - /* "View.MemoryView":497 + /* "View.MemoryView":490 * * info.buf = self.view.buf * info.ndim = self.view.ndim # <<<<<<<<<<<<<< @@ -15503,7 +16660,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_5 = __pyx_v_self->view.ndim; __pyx_v_info->ndim = __pyx_t_5; - /* "View.MemoryView":498 + /* "View.MemoryView":491 * info.buf = self.view.buf * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< @@ -15513,7 +16670,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_6 = __pyx_v_self->view.itemsize; __pyx_v_info->itemsize = __pyx_t_6; - /* "View.MemoryView":499 + /* "View.MemoryView":492 * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize * info.len = self.view.len # <<<<<<<<<<<<<< @@ -15523,7 +16680,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_6 = __pyx_v_self->view.len; __pyx_v_info->len = __pyx_t_6; - /* "View.MemoryView":500 + /* "View.MemoryView":493 * info.itemsize = self.view.itemsize * info.len = self.view.len * info.readonly = 0 # <<<<<<<<<<<<<< @@ -15532,7 +16689,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str */ __pyx_v_info->readonly = 0; - /* "View.MemoryView":501 + /* "View.MemoryView":494 * info.len = self.view.len * info.readonly = 0 * info.obj = self # <<<<<<<<<<<<<< @@ -15545,6 +16702,15 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + /* "View.MemoryView":468 + * + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< + * if flags & PyBUF_STRIDES: + * info.shape = self.view.shape + */ + + /* function exit code */ __pyx_r = 0; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); @@ -15554,6 +16720,14 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str return __pyx_r; } +/* "View.MemoryView":501 + * property T: + * @cname('__pyx_memoryview_transpose') + * def __get__(self): # <<<<<<<<<<<<<< + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self) { @@ -15561,18 +16735,12 @@ static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":508 - * property T: - * @cname('__pyx_memoryview_transpose') - * def __get__(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - */ - static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; PyObject *__pyx_r = NULL; @@ -15584,29 +16752,29 @@ static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":509 + /* "View.MemoryView":502 * @cname('__pyx_memoryview_transpose') * def __get__(self): * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< * transpose_memslice(&result.from_slice) * return result */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":510 + /* "View.MemoryView":503 * def __get__(self): * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":511 + /* "View.MemoryView":504 * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) * return result # <<<<<<<<<<<<<< @@ -15618,8 +16786,15 @@ static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(s __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":501 + * property T: + * @cname('__pyx_memoryview_transpose') + * def __get__(self): # <<<<<<<<<<<<<< + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -15631,6 +16806,14 @@ static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(s return __pyx_r; } +/* "View.MemoryView":508 + * property base: + * @cname('__pyx_memoryview__get__base') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.obj + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self) { @@ -15638,24 +16821,18 @@ static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":515 - * property base: - * @cname('__pyx_memoryview__get__base') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.obj - * - */ - static PyObject *__pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":516 + /* "View.MemoryView":509 * @cname('__pyx_memoryview__get__base') * def __get__(self): * return self.obj # <<<<<<<<<<<<<< @@ -15667,13 +16844,29 @@ static PyObject *__pyx_memoryview__get__base_MemoryView_10memoryview_4base___get __pyx_r = __pyx_v_self->obj; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "View.MemoryView":508 + * property base: + * @cname('__pyx_memoryview__get__base') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.obj + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "View.MemoryView":513 + * property shape: + * @cname('__pyx_memoryview_get_shape') + * def __get__(self): # <<<<<<<<<<<<<< + * return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self) { @@ -15681,18 +16874,12 @@ static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":520 - * property shape: - * @cname('__pyx_memoryview_get_shape') - * def __get__(self): # <<<<<<<<<<<<<< - * return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) - * - */ - static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { int __pyx_v_i; PyObject *__pyx_r = NULL; @@ -15706,7 +16893,7 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":521 + /* "View.MemoryView":514 * @cname('__pyx_memoryview_get_shape') * def __get__(self): * return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<< @@ -15714,25 +16901,32 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get * property strides: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_v_self->view.ndim; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":513 + * property shape: + * @cname('__pyx_memoryview_get_shape') + * def __get__(self): # <<<<<<<<<<<<<< + * return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); @@ -15744,6 +16938,14 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get return __pyx_r; } +/* "View.MemoryView":518 + * property strides: + * @cname('__pyx_memoryview_get_strides') + * def __get__(self): # <<<<<<<<<<<<<< + * if self.view.strides == NULL: + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self) { @@ -15751,18 +16953,12 @@ static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":525 - * property strides: - * @cname('__pyx_memoryview_get_strides') - * def __get__(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: - * - */ - static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { int __pyx_v_i; PyObject *__pyx_r = NULL; @@ -15777,7 +16973,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":526 + /* "View.MemoryView":519 * @cname('__pyx_memoryview_get_strides') * def __get__(self): * if self.view.strides == NULL: # <<<<<<<<<<<<<< @@ -15787,23 +16983,21 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__ __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":528 + /* "View.MemoryView":521 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([self.view.strides[i] for i in xrange(self.view.ndim)]) */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 521; __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[3]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "View.MemoryView":530 + /* "View.MemoryView":523 * raise ValueError("Buffer view does not expose strides") * * return tuple([self.view.strides[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<< @@ -15811,25 +17005,32 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__ * property suboffsets: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_v_self->view.ndim; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":518 + * property strides: + * @cname('__pyx_memoryview_get_strides') + * def __get__(self): # <<<<<<<<<<<<<< + * if self.view.strides == NULL: + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); @@ -15841,6 +17042,14 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__ return __pyx_r; } +/* "View.MemoryView":527 + * property suboffsets: + * @cname('__pyx_memoryview_get_suboffsets') + * def __get__(self): # <<<<<<<<<<<<<< + * if self.view.suboffsets == NULL: + * return [-1] * self.view.ndim + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self) { @@ -15848,18 +17057,12 @@ static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":534 - * property suboffsets: - * @cname('__pyx_memoryview_get_suboffsets') - * def __get__(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return [-1] * self.view.ndim - */ - static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { int __pyx_v_i; PyObject *__pyx_r = NULL; @@ -15874,7 +17077,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":535 + /* "View.MemoryView":528 * @cname('__pyx_memoryview_get_suboffsets') * def __get__(self): * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< @@ -15884,7 +17087,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":536 + /* "View.MemoryView":529 * def __get__(self): * if self.view.suboffsets == NULL: * return [-1] * self.view.ndim # <<<<<<<<<<<<<< @@ -15892,7 +17095,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof * return tuple([self.view.suboffsets[i] for i in xrange(self.view.ndim)]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(1 * ((__pyx_v_self->view.ndim<0) ? 0:__pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1 * ((__pyx_v_self->view.ndim<0) ? 0:__pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_self->view.ndim; __pyx_temp++) { @@ -15901,14 +17104,12 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof __Pyx_GIVEREF(__pyx_int_neg_1); } } - __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "View.MemoryView":538 + /* "View.MemoryView":531 * return [-1] * self.view.ndim * * return tuple([self.view.suboffsets[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<< @@ -15916,25 +17117,32 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof * property ndim: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_v_self->view.ndim; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":527 + * property suboffsets: + * @cname('__pyx_memoryview_get_suboffsets') + * def __get__(self): # <<<<<<<<<<<<<< + * if self.view.suboffsets == NULL: + * return [-1] * self.view.ndim + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); @@ -15946,6 +17154,14 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof return __pyx_r; } +/* "View.MemoryView":535 + * property ndim: + * @cname('__pyx_memoryview_get_ndim') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.view.ndim + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self) { @@ -15953,18 +17169,12 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":542 - * property ndim: - * @cname('__pyx_memoryview_get_ndim') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.view.ndim - * - */ - static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15974,7 +17184,7 @@ static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":543 + /* "View.MemoryView":536 * @cname('__pyx_memoryview_get_ndim') * def __get__(self): * return self.view.ndim # <<<<<<<<<<<<<< @@ -15982,14 +17192,21 @@ static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__ * property itemsize: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":535 + * property ndim: + * @cname('__pyx_memoryview_get_ndim') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.view.ndim + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -16000,25 +17217,27 @@ static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__ return __pyx_r; } -/* Python wrapper */ +/* "View.MemoryView":540 + * property itemsize: + * @cname('__pyx_memoryview_get_itemsize') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.view.itemsize + * + */ + +/* Python wrapper */ static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":547 - * property itemsize: - * @cname('__pyx_memoryview_get_itemsize') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.view.itemsize - * - */ - static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -16028,7 +17247,7 @@ static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":548 + /* "View.MemoryView":541 * @cname('__pyx_memoryview_get_itemsize') * def __get__(self): * return self.view.itemsize # <<<<<<<<<<<<<< @@ -16036,14 +17255,21 @@ static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize * property nbytes: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":540 + * property itemsize: + * @cname('__pyx_memoryview_get_itemsize') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.view.itemsize + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -16054,6 +17280,14 @@ static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize return __pyx_r; } +/* "View.MemoryView":545 + * property nbytes: + * @cname('__pyx_memoryview_get_nbytes') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.size * self.view.itemsize + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self) { @@ -16061,18 +17295,12 @@ static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":552 - * property nbytes: - * @cname('__pyx_memoryview_get_nbytes') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize - * - */ - static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -16084,7 +17312,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":553 + /* "View.MemoryView":546 * @cname('__pyx_memoryview_get_nbytes') * def __get__(self): * return self.size * self.view.itemsize # <<<<<<<<<<<<<< @@ -16092,11 +17320,11 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g * property size: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 546; __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; @@ -16104,8 +17332,15 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g __pyx_t_3 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":545 + * property nbytes: + * @cname('__pyx_memoryview_get_nbytes') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.size * self.view.itemsize + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -16118,6 +17353,14 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g return __pyx_r; } +/* "View.MemoryView":550 + * property size: + * @cname('__pyx_memoryview_get_size') + * def __get__(self): # <<<<<<<<<<<<<< + * if self._size is None: + * result = 1 + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self) { @@ -16125,18 +17368,12 @@ static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":557 - * property size: - * @cname('__pyx_memoryview_get_size') - * def __get__(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 - */ - static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_length = NULL; @@ -16153,7 +17390,7 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":558 + /* "View.MemoryView":551 * @cname('__pyx_memoryview_get_size') * def __get__(self): * if self._size is None: # <<<<<<<<<<<<<< @@ -16164,7 +17401,7 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":559 + /* "View.MemoryView":552 * def __get__(self): * if self._size is None: * result = 1 # <<<<<<<<<<<<<< @@ -16174,70 +17411,79 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ __Pyx_INCREF(__pyx_int_1); __pyx_v_result = __pyx_int_1; - /* "View.MemoryView":561 + /* "View.MemoryView":554 * result = 1 * * for length in self.shape: # <<<<<<<<<<<<<< * result *= length * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { - if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } } else { __pyx_t_3 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_3); } - __Pyx_XDECREF(__pyx_v_length); - __pyx_v_length = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":562 + /* "View.MemoryView":555 * * for length in self.shape: * result *= length # <<<<<<<<<<<<<< * * self._size = result */ - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_3; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3); __pyx_t_3 = 0; + + /* "View.MemoryView":554 + * result = 1 + * + * for length in self.shape: # <<<<<<<<<<<<<< + * result *= length + * + */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":564 + /* "View.MemoryView":557 * result *= length * * self._size = result # <<<<<<<<<<<<<< @@ -16253,7 +17499,7 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ } __pyx_L3:; - /* "View.MemoryView":566 + /* "View.MemoryView":559 * self._size = result * * return self._size # <<<<<<<<<<<<<< @@ -16265,8 +17511,15 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ __pyx_r = __pyx_v_self->_size; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":550 + * property size: + * @cname('__pyx_memoryview_get_size') + * def __get__(self): # <<<<<<<<<<<<<< + * if self._size is None: + * result = 1 + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -16280,6 +17533,14 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ return __pyx_r; } +/* "View.MemoryView":561 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] + */ + /* Python wrapper */ static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { @@ -16287,25 +17548,19 @@ static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":568 - * return self._size - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] - */ - static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__len__", 0); - /* "View.MemoryView":569 + /* "View.MemoryView":562 * * def __len__(self): * if self.view.ndim >= 1: # <<<<<<<<<<<<<< @@ -16315,7 +17570,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":570 + /* "View.MemoryView":563 * def __len__(self): * if self.view.ndim >= 1: * return self.view.shape[0] # <<<<<<<<<<<<<< @@ -16324,11 +17579,9 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py */ __pyx_r = (__pyx_v_self->view.shape[0]); goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "View.MemoryView":572 + /* "View.MemoryView":565 * return self.view.shape[0] * * return 0 # <<<<<<<<<<<<<< @@ -16338,12 +17591,28 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; + /* "View.MemoryView":561 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "View.MemoryView":567 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) + */ + /* Python wrapper */ static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { @@ -16351,18 +17620,12 @@ static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":574 - * return 0 - * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -16374,7 +17637,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "View.MemoryView":575 + /* "View.MemoryView":568 * * def __repr__(self): * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< @@ -16382,31 +17645,39 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":576 + /* "View.MemoryView":569 * def __repr__(self): * return "" % (self.base.__class__.__name__, * id(self)) # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":568 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 568; __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); @@ -16414,15 +17685,22 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_63), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":567 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -16435,6 +17713,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py return __pyx_r; } +/* "View.MemoryView":571 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { @@ -16442,18 +17728,12 @@ static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":578 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) - * - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -16464,7 +17744,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "View.MemoryView":579 + /* "View.MemoryView":572 * * def __str__(self): * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< @@ -16472,28 +17752,35 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 572; __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[3]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_64), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":571 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -16505,6 +17792,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx return __pyx_r; } +/* "View.MemoryView":575 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -16512,18 +17807,12 @@ static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNU __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":582 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice, tmp - * mslice = get_slice_from_memview(self, &tmp) - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice *__pyx_v_mslice; __Pyx_memviewslice __pyx_v_tmp; @@ -16535,31 +17824,38 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_c_contig", 0); - /* "View.MemoryView":584 - * def is_c_contig(self): - * cdef __Pyx_memviewslice *mslice, tmp + /* "View.MemoryView":578 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< * return slice_is_contig(mslice, 'C', self.view.ndim) * */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); - /* "View.MemoryView":585 - * cdef __Pyx_memviewslice *mslice, tmp + /* "View.MemoryView":579 + * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice, 'C', self.view.ndim) # <<<<<<<<<<<<<< * * def is_f_contig(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":575 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -16570,6 +17866,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct _ return __pyx_r; } +/* "View.MemoryView":581 + * return slice_is_contig(mslice, 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -16577,18 +17881,12 @@ static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNU __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":587 - * return slice_is_contig(mslice, 'C', self.view.ndim) - * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice, tmp - * mslice = get_slice_from_memview(self, &tmp) - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice *__pyx_v_mslice; __Pyx_memviewslice __pyx_v_tmp; @@ -16600,31 +17898,38 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_f_contig", 0); - /* "View.MemoryView":589 - * def is_f_contig(self): - * cdef __Pyx_memviewslice *mslice, tmp + /* "View.MemoryView":584 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< * return slice_is_contig(mslice, 'F', self.view.ndim) * */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); - /* "View.MemoryView":590 - * cdef __Pyx_memviewslice *mslice, tmp + /* "View.MemoryView":585 + * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice, 'F', self.view.ndim) # <<<<<<<<<<<<<< * * def copy(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":581 + * return slice_is_contig(mslice, 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -16635,6 +17940,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct _ return __pyx_r; } +/* "View.MemoryView":587 + * return slice_is_contig(mslice, 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -16642,18 +17955,12 @@ static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":592 - * return slice_is_contig(mslice, 'F', self.view.ndim) - * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice __pyx_v_mslice; int __pyx_v_flags; @@ -16666,7 +17973,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy", 0); - /* "View.MemoryView":594 + /* "View.MemoryView":589 * def copy(self): * cdef __Pyx_memviewslice mslice * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< @@ -16675,7 +17982,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "View.MemoryView":596 + /* "View.MemoryView":591 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS * * slice_copy(self, &mslice) # <<<<<<<<<<<<<< @@ -16684,17 +17991,17 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me */ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "View.MemoryView":600 + /* "View.MemoryView":592 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_C_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * - * return memoryview_copy_from_slice(self, &mslice) */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), __pyx_k__c, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), __pyx_k_c, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_mslice = __pyx_t_1; - /* "View.MemoryView":602 + /* "View.MemoryView":597 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< @@ -16702,14 +18009,21 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me * def copy_fortran(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":587 + * return slice_is_contig(mslice, 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -16720,6 +18034,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me return __pyx_r; } +/* "View.MemoryView":599 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -16727,18 +18049,12 @@ static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UN __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":604 - * return memoryview_copy_from_slice(self, &mslice) - * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice __pyx_v_src; __Pyx_memviewslice __pyx_v_dst; @@ -16752,7 +18068,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy_fortran", 0); - /* "View.MemoryView":606 + /* "View.MemoryView":601 * def copy_fortran(self): * cdef __Pyx_memviewslice src, dst * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< @@ -16761,7 +18077,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - /* "View.MemoryView":608 + /* "View.MemoryView":603 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS * * slice_copy(self, &src) # <<<<<<<<<<<<<< @@ -16770,17 +18086,17 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct */ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - /* "View.MemoryView":612 + /* "View.MemoryView":604 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_F_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * - * return memoryview_copy_from_slice(self, &dst) */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), __pyx_k__fortran, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), __pyx_k_fortran, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_dst = __pyx_t_1; - /* "View.MemoryView":614 + /* "View.MemoryView":609 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< @@ -16788,14 +18104,21 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":599 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -16806,7 +18129,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct return __pyx_r; } -/* "View.MemoryView":618 +/* "View.MemoryView":613 * * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< @@ -16826,18 +18149,18 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - /* "View.MemoryView":619 + /* "View.MemoryView":614 * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< * result.typeinfo = typeinfo * return result */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_o); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); @@ -16848,13 +18171,13 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":620 + /* "View.MemoryView":615 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo # <<<<<<<<<<<<<< @@ -16863,7 +18186,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in */ __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "View.MemoryView":621 + /* "View.MemoryView":616 * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo * return result # <<<<<<<<<<<<<< @@ -16875,8 +18198,15 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":613 + * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -16890,7 +18220,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in return __pyx_r; } -/* "View.MemoryView":624 +/* "View.MemoryView":619 * * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< @@ -16904,7 +18234,7 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { int __pyx_t_1; __Pyx_RefNannySetupContext("memoryview_check", 0); - /* "View.MemoryView":625 + /* "View.MemoryView":620 * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): * return isinstance(o, memoryview) # <<<<<<<<<<<<<< @@ -16915,13 +18245,21 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { __pyx_r = __pyx_t_1; goto __pyx_L0; - __pyx_r = 0; + /* "View.MemoryView":619 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":627 +/* "View.MemoryView":622 * return isinstance(o, memoryview) * * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< @@ -16932,11 +18270,11 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { PyObject *__pyx_v_tup = NULL; PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_have_slices = NULL; + int __pyx_v_have_slices; int __pyx_v_seen_ellipsis; CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; PyObject *__pyx_v_item = NULL; - PyObject *__pyx_v_nslices = NULL; + Py_ssize_t __pyx_v_nslices; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -16946,17 +18284,16 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { Py_ssize_t __pyx_t_5; PyObject *(*__pyx_t_6)(PyObject *); PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_t_12; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_unellipsify", 0); - /* "View.MemoryView":632 + /* "View.MemoryView":627 * full slices. * """ * if not isinstance(index, tuple): # <<<<<<<<<<<<<< @@ -16967,25 +18304,25 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":633 + /* "View.MemoryView":628 * """ * if not isinstance(index, tuple): * tup = (index,) # <<<<<<<<<<<<<< * else: * tup = index */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_index); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); __Pyx_GIVEREF(__pyx_v_index); - __pyx_v_tup = ((PyObject *)__pyx_t_3); + __pyx_v_tup = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":635 + /* "View.MemoryView":630 * tup = (index,) * else: * tup = index # <<<<<<<<<<<<<< @@ -16997,31 +18334,28 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { } __pyx_L3:; - /* "View.MemoryView":637 + /* "View.MemoryView":632 * tup = index * * result = [] # <<<<<<<<<<<<<< * have_slices = False * seen_ellipsis = False */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_result = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":638 + /* "View.MemoryView":633 * * result = [] * have_slices = False # <<<<<<<<<<<<<< * seen_ellipsis = False * for idx, item in enumerate(tup): */ - __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_have_slices = 0; - /* "View.MemoryView":639 + /* "View.MemoryView":634 * result = [] * have_slices = False * seen_ellipsis = False # <<<<<<<<<<<<<< @@ -17030,7 +18364,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_seen_ellipsis = 0; - /* "View.MemoryView":640 + /* "View.MemoryView":635 * have_slices = False * seen_ellipsis = False * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< @@ -17039,53 +18373,54 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __Pyx_INCREF(__pyx_int_0); __pyx_t_3 = __pyx_int_0; - if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) { + if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) { __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } for (;;) { - if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } } else { __pyx_t_7 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_7)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_7); } - __Pyx_XDECREF(__pyx_v_item); - __pyx_v_item = __pyx_t_7; + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_idx); - __pyx_v_idx = __pyx_t_3; - __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); + __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_7; __pyx_t_7 = 0; - /* "View.MemoryView":641 + /* "View.MemoryView":636 * seen_ellipsis = False * for idx, item in enumerate(tup): * if item is Ellipsis: # <<<<<<<<<<<<<< @@ -17096,7 +18431,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":642 + /* "View.MemoryView":637 * for idx, item in enumerate(tup): * if item is Ellipsis: * if not seen_ellipsis: # <<<<<<<<<<<<<< @@ -17106,40 +18441,27 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); if (__pyx_t_1) { - /* "View.MemoryView":643 + /* "View.MemoryView":638 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_9) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_9) + 1))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_9) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_t_8); - PyList_SET_ITEM(__pyx_t_10, __pyx_temp, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); + for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { + __Pyx_INCREF(__pyx_slice__33); + PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__33); + __Pyx_GIVEREF(__pyx_slice__33); } } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "View.MemoryView":644 + /* "View.MemoryView":639 * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) * seen_ellipsis = True # <<<<<<<<<<<<<< @@ -17151,224 +18473,215 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { } /*else*/ { - /* "View.MemoryView":646 + /* "View.MemoryView":641 * seen_ellipsis = True * else: * result.append(slice(None)) # <<<<<<<<<<<<<< * have_slices = True * else: */ - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__34); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L7:; - /* "View.MemoryView":647 + /* "View.MemoryView":642 * else: * result.append(slice(None)) * have_slices = True # <<<<<<<<<<<<<< * else: * if not isinstance(item, slice) and not PyIndex_Check(item): */ - __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_v_have_slices); - __pyx_v_have_slices = __pyx_t_10; - __pyx_t_10 = 0; + __pyx_v_have_slices = 1; goto __pyx_L6; } /*else*/ { - /* "View.MemoryView":649 + /* "View.MemoryView":644 * have_slices = True * else: * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< * raise TypeError("Cannot index with type '%s'" % type(item)) * */ - __pyx_t_1 = PySlice_Check(__pyx_v_item); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0); - __pyx_t_12 = __pyx_t_1; + __pyx_t_2 = PySlice_Check(__pyx_v_item); + __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0); + if (__pyx_t_10) { } else { - __pyx_t_12 = __pyx_t_2; + __pyx_t_1 = __pyx_t_10; + goto __pyx_L9_bool_binop_done; } - if (__pyx_t_12) { + __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0); + __pyx_t_1 = __pyx_t_10; + __pyx_L9_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":650 + /* "View.MemoryView":645 * else: * if not isinstance(item, slice) and not PyIndex_Check(item): * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< * * have_slices = have_slices or isinstance(item, slice) */ - __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L8:; - /* "View.MemoryView":652 + /* "View.MemoryView":647 * raise TypeError("Cannot index with type '%s'" % type(item)) * * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< * result.append(item) * */ - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_12) { - __pyx_t_12 = PySlice_Check(__pyx_v_item); - __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __pyx_t_10; - __pyx_t_10 = 0; + __pyx_t_10 = (__pyx_v_have_slices != 0); + if (!__pyx_t_10) { } else { - __Pyx_INCREF(__pyx_v_have_slices); - __pyx_t_8 = __pyx_v_have_slices; + __pyx_t_1 = __pyx_t_10; + goto __pyx_L11_bool_binop_done; } - __Pyx_DECREF(__pyx_v_have_slices); - __pyx_v_have_slices = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_t_10 = PySlice_Check(__pyx_v_item); + __pyx_t_2 = (__pyx_t_10 != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L11_bool_binop_done:; + __pyx_v_have_slices = __pyx_t_1; - /* "View.MemoryView":653 + /* "View.MemoryView":648 * * have_slices = have_slices or isinstance(item, slice) * result.append(item) # <<<<<<<<<<<<<< * * nslices = ndim - len(result) */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L6:; + + /* "View.MemoryView":635 + * have_slices = False + * seen_ellipsis = False + * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: + */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":655 + /* "View.MemoryView":650 * result.append(item) * * nslices = ndim - len(result) # <<<<<<<<<<<<<< * if nslices: * result.extend([slice(None)] * nslices) */ - __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_nslices = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); - /* "View.MemoryView":656 + /* "View.MemoryView":651 * * nslices = ndim - len(result) * if nslices: # <<<<<<<<<<<<<< * result.extend([slice(None)] * nslices) * */ - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_nslices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_12) { + __pyx_t_1 = (__pyx_v_nslices != 0); + if (__pyx_t_1) { - /* "View.MemoryView":657 + /* "View.MemoryView":652 * nslices = ndim - len(result) * if nslices: * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< * * return have_slices or nslices, tuple(result) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_v_nslices); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_8); - __pyx_t_8 = __pyx_temp; + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { + __Pyx_INCREF(__pyx_slice__35); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__35); + __Pyx_GIVEREF(__pyx_slice__35); + } } - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L9; + goto __pyx_L13; } - __pyx_L9:; + __pyx_L13:; - /* "View.MemoryView":659 + /* "View.MemoryView":654 * result.extend([slice(None)] * nslices) * * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_12) { - __Pyx_INCREF(__pyx_v_nslices); - __pyx_t_8 = __pyx_v_nslices; + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { } else { - __Pyx_INCREF(__pyx_v_have_slices); - __pyx_t_8 = __pyx_v_have_slices; + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L14_bool_binop_done; } - __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_8 = 0; + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_L14_bool_binop_done:; + __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 654; __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); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_r = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; goto __pyx_L0; - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":622 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tup); __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_have_slices); __Pyx_XDECREF(__pyx_v_idx); __Pyx_XDECREF(__pyx_v_item); - __Pyx_XDECREF(__pyx_v_nslices); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":661 +/* "View.MemoryView":656 * return have_slices or nslices, tuple(result) * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< @@ -17389,7 +18702,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - /* "View.MemoryView":663 + /* "View.MemoryView":658 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * cdef int i * for i in range(ndim): # <<<<<<<<<<<<<< @@ -17400,7 +18713,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":664 + /* "View.MemoryView":659 * cdef int i * for i in range(ndim): * if suboffsets[i] >= 0: # <<<<<<<<<<<<<< @@ -17410,23 +18723,30 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0); if (__pyx_t_3) { - /* "View.MemoryView":665 + /* "View.MemoryView":660 * for i in range(ndim): * if suboffsets[i] >= 0: * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 660; __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[3]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L5:; } + /* "View.MemoryView":656 + * return have_slices or nslices, tuple(result) + * + * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(ndim): + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -17439,7 +18759,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ return __pyx_r; } -/* "View.MemoryView":672 +/* "View.MemoryView":667 * * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< @@ -17468,22 +18788,22 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - struct __pyx_memoryview_obj *__pyx_t_3; - char *__pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_3 = NULL; + struct __pyx_memoryview_obj *__pyx_t_4; + char *__pyx_t_5; + int __pyx_t_6; Py_ssize_t __pyx_t_7; PyObject *(*__pyx_t_8)(PyObject *); PyObject *__pyx_t_9 = NULL; Py_ssize_t __pyx_t_10; int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; + Py_ssize_t __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memview_slice", 0); - /* "View.MemoryView":673 + /* "View.MemoryView":668 * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< @@ -17493,7 +18813,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_v_new_ndim = 0; __pyx_v_suboffset_dim = -1; - /* "View.MemoryView":680 + /* "View.MemoryView":675 * * * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< @@ -17502,7 +18822,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))); - /* "View.MemoryView":684 + /* "View.MemoryView":679 * cdef _memoryviewslice memviewsliceobj * * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< @@ -17510,13 +18830,15 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * if isinstance(memview, _memoryviewslice): */ #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!Py_OptimizeFlag)) { + if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } #endif - /* "View.MemoryView":686 + /* "View.MemoryView":681 * assert memview.view.ndim > 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -17527,18 +18849,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":687 + /* "View.MemoryView":682 * * if isinstance(memview, _memoryviewslice): * memviewsliceobj = memview # <<<<<<<<<<<<<< * p_src = &memviewsliceobj.from_slice * else: */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(((PyObject *)__pyx_v_memview)); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview); + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":688 + /* "View.MemoryView":683 * if isinstance(memview, _memoryviewslice): * memviewsliceobj = memview * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< @@ -17550,7 +18874,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } /*else*/ { - /* "View.MemoryView":690 + /* "View.MemoryView":685 * p_src = &memviewsliceobj.from_slice * else: * slice_copy(memview, &src) # <<<<<<<<<<<<<< @@ -17559,7 +18883,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* "View.MemoryView":691 + /* "View.MemoryView":686 * else: * slice_copy(memview, &src) * p_src = &src # <<<<<<<<<<<<<< @@ -17570,27 +18894,27 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __pyx_L3:; - /* "View.MemoryView":697 + /* "View.MemoryView":692 * * * dst.memview = p_src.memview # <<<<<<<<<<<<<< * dst.data = p_src.data * */ - __pyx_t_3 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_3; + __pyx_t_4 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_4; - /* "View.MemoryView":698 + /* "View.MemoryView":693 * * dst.memview = p_src.memview * dst.data = p_src.data # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_4; + __pyx_t_5 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_5; - /* "View.MemoryView":703 + /* "View.MemoryView":698 * * * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< @@ -17599,7 +18923,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_dst = (&__pyx_v_dst); - /* "View.MemoryView":704 + /* "View.MemoryView":699 * * cdef __Pyx_memviewslice *p_dst = &dst * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< @@ -17608,85 +18932,87 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "View.MemoryView":708 + /* "View.MemoryView":703 * cdef bint have_start, have_stop, have_step * * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< * if PyIndex_Check(index): * slice_memviewslice( */ - __pyx_t_5 = 0; - if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; + __pyx_t_6 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } for (;;) { - if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_6); + __pyx_t_9 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_9)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_9); } - __Pyx_XDECREF(__pyx_v_index); - __pyx_v_index = __pyx_t_9; + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); __pyx_t_9 = 0; - __pyx_v_dim = __pyx_t_5; - __pyx_t_5 = (__pyx_t_5 + 1); + __pyx_v_dim = __pyx_t_6; + __pyx_t_6 = (__pyx_t_6 + 1); - /* "View.MemoryView":709 + /* "View.MemoryView":704 * * for dim, index in enumerate(indices): * if PyIndex_Check(index): # <<<<<<<<<<<<<< * slice_memviewslice( * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], */ - __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0); + __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); if (__pyx_t_2) { - /* "View.MemoryView":713 + /* "View.MemoryView":708 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], * dim, new_ndim, p_suboffset_dim, * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< * 0, 0, 0, # have_{start,stop,step} * False) */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __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[3]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":715 - * index, 0, 0, # start, stop, step - * 0, 0, 0, # have_{start,stop,step} - * False) # <<<<<<<<<<<<<< - * elif index is None: - * p_dst.shape[new_ndim] = 1 + /* "View.MemoryView":705 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } - /* "View.MemoryView":716 + /* "View.MemoryView":711 * 0, 0, 0, # have_{start,stop,step} * False) * elif index is None: # <<<<<<<<<<<<<< @@ -17697,7 +19023,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":717 + /* "View.MemoryView":712 * False) * elif index is None: * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< @@ -17706,7 +19032,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - /* "View.MemoryView":718 + /* "View.MemoryView":713 * elif index is None: * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< @@ -17715,7 +19041,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "View.MemoryView":719 + /* "View.MemoryView":714 * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< @@ -17724,7 +19050,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1; - /* "View.MemoryView":720 + /* "View.MemoryView":715 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 * new_ndim += 1 # <<<<<<<<<<<<<< @@ -17736,121 +19062,121 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } /*else*/ { - /* "View.MemoryView":722 + /* "View.MemoryView":717 * new_ndim += 1 * else: * start = index.start or 0 # <<<<<<<<<<<<<< * stop = index.stop or 0 * step = index.step or 0 */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_INCREF(__pyx_int_0); - __pyx_t_12 = __pyx_int_0; } else { - __pyx_t_12 = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __pyx_t_12; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L7_bool_binop_done; } - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_10 = 0; + __pyx_L7_bool_binop_done:; __pyx_v_start = __pyx_t_10; - /* "View.MemoryView":723 + /* "View.MemoryView":718 * else: * start = index.start or 0 * stop = index.stop or 0 # <<<<<<<<<<<<<< * step = index.step or 0 * */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_INCREF(__pyx_int_0); - __pyx_t_9 = __pyx_int_0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { - __pyx_t_9 = __pyx_t_12; - __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __pyx_t_12; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L9_bool_binop_done; } - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_L9_bool_binop_done:; __pyx_v_stop = __pyx_t_10; - /* "View.MemoryView":724 + /* "View.MemoryView":719 * start = index.start or 0 * stop = index.stop or 0 * step = index.step or 0 # <<<<<<<<<<<<<< * * have_start = index.start is not None */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_INCREF(__pyx_int_0); - __pyx_t_12 = __pyx_int_0; } else { - __pyx_t_12 = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __pyx_t_12; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L11_bool_binop_done; } - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_10 = 0; + __pyx_L11_bool_binop_done:; __pyx_v_step = __pyx_t_10; - /* "View.MemoryView":726 + /* "View.MemoryView":721 * step = index.step or 0 * * have_start = index.start is not None # <<<<<<<<<<<<<< * have_stop = index.stop is not None * have_step = index.step is not None */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = (__pyx_t_12 != Py_None); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = (__pyx_t_9 != Py_None); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_have_start = __pyx_t_1; - /* "View.MemoryView":727 + /* "View.MemoryView":722 * * have_start = index.start is not None * have_stop = index.stop is not None # <<<<<<<<<<<<<< * have_step = index.step is not None * */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = (__pyx_t_12 != Py_None); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = (__pyx_t_9 != Py_None); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_have_stop = __pyx_t_1; - /* "View.MemoryView":728 + /* "View.MemoryView":723 * have_start = index.start is not None * have_stop = index.stop is not None * have_step = index.step is not None # <<<<<<<<<<<<<< * * slice_memviewslice( */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = (__pyx_t_12 != Py_None); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = (__pyx_t_9 != Py_None); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_have_step = __pyx_t_1; - /* "View.MemoryView":735 - * start, stop, step, - * have_start, have_stop, have_step, - * True) # <<<<<<<<<<<<<< - * new_ndim += 1 + /* "View.MemoryView":725 + * have_step = index.step is not None * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":736 + /* "View.MemoryView":731 * have_start, have_stop, have_step, * True) * new_ndim += 1 # <<<<<<<<<<<<<< @@ -17860,10 +19186,18 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); } __pyx_L6:; + + /* "View.MemoryView":703 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * slice_memviewslice( + */ } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":738 + /* "View.MemoryView":733 * new_ndim += 1 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -17874,7 +19208,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":739 + /* "View.MemoryView":734 * * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< @@ -17883,33 +19217,41 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - /* "View.MemoryView":740 + /* "View.MemoryView":735 * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< * memviewsliceobj.to_dtype_func, * memview.dtype_is_object) */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "View.MemoryView":742 + /* "View.MemoryView":736 + * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, */ - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6); - __pyx_t_6 = 0; + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + + /* "View.MemoryView":734 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, + */ + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; - goto __pyx_L7; } /*else*/ { - /* "View.MemoryView":744 + /* "View.MemoryView":739 * memview.dtype_is_object) * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< @@ -17918,28 +19260,41 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - /* "View.MemoryView":745 + /* "View.MemoryView":740 * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "View.MemoryView":739 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * + */ + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; } - __pyx_L7:; - __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":667 + * + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step + */ + + /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -17950,7 +19305,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ return __pyx_r; } -/* "View.MemoryView":769 +/* "View.MemoryView":764 * * @cname('__pyx_memoryview_slice_memviewslice') * cdef int slice_memviewslice( # <<<<<<<<<<<<<< @@ -17965,12 +19320,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - /* "View.MemoryView":789 + /* "View.MemoryView":784 * cdef bint negative_step * * if not is_slice: # <<<<<<<<<<<<<< @@ -17980,7 +19334,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); if (__pyx_t_1) { - /* "View.MemoryView":791 + /* "View.MemoryView":786 * if not is_slice: * * if start < 0: # <<<<<<<<<<<<<< @@ -17990,7 +19344,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_1 = ((__pyx_v_start < 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":792 + /* "View.MemoryView":787 * * if start < 0: * start += shape # <<<<<<<<<<<<<< @@ -18002,7 +19356,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L4:; - /* "View.MemoryView":793 + /* "View.MemoryView":788 * if start < 0: * start += shape * if not 0 <= start < shape: # <<<<<<<<<<<<<< @@ -18016,14 +19370,14 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":794 + /* "View.MemoryView":789 * start += shape * if not 0 <= start < shape: * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< * else: * */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_71, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; @@ -18031,50 +19385,55 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } /*else*/ { - /* "View.MemoryView":797 + /* "View.MemoryView":792 * else: * * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< * * if have_step and step == 0: */ - __pyx_t_2 = (__pyx_v_have_step != 0); - if (__pyx_t_2) { - __pyx_t_1 = (__pyx_v_step < 0); - __pyx_t_4 = __pyx_t_1; + __pyx_t_1 = ((__pyx_v_have_step != 0) != 0); + if (__pyx_t_1) { } else { - __pyx_t_4 = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + goto __pyx_L6_bool_binop_done; } - __pyx_v_negative_step = __pyx_t_4; + __pyx_t_1 = ((__pyx_v_step < 0) != 0); + __pyx_t_2 = __pyx_t_1; + __pyx_L6_bool_binop_done:; + __pyx_v_negative_step = __pyx_t_2; - /* "View.MemoryView":799 + /* "View.MemoryView":794 * negative_step = have_step != 0 and step < 0 * * if have_step and step == 0: # <<<<<<<<<<<<<< * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) * */ - if ((__pyx_v_have_step != 0)) { - __pyx_t_4 = (__pyx_v_step == 0); - __pyx_t_2 = __pyx_t_4; + __pyx_t_1 = (__pyx_v_have_step != 0); + if (__pyx_t_1) { } else { - __pyx_t_2 = (__pyx_v_have_step != 0); + __pyx_t_2 = __pyx_t_1; + goto __pyx_L9_bool_binop_done; } + __pyx_t_1 = ((__pyx_v_step == 0) != 0); + __pyx_t_2 = __pyx_t_1; + __pyx_L9_bool_binop_done:; if (__pyx_t_2) { - /* "View.MemoryView":800 + /* "View.MemoryView":795 * * if have_step and step == 0: * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_72, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "View.MemoryView":803 + /* "View.MemoryView":798 * * * if have_start: # <<<<<<<<<<<<<< @@ -18084,7 +19443,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_have_start != 0); if (__pyx_t_2) { - /* "View.MemoryView":804 + /* "View.MemoryView":799 * * if have_start: * if start < 0: # <<<<<<<<<<<<<< @@ -18094,7 +19453,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_start < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":805 + /* "View.MemoryView":800 * if have_start: * if start < 0: * start += shape # <<<<<<<<<<<<<< @@ -18103,7 +19462,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "View.MemoryView":806 + /* "View.MemoryView":801 * if start < 0: * start += shape * if start < 0: # <<<<<<<<<<<<<< @@ -18113,7 +19472,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_start < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":807 + /* "View.MemoryView":802 * start += shape * if start < 0: * start = 0 # <<<<<<<<<<<<<< @@ -18121,13 +19480,13 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * if negative_step: */ __pyx_v_start = 0; - goto __pyx_L9; + goto __pyx_L13; } - __pyx_L9:; - goto __pyx_L8; + __pyx_L13:; + goto __pyx_L12; } - /* "View.MemoryView":808 + /* "View.MemoryView":803 * if start < 0: * start = 0 * elif start >= shape: # <<<<<<<<<<<<<< @@ -18137,7 +19496,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); if (__pyx_t_2) { - /* "View.MemoryView":809 + /* "View.MemoryView":804 * start = 0 * elif start >= shape: * if negative_step: # <<<<<<<<<<<<<< @@ -18147,7 +19506,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { - /* "View.MemoryView":810 + /* "View.MemoryView":805 * elif start >= shape: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< @@ -18155,11 +19514,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * start = shape */ __pyx_v_start = (__pyx_v_shape - 1); - goto __pyx_L10; + goto __pyx_L14; } /*else*/ { - /* "View.MemoryView":812 + /* "View.MemoryView":807 * start = shape - 1 * else: * start = shape # <<<<<<<<<<<<<< @@ -18168,15 +19527,15 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = __pyx_v_shape; } - __pyx_L10:; - goto __pyx_L8; + __pyx_L14:; + goto __pyx_L12; } - __pyx_L8:; - goto __pyx_L7; + __pyx_L12:; + goto __pyx_L11; } /*else*/ { - /* "View.MemoryView":814 + /* "View.MemoryView":809 * start = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -18186,7 +19545,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { - /* "View.MemoryView":815 + /* "View.MemoryView":810 * else: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< @@ -18194,11 +19553,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * start = 0 */ __pyx_v_start = (__pyx_v_shape - 1); - goto __pyx_L11; + goto __pyx_L15; } /*else*/ { - /* "View.MemoryView":817 + /* "View.MemoryView":812 * start = shape - 1 * else: * start = 0 # <<<<<<<<<<<<<< @@ -18207,11 +19566,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = 0; } - __pyx_L11:; + __pyx_L15:; } - __pyx_L7:; + __pyx_L11:; - /* "View.MemoryView":819 + /* "View.MemoryView":814 * start = 0 * * if have_stop: # <<<<<<<<<<<<<< @@ -18221,7 +19580,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_have_stop != 0); if (__pyx_t_2) { - /* "View.MemoryView":820 + /* "View.MemoryView":815 * * if have_stop: * if stop < 0: # <<<<<<<<<<<<<< @@ -18231,7 +19590,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_stop < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":821 + /* "View.MemoryView":816 * if have_stop: * if stop < 0: * stop += shape # <<<<<<<<<<<<<< @@ -18240,7 +19599,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* "View.MemoryView":822 + /* "View.MemoryView":817 * if stop < 0: * stop += shape * if stop < 0: # <<<<<<<<<<<<<< @@ -18250,7 +19609,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_stop < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":823 + /* "View.MemoryView":818 * stop += shape * if stop < 0: * stop = 0 # <<<<<<<<<<<<<< @@ -18258,13 +19617,13 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * stop = shape */ __pyx_v_stop = 0; - goto __pyx_L14; + goto __pyx_L18; } - __pyx_L14:; - goto __pyx_L13; + __pyx_L18:; + goto __pyx_L17; } - /* "View.MemoryView":824 + /* "View.MemoryView":819 * if stop < 0: * stop = 0 * elif stop > shape: # <<<<<<<<<<<<<< @@ -18274,7 +19633,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); if (__pyx_t_2) { - /* "View.MemoryView":825 + /* "View.MemoryView":820 * stop = 0 * elif stop > shape: * stop = shape # <<<<<<<<<<<<<< @@ -18282,14 +19641,14 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * if negative_step: */ __pyx_v_stop = __pyx_v_shape; - goto __pyx_L13; + goto __pyx_L17; } - __pyx_L13:; - goto __pyx_L12; + __pyx_L17:; + goto __pyx_L16; } /*else*/ { - /* "View.MemoryView":827 + /* "View.MemoryView":822 * stop = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -18299,7 +19658,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { - /* "View.MemoryView":828 + /* "View.MemoryView":823 * else: * if negative_step: * stop = -1 # <<<<<<<<<<<<<< @@ -18307,11 +19666,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * stop = shape */ __pyx_v_stop = -1; - goto __pyx_L15; + goto __pyx_L19; } /*else*/ { - /* "View.MemoryView":830 + /* "View.MemoryView":825 * stop = -1 * else: * stop = shape # <<<<<<<<<<<<<< @@ -18320,11 +19679,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = __pyx_v_shape; } - __pyx_L15:; + __pyx_L19:; } - __pyx_L12:; + __pyx_L16:; - /* "View.MemoryView":832 + /* "View.MemoryView":827 * stop = shape * * if not have_step: # <<<<<<<<<<<<<< @@ -18334,7 +19693,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":833 + /* "View.MemoryView":828 * * if not have_step: * step = 1 # <<<<<<<<<<<<<< @@ -18342,11 +19701,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * */ __pyx_v_step = 1; - goto __pyx_L16; + goto __pyx_L20; } - __pyx_L16:; + __pyx_L20:; - /* "View.MemoryView":837 + /* "View.MemoryView":832 * * with cython.cdivision(True): * new_shape = (stop - start) // step # <<<<<<<<<<<<<< @@ -18355,7 +19714,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - /* "View.MemoryView":839 + /* "View.MemoryView":834 * new_shape = (stop - start) // step * * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< @@ -18365,7 +19724,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":840 + /* "View.MemoryView":835 * * if (stop - start) - step * new_shape: * new_shape += 1 # <<<<<<<<<<<<<< @@ -18373,11 +19732,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * if new_shape < 0: */ __pyx_v_new_shape = (__pyx_v_new_shape + 1); - goto __pyx_L17; + goto __pyx_L21; } - __pyx_L17:; + __pyx_L21:; - /* "View.MemoryView":842 + /* "View.MemoryView":837 * new_shape += 1 * * if new_shape < 0: # <<<<<<<<<<<<<< @@ -18387,7 +19746,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":843 + /* "View.MemoryView":838 * * if new_shape < 0: * new_shape = 0 # <<<<<<<<<<<<<< @@ -18395,11 +19754,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * */ __pyx_v_new_shape = 0; - goto __pyx_L18; + goto __pyx_L22; } - __pyx_L18:; + __pyx_L22:; - /* "View.MemoryView":846 + /* "View.MemoryView":841 * * * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< @@ -18408,7 +19767,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "View.MemoryView":847 + /* "View.MemoryView":842 * * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< @@ -18417,7 +19776,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - /* "View.MemoryView":848 + /* "View.MemoryView":843 * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< @@ -18428,7 +19787,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L3:; - /* "View.MemoryView":851 + /* "View.MemoryView":846 * * * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< @@ -18438,7 +19797,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":852 + /* "View.MemoryView":847 * * if suboffset_dim[0] < 0: * dst.data += start * stride # <<<<<<<<<<<<<< @@ -18446,11 +19805,11 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * dst.suboffsets[suboffset_dim[0]] += start * stride */ __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - goto __pyx_L19; + goto __pyx_L23; } /*else*/ { - /* "View.MemoryView":854 + /* "View.MemoryView":849 * dst.data += start * stride * else: * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< @@ -18460,9 +19819,9 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_3 = (__pyx_v_suboffset_dim[0]); (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); } - __pyx_L19:; + __pyx_L23:; - /* "View.MemoryView":856 + /* "View.MemoryView":851 * dst.suboffsets[suboffset_dim[0]] += start * stride * * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -18472,7 +19831,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":857 + /* "View.MemoryView":852 * * if suboffset >= 0: * if not is_slice: # <<<<<<<<<<<<<< @@ -18482,7 +19841,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":858 + /* "View.MemoryView":853 * if suboffset >= 0: * if not is_slice: * if new_ndim == 0: # <<<<<<<<<<<<<< @@ -18492,7 +19851,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":859 + /* "View.MemoryView":854 * if not is_slice: * if new_ndim == 0: * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< @@ -18500,25 +19859,25 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, * _err_dim(IndexError, "All dimensions preceding dimension %d " */ __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - goto __pyx_L22; + goto __pyx_L26; } /*else*/ { - /* "View.MemoryView":862 + /* "View.MemoryView":856 + * dst.data = ( dst.data)[0] + suboffset * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) * else: - * suboffset_dim[0] = new_ndim */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_73, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L22:; - goto __pyx_L21; + __pyx_L26:; + goto __pyx_L25; } /*else*/ { - /* "View.MemoryView":864 + /* "View.MemoryView":859 * "must be indexed and not sliced", dim) * else: * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< @@ -18527,12 +19886,12 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; } - __pyx_L21:; - goto __pyx_L20; + __pyx_L25:; + goto __pyx_L24; } - __pyx_L20:; + __pyx_L24:; - /* "View.MemoryView":866 + /* "View.MemoryView":861 * suboffset_dim[0] = new_ndim * * return 0 # <<<<<<<<<<<<<< @@ -18542,8 +19901,15 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":764 + * + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + */ + + /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD @@ -18559,15 +19925,15 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, return __pyx_r; } -/* "View.MemoryView":872 +/* "View.MemoryView":867 * * @cname('__pyx_pybuffer_index') * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * int dim) except NULL: + * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 */ -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) { +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { Py_ssize_t __pyx_v_shape; Py_ssize_t __pyx_v_stride; Py_ssize_t __pyx_v_suboffset; @@ -18584,17 +19950,17 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pybuffer_index", 0); - /* "View.MemoryView":874 + /* "View.MemoryView":869 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * int dim) except NULL: + * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< * cdef Py_ssize_t itemsize = view.itemsize * cdef char *resultp */ __pyx_v_suboffset = -1; - /* "View.MemoryView":875 - * int dim) except NULL: + /* "View.MemoryView":870 + * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< * cdef char *resultp @@ -18603,7 +19969,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_1 = __pyx_v_view->itemsize; __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":878 + /* "View.MemoryView":873 * cdef char *resultp * * if view.ndim == 0: # <<<<<<<<<<<<<< @@ -18613,7 +19979,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":879 + /* "View.MemoryView":874 * * if view.ndim == 0: * shape = view.len / itemsize # <<<<<<<<<<<<<< @@ -18624,25 +19990,25 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize); - /* "View.MemoryView":880 + /* "View.MemoryView":875 * if view.ndim == 0: * shape = view.len / itemsize * stride = itemsize # <<<<<<<<<<<<<< @@ -18654,7 +20020,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P } /*else*/ { - /* "View.MemoryView":882 + /* "View.MemoryView":877 * stride = itemsize * else: * shape = view.shape[dim] # <<<<<<<<<<<<<< @@ -18663,7 +20029,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "View.MemoryView":883 + /* "View.MemoryView":878 * else: * shape = view.shape[dim] * stride = view.strides[dim] # <<<<<<<<<<<<<< @@ -18672,7 +20038,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - /* "View.MemoryView":884 + /* "View.MemoryView":879 * shape = view.shape[dim] * stride = view.strides[dim] * if view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -18682,7 +20048,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); if (__pyx_t_2) { - /* "View.MemoryView":885 + /* "View.MemoryView":880 * stride = view.strides[dim] * if view.suboffsets != NULL: * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< @@ -18696,7 +20062,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P } __pyx_L3:; - /* "View.MemoryView":887 + /* "View.MemoryView":882 * suboffset = view.suboffsets[dim] * * if index < 0: # <<<<<<<<<<<<<< @@ -18706,7 +20072,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":888 + /* "View.MemoryView":883 * * if index < 0: * index += view.shape[dim] # <<<<<<<<<<<<<< @@ -18715,7 +20081,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - /* "View.MemoryView":889 + /* "View.MemoryView":884 * if index < 0: * index += view.shape[dim] * if index < 0: # <<<<<<<<<<<<<< @@ -18725,37 +20091,35 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":890 + /* "View.MemoryView":885 * index += view.shape[dim] * if index < 0: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * if index >= shape: */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_74), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 885; __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[3]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L6:; goto __pyx_L5; } __pyx_L5:; - /* "View.MemoryView":892 + /* "View.MemoryView":887 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * if index >= shape: # <<<<<<<<<<<<<< @@ -18765,34 +20129,32 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); if (__pyx_t_2) { - /* "View.MemoryView":893 + /* "View.MemoryView":888 * * if index >= shape: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * resultp = bufp + index * stride */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_74), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 888; __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[3]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L7:; - /* "View.MemoryView":895 + /* "View.MemoryView":890 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * resultp = bufp + index * stride # <<<<<<<<<<<<<< @@ -18801,7 +20163,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - /* "View.MemoryView":896 + /* "View.MemoryView":891 * * resultp = bufp + index * stride * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -18811,7 +20173,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":897 + /* "View.MemoryView":892 * resultp = bufp + index * stride * if suboffset >= 0: * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< @@ -18823,7 +20185,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P } __pyx_L8:; - /* "View.MemoryView":899 + /* "View.MemoryView":894 * resultp = ( resultp)[0] + suboffset * * return resultp # <<<<<<<<<<<<<< @@ -18833,8 +20195,15 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_r = __pyx_v_resultp; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":867 + * + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -18845,7 +20214,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P return __pyx_r; } -/* "View.MemoryView":905 +/* "View.MemoryView":900 * * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< @@ -18868,12 +20237,11 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { 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; - /* "View.MemoryView":906 + /* "View.MemoryView":901 * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< @@ -18883,7 +20251,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; __pyx_v_ndim = __pyx_t_1; - /* "View.MemoryView":908 + /* "View.MemoryView":903 * cdef int ndim = memslice.memview.view.ndim * * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< @@ -18893,7 +20261,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_t_2 = __pyx_v_memslice->shape; __pyx_v_shape = __pyx_t_2; - /* "View.MemoryView":909 + /* "View.MemoryView":904 * * cdef Py_ssize_t *shape = memslice.shape * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< @@ -18903,7 +20271,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_t_2 = __pyx_v_memslice->strides; __pyx_v_strides = __pyx_t_2; - /* "View.MemoryView":913 + /* "View.MemoryView":908 * * cdef int i, j * for i in range(ndim / 2): # <<<<<<<<<<<<<< @@ -18914,7 +20282,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":914 + /* "View.MemoryView":909 * cdef int i, j * for i in range(ndim / 2): * j = ndim - 1 - i # <<<<<<<<<<<<<< @@ -18923,7 +20291,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { */ __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - /* "View.MemoryView":915 + /* "View.MemoryView":910 * for i in range(ndim / 2): * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< @@ -18935,7 +20303,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4; (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5; - /* "View.MemoryView":916 + /* "View.MemoryView":911 * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< @@ -18947,36 +20315,38 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5; (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4; - /* "View.MemoryView":918 + /* "View.MemoryView":913 * shape[i], shape[j] = shape[j], shape[i] * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * */ - __pyx_t_6 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); - if (!__pyx_t_6) { - __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); - __pyx_t_8 = __pyx_t_7; + __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); + if (!__pyx_t_7) { } else { - __pyx_t_8 = __pyx_t_6; + __pyx_t_6 = __pyx_t_7; + goto __pyx_L6_bool_binop_done; } - if (__pyx_t_8) { + __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); + __pyx_t_6 = __pyx_t_7; + __pyx_L6_bool_binop_done:; + if (__pyx_t_6) { - /* "View.MemoryView":919 + /* "View.MemoryView":914 * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< * * return 1 */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_75); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; } - /* "View.MemoryView":921 + /* "View.MemoryView":916 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * * return 1 # <<<<<<<<<<<<<< @@ -18986,8 +20356,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_r = 1; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":900 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim + * + */ + + /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD @@ -19003,28 +20380,30 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { return __pyx_r; } +/* "View.MemoryView":933 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + * + */ + /* Python wrapper */ static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":938 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - */ - static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":939 + /* "View.MemoryView":934 * * def __dealloc__(self): * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< @@ -19033,10 +20412,19 @@ static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(stru */ __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); + /* "View.MemoryView":933 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + * + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":941 +/* "View.MemoryView":936 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -19054,7 +20442,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "View.MemoryView":942 + /* "View.MemoryView":937 * * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: # <<<<<<<<<<<<<< @@ -19064,7 +20452,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":943 + /* "View.MemoryView":938 * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: * return self.to_object_func(itemp) # <<<<<<<<<<<<<< @@ -19072,16 +20460,15 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor * return memoryview.convert_item_to_object(self, itemp) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":945 + /* "View.MemoryView":940 * return self.to_object_func(itemp) * else: * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< @@ -19089,16 +20476,22 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor * cdef assign_item_from_object(self, char *itemp, object value): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_vtabptr_memoryview->convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; } - __pyx_L3:; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":936 + * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -19109,7 +20502,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor return __pyx_r; } -/* "View.MemoryView":947 +/* "View.MemoryView":942 * return memoryview.convert_item_to_object(self, itemp) * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -19128,7 +20521,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":948 + /* "View.MemoryView":943 * * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< @@ -19138,31 +20531,40 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":949 + /* "View.MemoryView":944 * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< * else: * memoryview.assign_item_from_object(self, itemp, value) */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":951 + /* "View.MemoryView":946 * self.to_dtype_func(itemp, value) * else: * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * * property base: */ - __pyx_t_3 = __pyx_vtabptr_memoryview->assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_L3:; + /* "View.MemoryView":942 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -19175,6 +20577,14 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo return __pyx_r; } +/* "View.MemoryView":950 + * property base: + * @cname('__pyx_memoryviewslice__get__base') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.from_object + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self) { @@ -19182,24 +20592,18 @@ static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":955 - * property base: - * @cname('__pyx_memoryviewslice__get__base') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.from_object - * - */ - static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":956 + /* "View.MemoryView":951 * @cname('__pyx_memoryviewslice__get__base') * def __get__(self): * return self.from_object # <<<<<<<<<<<<<< @@ -19211,14 +20615,22 @@ static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_ __pyx_r = __pyx_v_self->from_object; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "View.MemoryView":950 + * property base: + * @cname('__pyx_memoryviewslice__get__base') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.from_object + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":962 +/* "View.MemoryView":957 * * @cname('__pyx_memoryview_fromslice') * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< @@ -19244,7 +20656,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - /* "View.MemoryView":971 + /* "View.MemoryView":966 * cdef int i * * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< @@ -19254,7 +20666,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); if (__pyx_t_1) { - /* "View.MemoryView":972 + /* "View.MemoryView":967 * * if memviewslice.memview == Py_None: * return None # <<<<<<<<<<<<<< @@ -19265,20 +20677,18 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "View.MemoryView":977 + /* "View.MemoryView":972 * * * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< * * result.from_slice = memviewslice */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); @@ -19289,13 +20699,13 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryviewslice_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryviewslice_type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":979 + /* "View.MemoryView":974 * result = _memoryviewslice(None, 0, dtype_is_object) * * result.from_slice = memviewslice # <<<<<<<<<<<<<< @@ -19304,7 +20714,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "View.MemoryView":980 + /* "View.MemoryView":975 * * result.from_slice = memviewslice * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< @@ -19313,14 +20723,14 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "View.MemoryView":982 + /* "View.MemoryView":977 * __PYX_INC_MEMVIEW(&memviewslice, 1) * * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< * result.typeinfo = memviewslice.memview.typeinfo * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_result->from_object); @@ -19328,7 +20738,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_v_result->from_object = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":983 + /* "View.MemoryView":978 * * result.from_object = ( memviewslice.memview).base * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< @@ -19338,7 +20748,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* "View.MemoryView":985 + /* "View.MemoryView":980 * result.typeinfo = memviewslice.memview.typeinfo * * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< @@ -19348,7 +20758,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_5 = __pyx_v_memviewslice.memview->view; __pyx_v_result->__pyx_base.view = __pyx_t_5; - /* "View.MemoryView":986 + /* "View.MemoryView":981 * * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< @@ -19357,7 +20767,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* "View.MemoryView":987 + /* "View.MemoryView":982 * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data * result.view.ndim = ndim # <<<<<<<<<<<<<< @@ -19366,7 +20776,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* "View.MemoryView":988 + /* "View.MemoryView":983 * result.view.buf = memviewslice.data * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< @@ -19375,7 +20785,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - /* "View.MemoryView":989 + /* "View.MemoryView":984 * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -19384,7 +20794,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ Py_INCREF(Py_None); - /* "View.MemoryView":991 + /* "View.MemoryView":986 * Py_INCREF(Py_None) * * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< @@ -19393,7 +20803,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - /* "View.MemoryView":993 + /* "View.MemoryView":988 * result.flags = PyBUF_RECORDS * * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< @@ -19402,7 +20812,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - /* "View.MemoryView":994 + /* "View.MemoryView":989 * * result.view.shape = result.from_slice.shape * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< @@ -19411,7 +20821,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - /* "View.MemoryView":995 + /* "View.MemoryView":990 * result.view.shape = result.from_slice.shape * result.view.strides = result.from_slice.strides * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< @@ -19420,7 +20830,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* "View.MemoryView":997 + /* "View.MemoryView":992 * result.view.suboffsets = result.from_slice.suboffsets * * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< @@ -19430,7 +20840,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize; __pyx_v_result->__pyx_base.view.len = __pyx_t_6; - /* "View.MemoryView":998 + /* "View.MemoryView":993 * * result.view.len = result.view.itemsize * for i in range(ndim): # <<<<<<<<<<<<<< @@ -19441,7 +20851,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "View.MemoryView":999 + /* "View.MemoryView":994 * result.view.len = result.view.itemsize * for i in range(ndim): * result.view.len *= result.view.shape[i] # <<<<<<<<<<<<<< @@ -19451,7 +20861,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_v_result->__pyx_base.view.len = (__pyx_v_result->__pyx_base.view.len * (__pyx_v_result->__pyx_base.view.shape[__pyx_v_i])); } - /* "View.MemoryView":1001 + /* "View.MemoryView":996 * result.view.len *= result.view.shape[i] * * result.to_object_func = to_object_func # <<<<<<<<<<<<<< @@ -19460,7 +20870,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->to_object_func = __pyx_v_to_object_func; - /* "View.MemoryView":1002 + /* "View.MemoryView":997 * * result.to_object_func = to_object_func * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< @@ -19469,7 +20879,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - /* "View.MemoryView":1004 + /* "View.MemoryView":999 * result.to_dtype_func = to_dtype_func * * return result # <<<<<<<<<<<<<< @@ -19481,21 +20891,28 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; + /* "View.MemoryView":957 + * + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1007 +/* "View.MemoryView":1002 * * @cname('__pyx_memoryview_get_slice_from_memoryview') * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< @@ -19509,12 +20926,13 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - /* "View.MemoryView":1010 + /* "View.MemoryView":1005 * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -19525,18 +20943,20 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":1011 + /* "View.MemoryView":1006 * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): * obj = memview # <<<<<<<<<<<<<< * return &obj.from_slice * else: */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(((PyObject *)__pyx_v_memview)); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview); + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":1012 + /* "View.MemoryView":1007 * if isinstance(memview, _memoryviewslice): * obj = memview * return &obj.from_slice # <<<<<<<<<<<<<< @@ -19545,11 +20965,10 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p */ __pyx_r = (&__pyx_v_obj->from_slice); goto __pyx_L0; - goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":1014 + /* "View.MemoryView":1009 * return &obj.from_slice * else: * slice_copy(memview, mslice) # <<<<<<<<<<<<<< @@ -19558,7 +20977,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p */ __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - /* "View.MemoryView":1015 + /* "View.MemoryView":1010 * else: * slice_copy(memview, mslice) * return mslice # <<<<<<<<<<<<<< @@ -19568,12 +20987,19 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p __pyx_r = __pyx_v_mslice; goto __pyx_L0; } - __pyx_L3:; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1002 + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice): + * cdef _memoryviewslice obj + */ + + /* function exit code */ __pyx_L1_error:; - __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_obj); @@ -19581,12 +21007,12 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p return __pyx_r; } -/* "View.MemoryView":1018 +/* "View.MemoryView":1013 * * @cname('__pyx_memoryview_slice_copy') * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< * cdef int dim - * cdef Py_ssize_t *shape, *strides, *suboffsets + * cdef (Py_ssize_t*) shape, strides, suboffsets */ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { @@ -19601,8 +21027,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem int __pyx_t_4; __Pyx_RefNannySetupContext("slice_copy", 0); - /* "View.MemoryView":1022 - * cdef Py_ssize_t *shape, *strides, *suboffsets + /* "View.MemoryView":1017 + * cdef (Py_ssize_t*) shape, strides, suboffsets * * shape = memview.view.shape # <<<<<<<<<<<<<< * strides = memview.view.strides @@ -19611,7 +21037,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_1 = __pyx_v_memview->view.shape; __pyx_v_shape = __pyx_t_1; - /* "View.MemoryView":1023 + /* "View.MemoryView":1018 * * shape = memview.view.shape * strides = memview.view.strides # <<<<<<<<<<<<<< @@ -19621,7 +21047,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_1 = __pyx_v_memview->view.strides; __pyx_v_strides = __pyx_t_1; - /* "View.MemoryView":1024 + /* "View.MemoryView":1019 * shape = memview.view.shape * strides = memview.view.strides * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< @@ -19631,7 +21057,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_1 = __pyx_v_memview->view.suboffsets; __pyx_v_suboffsets = __pyx_t_1; - /* "View.MemoryView":1026 + /* "View.MemoryView":1021 * suboffsets = memview.view.suboffsets * * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< @@ -19640,7 +21066,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - /* "View.MemoryView":1027 + /* "View.MemoryView":1022 * * dst.memview = <__pyx_memoryview *> memview * dst.data = memview.view.buf # <<<<<<<<<<<<<< @@ -19649,7 +21075,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* "View.MemoryView":1029 + /* "View.MemoryView":1024 * dst.data = memview.view.buf * * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< @@ -19660,7 +21086,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_dim = __pyx_t_3; - /* "View.MemoryView":1030 + /* "View.MemoryView":1025 * * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< @@ -19669,7 +21095,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - /* "View.MemoryView":1031 + /* "View.MemoryView":1026 * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< @@ -19678,7 +21104,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - /* "View.MemoryView":1032 + /* "View.MemoryView":1027 * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] * if suboffsets == NULL: # <<<<<<<<<<<<<< @@ -19688,7 +21114,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0); if (__pyx_t_4) { - /* "View.MemoryView":1033 + /* "View.MemoryView":1028 * dst.strides[dim] = strides[dim] * if suboffsets == NULL: * dst.suboffsets[dim] = -1 # <<<<<<<<<<<<<< @@ -19700,7 +21126,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem } /*else*/ { - /* "View.MemoryView":1035 + /* "View.MemoryView":1030 * dst.suboffsets[dim] = -1 * else: * dst.suboffsets[dim] = suboffsets[dim] # <<<<<<<<<<<<<< @@ -19712,10 +21138,19 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_L5:; } + /* "View.MemoryView":1013 + * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":1038 +/* "View.MemoryView":1033 * * @cname('__pyx_memoryview_copy_object') * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< @@ -19733,7 +21168,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* "View.MemoryView":1041 + /* "View.MemoryView":1036 * "Create a new memoryview object" * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< @@ -19742,7 +21177,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx */ __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - /* "View.MemoryView":1042 + /* "View.MemoryView":1037 * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< @@ -19750,14 +21185,21 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx * @cname('__pyx_memoryview_copy_object_from_slice') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":1033 + * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -19768,7 +21210,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx return __pyx_r; } -/* "View.MemoryView":1045 +/* "View.MemoryView":1040 * * @cname('__pyx_memoryview_copy_object_from_slice') * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< @@ -19791,7 +21233,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "View.MemoryView":1052 + /* "View.MemoryView":1047 * cdef int (*to_dtype_func)(char *, object) except 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -19802,7 +21244,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":1053 + /* "View.MemoryView":1048 * * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< @@ -19812,7 +21254,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; __pyx_v_to_object_func = __pyx_t_3; - /* "View.MemoryView":1054 + /* "View.MemoryView":1049 * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< @@ -19825,7 +21267,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview } /*else*/ { - /* "View.MemoryView":1056 + /* "View.MemoryView":1051 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func * else: * to_object_func = NULL # <<<<<<<<<<<<<< @@ -19834,7 +21276,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview */ __pyx_v_to_object_func = NULL; - /* "View.MemoryView":1057 + /* "View.MemoryView":1052 * else: * to_object_func = NULL * to_dtype_func = NULL # <<<<<<<<<<<<<< @@ -19845,7 +21287,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview } __pyx_L3:; - /* "View.MemoryView":1059 + /* "View.MemoryView":1054 * to_dtype_func = NULL * * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< @@ -19854,21 +21296,28 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview */ __Pyx_XDECREF(__pyx_r); - /* "View.MemoryView":1061 + /* "View.MemoryView":1056 * return memoryview_fromslice(memviewslice[0], memview.view.ndim, * to_object_func, to_dtype_func, * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":1040 + * + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -19879,7 +21328,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview return __pyx_r; } -/* "View.MemoryView":1067 +/* "View.MemoryView":1062 * * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< @@ -19891,7 +21340,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { Py_ssize_t __pyx_r; int __pyx_t_1; - /* "View.MemoryView":1068 + /* "View.MemoryView":1063 * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: # <<<<<<<<<<<<<< @@ -19901,7 +21350,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { __pyx_t_1 = ((__pyx_v_arg < 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1069 + /* "View.MemoryView":1064 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: * return -arg # <<<<<<<<<<<<<< @@ -19910,11 +21359,10 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { */ __pyx_r = (-__pyx_v_arg); goto __pyx_L0; - goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":1071 + /* "View.MemoryView":1066 * return -arg * else: * return arg # <<<<<<<<<<<<<< @@ -19924,14 +21372,21 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { __pyx_r = __pyx_v_arg; goto __pyx_L0; } - __pyx_L3:; - __pyx_r = 0; + /* "View.MemoryView":1062 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< + * if arg < 0: + * return -arg + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "View.MemoryView":1074 +/* "View.MemoryView":1069 * * @cname('__pyx_get_best_slice_order') * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< @@ -19948,7 +21403,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":1079 + /* "View.MemoryView":1074 * """ * cdef int i * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< @@ -19957,7 +21412,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_c_stride = 0; - /* "View.MemoryView":1080 + /* "View.MemoryView":1075 * cdef int i * cdef Py_ssize_t c_stride = 0 * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< @@ -19966,7 +21421,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_f_stride = 0; - /* "View.MemoryView":1082 + /* "View.MemoryView":1077 * cdef Py_ssize_t f_stride = 0 * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -19976,7 +21431,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":1083 + /* "View.MemoryView":1078 * * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -19986,7 +21441,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1084 + /* "View.MemoryView":1079 * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< @@ -19995,7 +21450,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":1085 + /* "View.MemoryView":1080 * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< @@ -20003,13 +21458,11 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ * for i in range(ndim): */ goto __pyx_L4_break; - goto __pyx_L5; } - __pyx_L5:; } __pyx_L4_break:; - /* "View.MemoryView":1087 + /* "View.MemoryView":1082 * break * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -20020,7 +21473,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1088 + /* "View.MemoryView":1083 * * for i in range(ndim): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -20030,7 +21483,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1089 + /* "View.MemoryView":1084 * for i in range(ndim): * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< @@ -20039,7 +21492,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":1090 + /* "View.MemoryView":1085 * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< @@ -20047,13 +21500,11 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): */ goto __pyx_L7_break; - goto __pyx_L8; } - __pyx_L8:; } __pyx_L7_break:; - /* "View.MemoryView":1092 + /* "View.MemoryView":1087 * break * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< @@ -20063,7 +21514,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1093 + /* "View.MemoryView":1088 * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): * return 'C' # <<<<<<<<<<<<<< @@ -20072,11 +21523,10 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_r = 'C'; goto __pyx_L0; - goto __pyx_L9; } /*else*/ { - /* "View.MemoryView":1095 + /* "View.MemoryView":1090 * return 'C' * else: * return 'F' # <<<<<<<<<<<<<< @@ -20086,14 +21536,21 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_r = 'F'; goto __pyx_L0; } - __pyx_L9:; - __pyx_r = 0; + /* "View.MemoryView":1069 + * + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "View.MemoryView":1098 +/* "View.MemoryView":1093 * * @cython.cdivision(True) * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< @@ -20110,11 +21567,10 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - int __pyx_t_4; + Py_ssize_t __pyx_t_4; Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - /* "View.MemoryView":1105 + /* "View.MemoryView":1100 * * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< @@ -20123,7 +21579,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_extent = (__pyx_v_src_shape[0]); - /* "View.MemoryView":1106 + /* "View.MemoryView":1101 * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< @@ -20132,7 +21588,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - /* "View.MemoryView":1107 + /* "View.MemoryView":1102 * cdef Py_ssize_t src_extent = src_shape[0] * cdef Py_ssize_t dst_extent = dst_shape[0] * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< @@ -20141,7 +21597,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_stride = (__pyx_v_src_strides[0]); - /* "View.MemoryView":1108 + /* "View.MemoryView":1103 * cdef Py_ssize_t dst_extent = dst_shape[0] * cdef Py_ssize_t src_stride = src_strides[0] * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< @@ -20150,7 +21606,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - /* "View.MemoryView":1110 + /* "View.MemoryView":1105 * cdef Py_ssize_t dst_stride = dst_strides[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -20160,40 +21616,43 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1111 + /* "View.MemoryView":1106 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< * src_stride == itemsize == dst_stride): * memcpy(dst_data, src_data, itemsize * dst_extent) */ - __pyx_t_1 = ((__pyx_v_src_stride > 0) != 0); - if (__pyx_t_1) { - __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); - if (__pyx_t_2) { + __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } - /* "View.MemoryView":1112 + /* "View.MemoryView":1107 * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< * memcpy(dst_data, src_data, itemsize * dst_extent) * else: */ - __pyx_t_3 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_3) { - __pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); - } - __pyx_t_4 = (__pyx_t_3 != 0); - } else { - __pyx_t_4 = __pyx_t_2; - } - __pyx_t_2 = __pyx_t_4; - } else { - __pyx_t_2 = __pyx_t_1; - } + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_3 = (__pyx_t_2 != 0); + __pyx_t_1 = __pyx_t_3; + __pyx_L5_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":1113 + /* "View.MemoryView":1108 * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< @@ -20205,18 +21664,18 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } /*else*/ { - /* "View.MemoryView":1115 + /* "View.MemoryView":1110 * memcpy(dst_data, src_data, itemsize * dst_extent) * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< * memcpy(dst_data, src_data, itemsize) * src_data += src_stride */ - __pyx_t_5 = __pyx_v_dst_extent; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_4 = __pyx_v_dst_extent; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":1116 + /* "View.MemoryView":1111 * else: * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< @@ -20225,7 +21684,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize); - /* "View.MemoryView":1117 + /* "View.MemoryView":1112 * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< @@ -20234,7 +21693,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":1118 + /* "View.MemoryView":1113 * memcpy(dst_data, src_data, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< @@ -20249,27 +21708,27 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } /*else*/ { - /* "View.MemoryView":1120 + /* "View.MemoryView":1115 * dst_data += dst_stride * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< * _copy_strided_to_strided(src_data, src_strides + 1, * dst_data, dst_strides + 1, */ - __pyx_t_5 = __pyx_v_dst_extent; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_4 = __pyx_v_dst_extent; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":1124 + /* "View.MemoryView":1116 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< * dst_data, dst_strides + 1, * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride */ _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - /* "View.MemoryView":1125 + /* "View.MemoryView":1120 * src_shape + 1, dst_shape + 1, * ndim - 1, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< @@ -20278,7 +21737,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":1126 + /* "View.MemoryView":1121 * ndim - 1, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< @@ -20290,9 +21749,18 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } __pyx_L3:; + /* "View.MemoryView":1093 + * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + */ + + /* function exit code */ } -/* "View.MemoryView":1128 +/* "View.MemoryView":1123 * dst_data += dst_stride * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -20302,18 +21770,27 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - /* "View.MemoryView":1132 + /* "View.MemoryView":1126 + * __Pyx_memviewslice *dst, * int ndim, size_t itemsize) nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, - * src.shape, dst.shape, ndim, itemsize) # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) * - * @cname('__pyx_memoryview_slice_get_size') */ _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + /* "View.MemoryView":1123 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) nogil: + */ + + /* function exit code */ } -/* "View.MemoryView":1135 +/* "View.MemoryView":1130 * * @cname('__pyx_memoryview_slice_get_size') * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< @@ -20329,7 +21806,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":1138 + /* "View.MemoryView":1133 * "Return the size of the memory occupied by the slice in number of bytes" * cdef int i * cdef Py_ssize_t size = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -20339,7 +21816,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_t_1 = __pyx_v_src->memview->view.itemsize; __pyx_v_size = __pyx_t_1; - /* "View.MemoryView":1140 + /* "View.MemoryView":1135 * cdef Py_ssize_t size = src.memview.view.itemsize * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -20350,7 +21827,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1141 + /* "View.MemoryView":1136 * * for i in range(ndim): * size *= src.shape[i] # <<<<<<<<<<<<<< @@ -20360,7 +21837,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i])); } - /* "View.MemoryView":1143 + /* "View.MemoryView":1138 * size *= src.shape[i] * * return size # <<<<<<<<<<<<<< @@ -20370,12 +21847,20 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_r = __pyx_v_size; goto __pyx_L0; - __pyx_r = 0; + /* "View.MemoryView":1130 + * + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef int i + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "View.MemoryView":1146 +/* "View.MemoryView":1141 * * @cname('__pyx_fill_contig_strides_array') * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< @@ -20390,7 +21875,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":1155 + /* "View.MemoryView":1150 * cdef int idx * * if order == 'F': # <<<<<<<<<<<<<< @@ -20400,7 +21885,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ __pyx_t_1 = ((__pyx_v_order == 'F') != 0); if (__pyx_t_1) { - /* "View.MemoryView":1156 + /* "View.MemoryView":1151 * * if order == 'F': * for idx in range(ndim): # <<<<<<<<<<<<<< @@ -20411,7 +21896,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_idx = __pyx_t_3; - /* "View.MemoryView":1157 + /* "View.MemoryView":1152 * if order == 'F': * for idx in range(ndim): * strides[idx] = stride # <<<<<<<<<<<<<< @@ -20420,7 +21905,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ */ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":1158 + /* "View.MemoryView":1153 * for idx in range(ndim): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< @@ -20433,7 +21918,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ } /*else*/ { - /* "View.MemoryView":1160 + /* "View.MemoryView":1155 * stride = stride * shape[idx] * else: * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -20443,7 +21928,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { __pyx_v_idx = __pyx_t_2; - /* "View.MemoryView":1161 + /* "View.MemoryView":1156 * else: * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride # <<<<<<<<<<<<<< @@ -20452,7 +21937,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ */ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":1162 + /* "View.MemoryView":1157 * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< @@ -20464,7 +21949,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ } __pyx_L3:; - /* "View.MemoryView":1164 + /* "View.MemoryView":1159 * stride = stride * shape[idx] * * return stride # <<<<<<<<<<<<<< @@ -20474,12 +21959,20 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ __pyx_r = __pyx_v_stride; goto __pyx_L0; - __pyx_r = 0; + /* "View.MemoryView":1141 + * + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) nogil: + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "View.MemoryView":1167 +/* "View.MemoryView":1162 * * @cname('__pyx_memoryview_copy_data_to_temp') * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -20502,7 +21995,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, const char *__pyx_filename = NULL; int __pyx_clineno = 0; - /* "View.MemoryView":1178 + /* "View.MemoryView":1173 * cdef void *result * * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -20512,7 +22005,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_1 = __pyx_v_src->memview->view.itemsize; __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":1179 + /* "View.MemoryView":1174 * * cdef size_t itemsize = src.memview.view.itemsize * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< @@ -20521,7 +22014,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* "View.MemoryView":1181 + /* "View.MemoryView":1176 * cdef size_t size = slice_get_size(src, ndim) * * result = malloc(size) # <<<<<<<<<<<<<< @@ -20530,7 +22023,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_result = malloc(__pyx_v_size); - /* "View.MemoryView":1182 + /* "View.MemoryView":1177 * * result = malloc(size) * if not result: # <<<<<<<<<<<<<< @@ -20540,19 +22033,19 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1183 + /* "View.MemoryView":1178 * result = malloc(size) * if not result: * _err(MemoryError, NULL) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[3]; __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[3]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "View.MemoryView":1186 + /* "View.MemoryView":1181 * * * tmpslice.data = result # <<<<<<<<<<<<<< @@ -20561,7 +22054,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "View.MemoryView":1187 + /* "View.MemoryView":1182 * * tmpslice.data = result * tmpslice.memview = src.memview # <<<<<<<<<<<<<< @@ -20571,7 +22064,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_4 = __pyx_v_src->memview; __pyx_v_tmpslice->memview = __pyx_t_4; - /* "View.MemoryView":1188 + /* "View.MemoryView":1183 * tmpslice.data = result * tmpslice.memview = src.memview * for i in range(ndim): # <<<<<<<<<<<<<< @@ -20582,7 +22075,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":1189 + /* "View.MemoryView":1184 * tmpslice.memview = src.memview * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< @@ -20591,7 +22084,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - /* "View.MemoryView":1190 + /* "View.MemoryView":1185 * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< @@ -20601,16 +22094,16 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1; } - /* "View.MemoryView":1193 - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, - * ndim, order) # <<<<<<<<<<<<<< + /* "View.MemoryView":1187 + * tmpslice.suboffsets[i] = -1 * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< + * ndim, order) * */ __pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order); - /* "View.MemoryView":1196 + /* "View.MemoryView":1191 * * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -20621,7 +22114,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":1197 + /* "View.MemoryView":1192 * * for i in range(ndim): * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< @@ -20631,7 +22124,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1198 + /* "View.MemoryView":1193 * for i in range(ndim): * if tmpslice.shape[i] == 1: * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< @@ -20644,7 +22137,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_L8:; } - /* "View.MemoryView":1200 + /* "View.MemoryView":1195 * tmpslice.strides[i] = 0 * * if slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< @@ -20654,7 +22147,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1201 + /* "View.MemoryView":1196 * * if slice_is_contig(src, order, ndim): * memcpy(result, src.data, size) # <<<<<<<<<<<<<< @@ -20666,7 +22159,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, } /*else*/ { - /* "View.MemoryView":1203 + /* "View.MemoryView":1198 * memcpy(result, src.data, size) * else: * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< @@ -20677,7 +22170,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, } __pyx_L9:; - /* "View.MemoryView":1205 + /* "View.MemoryView":1200 * copy_strided_to_strided(src, tmpslice, ndim, itemsize) * * return result # <<<<<<<<<<<<<< @@ -20687,8 +22180,15 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_r = __pyx_v_result; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1162 + * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, + */ + + /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD @@ -20704,7 +22204,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, return __pyx_r; } -/* "View.MemoryView":1210 +/* "View.MemoryView":1205 * * @cname('__pyx_memoryview_err_extents') * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< @@ -20727,20 +22227,20 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent #endif __Pyx_RefNannySetupContext("_err_extents", 0); - /* "View.MemoryView":1213 + /* "View.MemoryView":1208 * Py_ssize_t extent2) except -1 with gil: * raise ValueError("got differing extents in dimension %d (got %d and %d)" % * (i, extent1, extent2)) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_err_dim') */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1208; __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); @@ -20751,23 +22251,38 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_76), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "View.MemoryView":1207 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< + * (i, extent1, extent2)) + * + */ + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1207; __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[3]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1205 + * + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -20775,7 +22290,6 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __pyx_L0:; __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); @@ -20783,7 +22297,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent return __pyx_r; } -/* "View.MemoryView":1216 +/* "View.MemoryView":1211 * * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< @@ -20797,6 +22311,8 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -20806,42 +22322,69 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, __Pyx_RefNannySetupContext("_err_dim", 0); __Pyx_INCREF(__pyx_v_error); - /* "View.MemoryView":1217 + /* "View.MemoryView":1212 * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_err') */ - __pyx_t_1 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_t_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_v_error, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_error); + __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1211 + * + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error(msg.decode('ascii') % dim) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __pyx_L0:; __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD @@ -20850,7 +22393,7 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, return __pyx_r; } -/* "View.MemoryView":1220 +/* "View.MemoryView":1215 * * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< @@ -20864,6 +22407,9 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -20873,7 +22419,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __Pyx_RefNannySetupContext("_err", 0); __Pyx_INCREF(__pyx_v_error); - /* "View.MemoryView":1221 + /* "View.MemoryView":1216 * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: # <<<<<<<<<<<<<< @@ -20883,31 +22429,49 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1222 + /* "View.MemoryView":1217 * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< * else: * raise error */ - __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __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_v_error, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_v_error); + __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __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 = NULL; + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } /*else*/ { - /* "View.MemoryView":1224 + /* "View.MemoryView":1219 * raise error(msg.decode('ascii')) * else: * raise error # <<<<<<<<<<<<<< @@ -20915,18 +22479,26 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { * @cname('__pyx_memoryview_copy_contents') */ __Pyx_Raise(__pyx_v_error, 0, 0, 0); - {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1215 + * + * @cname('__pyx_memoryview_err') + * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< + * if msg != NULL: + * raise error(msg.decode('ascii')) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __pyx_L0:; __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD @@ -20935,7 +22507,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { return __pyx_r; } -/* "View.MemoryView":1227 +/* "View.MemoryView":1222 * * @cname('__pyx_memoryview_copy_contents') * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< @@ -20964,7 +22536,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ const char *__pyx_filename = NULL; int __pyx_clineno = 0; - /* "View.MemoryView":1235 + /* "View.MemoryView":1230 * Check for overlapping memory and verify the shapes. * """ * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< @@ -20973,7 +22545,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_tmpdata = NULL; - /* "View.MemoryView":1236 + /* "View.MemoryView":1231 * """ * cdef void *tmpdata = NULL * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -20983,7 +22555,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_1 = __pyx_v_src.memview->view.itemsize; __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":1238 + /* "View.MemoryView":1233 * cdef size_t itemsize = src.memview.view.itemsize * cdef int i * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< @@ -20992,7 +22564,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - /* "View.MemoryView":1239 + /* "View.MemoryView":1234 * cdef int i * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False # <<<<<<<<<<<<<< @@ -21001,7 +22573,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_broadcasting = 0; - /* "View.MemoryView":1240 + /* "View.MemoryView":1235 * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False * cdef bint direct_copy = False # <<<<<<<<<<<<<< @@ -21010,7 +22582,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_direct_copy = 0; - /* "View.MemoryView":1243 + /* "View.MemoryView":1238 * cdef __Pyx_memviewslice tmp * * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< @@ -21020,7 +22592,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1244 + /* "View.MemoryView":1239 * * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< @@ -21031,7 +22603,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L3; } - /* "View.MemoryView":1245 + /* "View.MemoryView":1240 * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< @@ -21041,7 +22613,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1246 + /* "View.MemoryView":1241 * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< @@ -21053,7 +22625,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L3:; - /* "View.MemoryView":1248 + /* "View.MemoryView":1243 * broadcast_leading(&dst, dst_ndim, src_ndim) * * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< @@ -21069,7 +22641,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_v_ndim = __pyx_t_5; - /* "View.MemoryView":1250 + /* "View.MemoryView":1245 * cdef int ndim = max(src_ndim, dst_ndim) * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -21080,7 +22652,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1251 + /* "View.MemoryView":1246 * * for i in range(ndim): * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< @@ -21090,7 +22662,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1252 + /* "View.MemoryView":1247 * for i in range(ndim): * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: # <<<<<<<<<<<<<< @@ -21100,7 +22672,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1253 + /* "View.MemoryView":1248 * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: * broadcasting = True # <<<<<<<<<<<<<< @@ -21109,7 +22681,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_broadcasting = 1; - /* "View.MemoryView":1254 + /* "View.MemoryView":1249 * if src.shape[i] == 1: * broadcasting = True * src.strides[i] = 0 # <<<<<<<<<<<<<< @@ -21121,21 +22693,21 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } /*else*/ { - /* "View.MemoryView":1256 + /* "View.MemoryView":1251 * src.strides[i] = 0 * else: * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * * if src.suboffsets[i] >= 0: */ - __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __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[3]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L7:; goto __pyx_L6; } __pyx_L6:; - /* "View.MemoryView":1258 + /* "View.MemoryView":1253 * _err_extents(i, dst.shape[i], src.shape[i]) * * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< @@ -21145,20 +22717,20 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1259 + /* "View.MemoryView":1254 * * if src.suboffsets[i] >= 0: * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< * * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_77, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; } - /* "View.MemoryView":1261 + /* "View.MemoryView":1256 * _err_dim(ValueError, "Dimension %d is not direct", i) * * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< @@ -21168,7 +22740,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1263 + /* "View.MemoryView":1258 * if slices_overlap(&src, &dst, ndim, itemsize): * * if not slice_is_contig(&src, order, ndim): # <<<<<<<<<<<<<< @@ -21178,7 +22750,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1264 + /* "View.MemoryView":1259 * * if not slice_is_contig(&src, order, ndim): * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< @@ -21190,17 +22762,17 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L10:; - /* "View.MemoryView":1266 + /* "View.MemoryView":1261 * order = get_best_order(&dst, ndim) * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< * src = tmp * */ - __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_tmpdata = __pyx_t_6; - /* "View.MemoryView":1267 + /* "View.MemoryView":1262 * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) * src = tmp # <<<<<<<<<<<<<< @@ -21212,7 +22784,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L9:; - /* "View.MemoryView":1269 + /* "View.MemoryView":1264 * src = tmp * * if not broadcasting: # <<<<<<<<<<<<<< @@ -21222,7 +22794,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1272 + /* "View.MemoryView":1267 * * * if slice_is_contig(&src, 'C', ndim): # <<<<<<<<<<<<<< @@ -21232,7 +22804,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1273 + /* "View.MemoryView":1268 * * if slice_is_contig(&src, 'C', ndim): * direct_copy = slice_is_contig(&dst, 'C', ndim) # <<<<<<<<<<<<<< @@ -21243,7 +22815,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L12; } - /* "View.MemoryView":1274 + /* "View.MemoryView":1269 * if slice_is_contig(&src, 'C', ndim): * direct_copy = slice_is_contig(&dst, 'C', ndim) * elif slice_is_contig(&src, 'F', ndim): # <<<<<<<<<<<<<< @@ -21253,7 +22825,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1275 + /* "View.MemoryView":1270 * direct_copy = slice_is_contig(&dst, 'C', ndim) * elif slice_is_contig(&src, 'F', ndim): * direct_copy = slice_is_contig(&dst, 'F', ndim) # <<<<<<<<<<<<<< @@ -21265,7 +22837,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L12:; - /* "View.MemoryView":1277 + /* "View.MemoryView":1272 * direct_copy = slice_is_contig(&dst, 'F', ndim) * * if direct_copy: # <<<<<<<<<<<<<< @@ -21275,7 +22847,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_v_direct_copy != 0); if (__pyx_t_2) { - /* "View.MemoryView":1279 + /* "View.MemoryView":1274 * if direct_copy: * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -21284,41 +22856,48 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1280 + /* "View.MemoryView":1275 * * refcount_copying(&dst, dtype_is_object, ndim, False) * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< * refcount_copying(&dst, dtype_is_object, ndim, True) - * return 0 + * free(tmpdata) */ memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)); - /* "View.MemoryView":1281 + /* "View.MemoryView":1276 * refcount_copying(&dst, dtype_is_object, ndim, False) * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< + * free(tmpdata) * return 0 - * */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":1282 + /* "View.MemoryView":1277 * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * + */ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1278 + * refcount_copying(&dst, dtype_is_object, ndim, True) + * free(tmpdata) * return 0 # <<<<<<<<<<<<<< * * if order == 'F' == get_best_order(&dst, ndim): */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; } - __pyx_L13:; goto __pyx_L11; } __pyx_L11:; - /* "View.MemoryView":1284 + /* "View.MemoryView":1280 * return 0 * * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< @@ -21332,28 +22911,28 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_7 = (__pyx_t_2 != 0); if (__pyx_t_7) { - /* "View.MemoryView":1287 + /* "View.MemoryView":1283 * * * transpose_memslice(&src) # <<<<<<<<<<<<<< * transpose_memslice(&dst) * */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[3]; __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[3]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":1288 + /* "View.MemoryView":1284 * * transpose_memslice(&src) * transpose_memslice(&dst) # <<<<<<<<<<<<<< * * refcount_copying(&dst, dtype_is_object, ndim, False) */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[3]; __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[3]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; - /* "View.MemoryView":1290 + /* "View.MemoryView":1286 * transpose_memslice(&dst) * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -21362,7 +22941,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1291 + /* "View.MemoryView":1287 * * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< @@ -21371,7 +22950,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":1292 + /* "View.MemoryView":1288 * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -21380,7 +22959,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":1294 + /* "View.MemoryView":1290 * refcount_copying(&dst, dtype_is_object, ndim, True) * * free(tmpdata) # <<<<<<<<<<<<<< @@ -21389,7 +22968,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ free(__pyx_v_tmpdata); - /* "View.MemoryView":1295 + /* "View.MemoryView":1291 * * free(tmpdata) * return 0 # <<<<<<<<<<<<<< @@ -21399,8 +22978,15 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1222 + * + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, + */ + + /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD @@ -21416,7 +23002,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ return __pyx_r; } -/* "View.MemoryView":1298 +/* "View.MemoryView":1294 * * @cname('__pyx_memoryview_broadcast_leading') * cdef void broadcast_leading(__Pyx_memviewslice *slice, # <<<<<<<<<<<<<< @@ -21430,7 +23016,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice int __pyx_t_1; int __pyx_t_2; - /* "View.MemoryView":1302 + /* "View.MemoryView":1298 * int ndim_other) nogil: * cdef int i * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< @@ -21439,7 +23025,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "View.MemoryView":1304 + /* "View.MemoryView":1300 * cdef int offset = ndim_other - ndim * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -21449,7 +23035,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":1305 + /* "View.MemoryView":1301 * * for i in range(ndim - 1, -1, -1): * slice.shape[i + offset] = slice.shape[i] # <<<<<<<<<<<<<< @@ -21458,7 +23044,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ (__pyx_v_slice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_slice->shape[__pyx_v_i]); - /* "View.MemoryView":1306 + /* "View.MemoryView":1302 * for i in range(ndim - 1, -1, -1): * slice.shape[i + offset] = slice.shape[i] * slice.strides[i + offset] = slice.strides[i] # <<<<<<<<<<<<<< @@ -21467,7 +23053,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ (__pyx_v_slice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_slice->strides[__pyx_v_i]); - /* "View.MemoryView":1307 + /* "View.MemoryView":1303 * slice.shape[i + offset] = slice.shape[i] * slice.strides[i + offset] = slice.strides[i] * slice.suboffsets[i + offset] = slice.suboffsets[i] # <<<<<<<<<<<<<< @@ -21477,7 +23063,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice (__pyx_v_slice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_slice->suboffsets[__pyx_v_i]); } - /* "View.MemoryView":1309 + /* "View.MemoryView":1305 * slice.suboffsets[i + offset] = slice.suboffsets[i] * * for i in range(offset): # <<<<<<<<<<<<<< @@ -21488,7 +23074,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":1310 + /* "View.MemoryView":1306 * * for i in range(offset): * slice.shape[i] = 1 # <<<<<<<<<<<<<< @@ -21497,7 +23083,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ (__pyx_v_slice->shape[__pyx_v_i]) = 1; - /* "View.MemoryView":1311 + /* "View.MemoryView":1307 * for i in range(offset): * slice.shape[i] = 1 * slice.strides[i] = slice.strides[0] # <<<<<<<<<<<<<< @@ -21506,7 +23092,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ (__pyx_v_slice->strides[__pyx_v_i]) = (__pyx_v_slice->strides[0]); - /* "View.MemoryView":1312 + /* "View.MemoryView":1308 * slice.shape[i] = 1 * slice.strides[i] = slice.strides[0] * slice.suboffsets[i] = -1 # <<<<<<<<<<<<<< @@ -21516,9 +23102,18 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice (__pyx_v_slice->suboffsets[__pyx_v_i]) = -1; } + /* "View.MemoryView":1294 + * + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *slice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) nogil: + */ + + /* function exit code */ } -/* "View.MemoryView":1320 +/* "View.MemoryView":1316 * * @cname('__pyx_memoryview_refcount_copying') * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< @@ -21529,7 +23124,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { int __pyx_t_1; - /* "View.MemoryView":1324 + /* "View.MemoryView":1320 * * * if dtype_is_object: # <<<<<<<<<<<<<< @@ -21539,21 +23134,30 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i __pyx_t_1 = (__pyx_v_dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":1326 + /* "View.MemoryView":1321 + * * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< + * dst.strides, ndim, inc) * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') */ __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); goto __pyx_L3; } __pyx_L3:; + /* "View.MemoryView":1316 + * + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< + * int ndim, bint inc) nogil: + * + */ + + /* function exit code */ } -/* "View.MemoryView":1329 +/* "View.MemoryView":1325 * * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -21568,7 +23172,7 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da #endif __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - /* "View.MemoryView":1332 + /* "View.MemoryView":1328 * Py_ssize_t *strides, int ndim, * bint inc) with gil: * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< @@ -21577,13 +23181,22 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + /* "View.MemoryView":1325 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) with gil: + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif } -/* "View.MemoryView":1335 +/* "View.MemoryView":1331 * * @cname('__pyx_memoryview_refcount_objects_in_slice') * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -21599,7 +23212,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss int __pyx_t_3; __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - /* "View.MemoryView":1339 + /* "View.MemoryView":1335 * cdef Py_ssize_t i * * for i in range(shape[0]): # <<<<<<<<<<<<<< @@ -21610,7 +23223,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":1340 + /* "View.MemoryView":1336 * * for i in range(shape[0]): * if ndim == 1: # <<<<<<<<<<<<<< @@ -21620,7 +23233,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_t_3 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_3) { - /* "View.MemoryView":1341 + /* "View.MemoryView":1337 * for i in range(shape[0]): * if ndim == 1: * if inc: # <<<<<<<<<<<<<< @@ -21630,7 +23243,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_t_3 = (__pyx_v_inc != 0); if (__pyx_t_3) { - /* "View.MemoryView":1342 + /* "View.MemoryView":1338 * if ndim == 1: * if inc: * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< @@ -21642,7 +23255,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss } /*else*/ { - /* "View.MemoryView":1344 + /* "View.MemoryView":1340 * Py_INCREF(( data)[0]) * else: * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< @@ -21656,18 +23269,18 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss } /*else*/ { - /* "View.MemoryView":1347 + /* "View.MemoryView":1342 + * Py_DECREF(( data)[0]) * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - * ndim - 1, inc) # <<<<<<<<<<<<<< + * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< + * ndim - 1, inc) * - * data += strides[0] */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); } __pyx_L5:; - /* "View.MemoryView":1349 + /* "View.MemoryView":1345 * ndim - 1, inc) * * data += strides[0] # <<<<<<<<<<<<<< @@ -21677,10 +23290,19 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); } + /* "View.MemoryView":1331 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc): + * cdef Py_ssize_t i + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":1355 +/* "View.MemoryView":1351 * * @cname('__pyx_memoryview_slice_assign_scalar') * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< @@ -21690,7 +23312,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - /* "View.MemoryView":1358 + /* "View.MemoryView":1354 * size_t itemsize, void *item, * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -21699,16 +23321,16 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst */ __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1360 + /* "View.MemoryView":1355 + * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< + * itemsize, item) * refcount_copying(dst, dtype_is_object, ndim, True) - * */ __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":1361 + /* "View.MemoryView":1357 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, * itemsize, item) * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -21717,9 +23339,18 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst */ __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + /* "View.MemoryView":1351 + * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) nogil: + */ + + /* function exit code */ } -/* "View.MemoryView":1365 +/* "View.MemoryView":1361 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -21735,7 +23366,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t Py_ssize_t __pyx_t_2; Py_ssize_t __pyx_t_3; - /* "View.MemoryView":1369 + /* "View.MemoryView":1365 * size_t itemsize, void *item) nogil: * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< @@ -21744,7 +23375,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":1370 + /* "View.MemoryView":1366 * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< @@ -21753,7 +23384,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __pyx_v_extent = (__pyx_v_shape[0]); - /* "View.MemoryView":1372 + /* "View.MemoryView":1368 * cdef Py_ssize_t extent = shape[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -21763,7 +23394,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1373 + /* "View.MemoryView":1369 * * if ndim == 1: * for i in range(extent): # <<<<<<<<<<<<<< @@ -21774,7 +23405,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1374 + /* "View.MemoryView":1370 * if ndim == 1: * for i in range(extent): * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< @@ -21783,7 +23414,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize); - /* "View.MemoryView":1375 + /* "View.MemoryView":1371 * for i in range(extent): * memcpy(data, item, itemsize) * data += stride # <<<<<<<<<<<<<< @@ -21796,7 +23427,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t } /*else*/ { - /* "View.MemoryView":1377 + /* "View.MemoryView":1373 * data += stride * else: * for i in range(extent): # <<<<<<<<<<<<<< @@ -21807,16 +23438,16 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1379 + /* "View.MemoryView":1374 + * else: * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< + * ndim - 1, itemsize, item) * data += stride - * */ __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":1380 + /* "View.MemoryView":1376 * _slice_assign_scalar(data, shape + 1, strides + 1, * ndim - 1, itemsize, item) * data += stride # <<<<<<<<<<<<<< @@ -21828,9 +23459,18 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t } __pyx_L3:; + /* "View.MemoryView":1361 + * + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) nogil: + */ + + /* function exit code */ } -/* "BufferFormatFromTypeInfo":1421 +/* "BufferFormatFromTypeInfo":1417 * * @cname('__pyx_format_from_typeinfo') * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type): # <<<<<<<<<<<<<< @@ -21851,20 +23491,19 @@ static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) { __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - __Pyx_StructField *__pyx_t_5; + PyObject *__pyx_t_3 = NULL; + __Pyx_StructField *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("format_from_typeinfo", 0); - /* "BufferFormatFromTypeInfo":1426 + /* "BufferFormatFromTypeInfo":1422 * cdef bytes part, result * * if type.typegroup == 'S': # <<<<<<<<<<<<<< @@ -21874,7 +23513,7 @@ static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) { __pyx_t_1 = ((__pyx_v_type->typegroup == 'S') != 0); if (__pyx_t_1) { - /* "BufferFormatFromTypeInfo":1427 + /* "BufferFormatFromTypeInfo":1423 * * if type.typegroup == 'S': * assert type.fields != NULL and type.fields.type != NULL # <<<<<<<<<<<<<< @@ -21882,80 +23521,84 @@ static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) { * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT: */ #ifndef CYTHON_WITHOUT_ASSERTIONS - __pyx_t_1 = ((__pyx_v_type->fields != NULL) != 0); - if (__pyx_t_1) { + if (unlikely(!Py_OptimizeFlag)) { + __pyx_t_2 = ((__pyx_v_type->fields != NULL) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } __pyx_t_2 = ((__pyx_v_type->fields->type != NULL) != 0); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (unlikely(!__pyx_t_3)) { - PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (unlikely(!__pyx_t_1)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } #endif - /* "BufferFormatFromTypeInfo":1429 + /* "BufferFormatFromTypeInfo":1425 * assert type.fields != NULL and type.fields.type != NULL * * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT: # <<<<<<<<<<<<<< * alignment = b'^' * else: */ - __pyx_t_3 = ((__pyx_v_type->flags & __PYX_BUF_FLAGS_PACKED_STRUCT) != 0); - if (__pyx_t_3) { + __pyx_t_1 = ((__pyx_v_type->flags & __PYX_BUF_FLAGS_PACKED_STRUCT) != 0); + if (__pyx_t_1) { - /* "BufferFormatFromTypeInfo":1430 + /* "BufferFormatFromTypeInfo":1426 * * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT: * alignment = b'^' # <<<<<<<<<<<<<< * else: * alignment = b'' */ - __Pyx_INCREF(((PyObject *)__pyx_kp_b_78)); - __pyx_v_alignment = __pyx_kp_b_78; - goto __pyx_L4; + __Pyx_INCREF(__pyx_kp_b__37); + __pyx_v_alignment = __pyx_kp_b__37; + goto __pyx_L6; } /*else*/ { - /* "BufferFormatFromTypeInfo":1432 + /* "BufferFormatFromTypeInfo":1428 * alignment = b'^' * else: * alignment = b'' # <<<<<<<<<<<<<< * * parts = [b"T{"] */ - __Pyx_INCREF(((PyObject *)__pyx_kp_b_79)); - __pyx_v_alignment = __pyx_kp_b_79; + __Pyx_INCREF(__pyx_kp_b__38); + __pyx_v_alignment = __pyx_kp_b__38; } - __pyx_L4:; + __pyx_L6:; - /* "BufferFormatFromTypeInfo":1434 + /* "BufferFormatFromTypeInfo":1430 * alignment = b'' * * parts = [b"T{"] # <<<<<<<<<<<<<< * field = type.fields * */ - __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_b_80)); - PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_b_80)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_80)); - __pyx_v_parts = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_kp_b_T); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_b_T); + __Pyx_GIVEREF(__pyx_kp_b_T); + __pyx_v_parts = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "BufferFormatFromTypeInfo":1435 + /* "BufferFormatFromTypeInfo":1431 * * parts = [b"T{"] * field = type.fields # <<<<<<<<<<<<<< * * while field.type: */ - __pyx_t_5 = __pyx_v_type->fields; - __pyx_v_field = __pyx_t_5; + __pyx_t_4 = __pyx_v_type->fields; + __pyx_v_field = __pyx_t_4; - /* "BufferFormatFromTypeInfo":1437 + /* "BufferFormatFromTypeInfo":1433 * field = type.fields * * while field.type: # <<<<<<<<<<<<<< @@ -21963,44 +23606,43 @@ static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) { * parts.append(part + b':' + field.name + b':') */ while (1) { - __pyx_t_3 = (__pyx_v_field->type != 0); - if (!__pyx_t_3) break; + __pyx_t_1 = (__pyx_v_field->type != 0); + if (!__pyx_t_1) break; - /* "BufferFormatFromTypeInfo":1438 + /* "BufferFormatFromTypeInfo":1434 * * while field.type: * part = format_from_typeinfo(field.type) # <<<<<<<<<<<<<< * parts.append(part + b':' + field.name + b':') * field += 1 */ - __pyx_t_4 = ((PyObject *)__pyx_format_from_typeinfo(__pyx_v_field->type)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF(((PyObject *)__pyx_v_part)); - __pyx_v_part = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_3 = __pyx_format_from_typeinfo(__pyx_v_field->type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "BufferFormatFromTypeInfo":1439 + /* "BufferFormatFromTypeInfo":1435 * while field.type: * part = format_from_typeinfo(field.type) * parts.append(part + b':' + field.name + b':') # <<<<<<<<<<<<<< * field += 1 * */ - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_part), ((PyObject *)__pyx_kp_b_81)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_field->name); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_7), ((PyObject *)__pyx_kp_b_81)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_parts, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - - /* "BufferFormatFromTypeInfo":1440 + __pyx_t_3 = PyNumber_Add(__pyx_v_part, __pyx_kp_b__39); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_field->name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1435; __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; + __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_kp_b__39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "BufferFormatFromTypeInfo":1436 * part = format_from_typeinfo(field.type) * parts.append(part + b':' + field.name + b':') * field += 1 # <<<<<<<<<<<<<< @@ -22010,35 +23652,26 @@ static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) { __pyx_v_field = (__pyx_v_field + 1); } - /* "BufferFormatFromTypeInfo":1442 + /* "BufferFormatFromTypeInfo":1438 * field += 1 * * result = alignment.join(parts) + b'}' # <<<<<<<<<<<<<< * else: * fmt = __Pyx_TypeInfoToFormat(type) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_alignment), __pyx_n_s__join); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyBytes_Join(__pyx_v_alignment, __pyx_v_parts); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_kp_b__40); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1438; __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[4]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(((PyObject *)__pyx_v_parts)); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_parts)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_parts)); - __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1442; __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_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_4, ((PyObject *)__pyx_kp_b_82)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_result = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; goto __pyx_L3; } /*else*/ { - /* "BufferFormatFromTypeInfo":1444 + /* "BufferFormatFromTypeInfo":1440 * result = alignment.join(parts) + b'}' * else: * fmt = __Pyx_TypeInfoToFormat(type) # <<<<<<<<<<<<<< @@ -22047,104 +23680,111 @@ static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) { */ __pyx_v_fmt = __Pyx_TypeInfoToFormat(__pyx_v_type); - /* "BufferFormatFromTypeInfo":1445 + /* "BufferFormatFromTypeInfo":1441 * else: * fmt = __Pyx_TypeInfoToFormat(type) * if type.arraysize[0]: # <<<<<<<<<<<<<< * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)] * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string */ - __pyx_t_3 = ((__pyx_v_type->arraysize[0]) != 0); - if (__pyx_t_3) { + __pyx_t_1 = ((__pyx_v_type->arraysize[0]) != 0); + if (__pyx_t_1) { - /* "BufferFormatFromTypeInfo":1446 + /* "BufferFormatFromTypeInfo":1442 * fmt = __Pyx_TypeInfoToFormat(type) * if type.arraysize[0]: * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)] # <<<<<<<<<<<<<< * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string * else: */ - __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __pyx_v_type->ndim; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; - __pyx_t_4 = __Pyx_PyInt_FromSize_t((__pyx_v_type->arraysize[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1446; __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[4]; __pyx_lineno = 1446; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_7, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __pyx_v_type->ndim; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + __pyx_t_5 = __Pyx_PyInt_FromSize_t((__pyx_v_type->arraysize[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1442; __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[4]; __pyx_lineno = 1442; __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 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_v_extents = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_v_extents = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; - /* "BufferFormatFromTypeInfo":1447 + /* "BufferFormatFromTypeInfo":1443 * if type.arraysize[0]: * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)] * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string # <<<<<<<<<<<<<< * else: * result = fmt.string */ - __pyx_t_7 = ((PyObject *)PyUnicode_Join(__pyx_kp_u_84, ((PyObject *)__pyx_v_extents))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_83), __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = ((PyObject *)PyUnicode_AsASCIIString(((PyObject*)__pyx_t_4))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyUnicode_Join(__pyx_kp_u__41, __pyx_v_extents); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_6))||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; - goto __pyx_L7; + __pyx_t_5 = PyUnicode_Format(__pyx_kp_u_s, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyUnicode_AsASCIIString(((PyObject*)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_result = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L9; } /*else*/ { - /* "BufferFormatFromTypeInfo":1449 + /* "BufferFormatFromTypeInfo":1445 * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string * else: * result = fmt.string # <<<<<<<<<<<<<< * * return result */ - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_v_result = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_result = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; } - __pyx_L7:; + __pyx_L9:; } __pyx_L3:; - /* "BufferFormatFromTypeInfo":1451 + /* "BufferFormatFromTypeInfo":1447 * result = fmt.string * * return result # <<<<<<<<<<<<<< */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0; - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "BufferFormatFromTypeInfo":1417 + * + * @cname('__pyx_format_from_typeinfo') + * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type): # <<<<<<<<<<<<<< + * cdef __Pyx_StructField *field + * cdef __pyx_typeinfo_string fmt + */ + + /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("BufferFormatFromTypeInfo.format_from_typeinfo", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -22157,52 +23797,97 @@ static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) { __Pyx_RefNannyFinishContext(); return __pyx_r; } +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DistanceMetric; -static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_MemviewEnum_obj *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; - p = ((struct __pyx_MemviewEnum_obj *)o); - p->name = Py_None; Py_INCREF(Py_None); + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)o); + p->__pyx_vtab = __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + p->vec = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->mat = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->func = Py_None; Py_INCREF(Py_None); + p->kwargs = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } return o; } -static void __pyx_tp_dealloc_Enum(PyObject *o) { - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; +static void __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric(PyObject *o) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *p = (struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif PyObject_GC_UnTrack(o); - Py_CLEAR(p->name); + Py_CLEAR(p->vec); + Py_CLEAR(p->mat); + Py_CLEAR(p->func); + Py_CLEAR(p->kwargs); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - if (p->name) { - e = (*v)(p->name, a); if (e) return e; + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *p = (struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)o; + if (p->vec) { + e = (*v)(((PyObject*)p->vec), a); if (e) return e; + } + if (p->mat) { + e = (*v)(((PyObject*)p->mat), a); if (e) return e; + } + if (p->func) { + e = (*v)(p->func, a); if (e) return e; + } + if (p->kwargs) { + e = (*v)(p->kwargs, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_Enum(PyObject *o) { - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; +static int __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric(PyObject *o) { PyObject* tmp; - tmp = ((PyObject*)p->name); - p->name = Py_None; Py_INCREF(Py_None); + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *p = (struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)o; + tmp = ((PyObject*)p->vec); + p->vec = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->mat); + p->mat = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->func); + p->func = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->kwargs); + p->kwargs = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_Enum[] = { +static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_DistanceMetric[] = { + {"__reduce__", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_3__reduce__, METH_NOARGS, __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_2__reduce__}, + {"__getstate__", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_5__getstate__, METH_NOARGS, __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_4__getstate__}, + {"__setstate__", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_7__setstate__, METH_O, __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_6__setstate__}, + {"get_metric", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_9get_metric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8get_metric}, + {"rdist_to_dist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_13rdist_to_dist, METH_O, __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_12rdist_to_dist}, + {"dist_to_rdist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_15dist_to_rdist, METH_O, __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_14dist_to_rdist}, + {"pairwise", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_17pairwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16pairwise}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type___pyx_MemviewEnum = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.Enum"), /*tp_name*/ - sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.DistanceMetric", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22211,7 +23896,7 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { #else 0, /*reserved*/ #endif - __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ @@ -22222,14 +23907,14 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_Enum, /*tp_traverse*/ - __pyx_tp_clear_Enum, /*tp_clear*/ + "DistanceMetric class\n\n This class provides a uniform interface to fast distance metric\n functions. The various metrics can be accessed via the `get_metric`\n class method and the metric string identifier (see below).\n For example, to use the Euclidean distance:\n\n >>> dist = DistanceMetric.get_metric('euclidean')\n >>> X = [[0, 1, 2],\n [3, 4, 5]])\n >>> dist.pairwise(X)\n array([[ 0. , 5.19615242],\n [ 5.19615242, 0. ]])\n\n Available Metrics\n The following lists the string metric identifiers and the associated\n distance metric classes:\n\n **Metrics intended for real-valued vector spaces:**\n\n ============== ==================== ======== ===============================\n identifier class name args distance function\n -------------- -------------------- -------- -------------------------------\n \"euclidean\" EuclideanDistance - ``sqrt(sum((x - y)^2))``\n \"manhattan\" ManhattanDistance - ``sum(|x - y|)``\n \"chebyshev\" ChebyshevDistance - ``sum(max(|x - y|))``\n \"minkowski\" MinkowskiDistance p ``sum(|x - y|^p)^(1/p)``\n \"wminkowski\" WMinkowskiDistance p, w ``sum(w * |x - y|^p)^(1/p)``\n \"seuclidean\" SEuclideanDistance V ``sqrt(sum((x - y)^2 / V))``\n \"mahalanobis\" MahalanobisDistance V or VI ``sqrt((x - y)' V^-1 (x - y))``\n ============== ==================== ======== ===============================\n\n **Metrics intended for two-dimensional vector spaces:**\n\n ============ ================== ========================================\n identifier class name distance function\n ------------ ------------------ ----------------------------------------\n \"haversine\" HaversineDistance 2 arcsin(sqrt(sin^2(0.5*dx)\n + cos(x1)cos(x2)sin^2(0.5*dy)))\n ============ ================== ========================================\n\n\n **Metrics intended for integer-valued vector spaces:** Though intended\n for integer-valued vectors, these are also valid metrics in the case of\n real-valued vectors.\n\n ============= ==================== ========================================\n identifier class name distance function\n ------------- -------------------- ----------------------------------------\n \"hamming\" HammingDistance ``N_unequal(x, y) / N_tot``\n \"canberra\" CanberraDistance ``sum(|x - y| / (|x| + |y|))``\n \"braycurtis\" BrayCurtisDistance ``sum(|x - y|) / (sum(|x|) + sum(|y|))``\n ============= ==================== ========================================\n\n **Metrics intended for boolean-valued vector spaces:** Any nonzero entry\n is evaluated to \"True\". In the listings below, the following\n abbreviations are used:\n\n - N : number of dimensions\n - NTT : number of dims in which both values are True\n - NTF : number of dims in which the first value is True, second is False\n - NFT : number of dims in which the first value is False, second is True\n - NFF : number of dims in which both values are False\n - NNEQ : number of non-equal dimensions, NNEQ = NTF + NFT\n - NNZ : number of nonzero dimensions, NNZ = NTF + NFT + NTT\n\n ================= ======================= ===============================\n identifier class name distance function\n ----------------- ----------------------- -------------------------------\n \"jaccard\" JaccardDistance NNEQ / NNZ\n \"maching\" MatchingDistance NNEQ / N\n \"dice\" DiceDistance NNEQ / (NTT + NNZ)\n \"kulsinski\" KulsinskiDistance (NNEQ + N - NTT) / (NNEQ + N)\n \"rogerstanimoto\" RogersTanimotoDistance 2 * NNEQ / (N + NNEQ)\n \"russellrao\" RussellRaoDistance NNZ / N\n \"sokalmichener\" SokalMichenerDistance 2 * NNEQ / (N + NNEQ)\n \"sokalsneath\" SokalSneathDistance NNEQ / (NNEQ + 0.5 * NTT)\n ================= ======================= ===============================\n\n **User-defined distance:**\n\n =========== =============== =======\n identifier class name args\n ----------- --------------- -------\n \"pyfunc\" PyFuncDistance func\n =========== =============== =======\n\n Here ``func`` is a function which takes two one-dimensional numpy\n arrays, and returns a distance. Note that in order to be used within\n the BallTree, the distance must be a true metric:\n i.e. it must satisfy the following properties\n\n 1) Non-negativity: d(x, y) >= 0\n 2) Identity: d(x, y) = 0 if and only if x == y\n 3) Symmetry: d(x, y) = d(y, x)\n 4) Triangle Inequality: d(x, y) + d(y, z) >= d(x, z)\n\n Because of the Python object overhead involved in calling the python\n function, this will be fairly slow, but it will have the same\n scaling as other distances.\n ", /*tp_doc*/ + __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_Enum, /*tp_methods*/ + __pyx_methods_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22237,9 +23922,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_MemviewEnum___init__, /*tp_init*/ + __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_Enum, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22248,90 +23933,105 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DistanceMetric; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_EuclideanDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_EuclideanDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *p; + PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)o); - p->__pyx_vtab = __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - p->vec = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->mat = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->func = Py_None; Py_INCREF(Py_None); - p->kwargs = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; return o; } -static void __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric(PyObject *o) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *p = (struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->vec); - Py_CLEAR(p->mat); - Py_CLEAR(p->func); - Py_CLEAR(p->kwargs); - (*Py_TYPE(o)->tp_free)(o); -} +static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_EuclideanDistance[] = { + {"rdist_to_dist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_3rdist_to_dist, METH_O, 0}, + {"dist_to_rdist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_5dist_to_rdist, METH_O, 0}, + {0, 0, 0, 0} +}; -static int __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *p = (struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)o; - if (p->vec) { - e = (*v)(((PyObject*)p->vec), a); if (e) return e; - } - if (p->mat) { - e = (*v)(((PyObject*)p->mat), a); if (e) return e; - } - if (p->func) { - e = (*v)(p->func, a); if (e) return e; - } - if (p->kwargs) { - e = (*v)(p->kwargs, a); if (e) return e; - } - return 0; -} +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance = { + PyVarObject_HEAD_INIT(0, 0) + "sklearn.neighbors.dist_metrics.EuclideanDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Euclidean Distance metric\n\n .. math::\n D(x, y) = \\sqrt{ \\sum_i (x_i - y_i) ^ 2 }\n ", /*tp_doc*/ + __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_9neighbors_12dist_metrics_EuclideanDistance, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_EuclideanDistance, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; -static int __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric(PyObject *o) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *p = (struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *)o; - PyObject* tmp; - tmp = ((PyObject*)p->vec); - p->vec = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->mat); - p->mat = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->func); - p->func = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->kwargs); - p->kwargs = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *p; + PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; + return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_DistanceMetric[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_2__reduce__)}, - {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_5__getstate__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_4__getstate__)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_7__setstate__, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_6__setstate__)}, - {__Pyx_NAMESTR("get_metric"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_9get_metric, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_8get_metric)}, - {__Pyx_NAMESTR("rdist_to_dist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_13rdist_to_dist, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_12rdist_to_dist)}, - {__Pyx_NAMESTR("dist_to_rdist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_15dist_to_rdist, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_14dist_to_rdist)}, - {__Pyx_NAMESTR("pairwise"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_17pairwise, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_16pairwise)}, +static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance[] = { + {"rdist_to_dist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_3rdist_to_dist, METH_O, 0}, + {"dist_to_rdist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_5dist_to_rdist, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.DistanceMetric"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.SEuclideanDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -22353,14 +24053,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("DistanceMetric class\n\n This class provides a uniform interface to fast distance metric\n functions. The various metrics can be accessed via the `get_metric`\n class method and the metric string identifier (see below).\n For example, to use the Euclidean distance:\n\n >>> dist = DistanceMetric.get_metric('euclidean')\n >>> X = [[0, 1, 2],\n [3, 4, 5]])\n >>> dist.pairwise(X)\n array([[ 0. , 5.19615242],\n [ 5.19615242, 0. ]])\n\n Available Metrics\n The following lists the string metric identifiers and the associated\n distance metric classes:\n\n **Metrics intended for real-valued vector spaces:**\n\n ============== ==================== ======== ===============================\n identifier class name args distance function\n -------------- -------------------- -------- -------------------------------\n \"euclidean\" EuclideanDistance - ``sqrt(sum((x - y)^2))``\n \"manhattan\" ManhattanDistance - ``sum(|x - y|)``\n \"chebyshev\" ChebyshevDistance - ``sum(max(|x - y|))``\n \"minkowski\" MinkowskiDistance p ``sum(|x - y|^p)^(1/p)``\n \"wminkowski\" WMinkowskiDistance p, w ``sum(w * |x - y|^p)^(1/p)``\n \"seuclidean\" SEuclideanDistance V ``sqrt(sum((x - y)^2 / V))``\n \"mahalanobis\" MahalanobisDistance V or VI ``sqrt((x - y)' V^-1 (x - y))``\n ============== ==================== ======== ===============================\n\n **Metrics intended for two-dimensional vector spaces:**\n\n ============ ================== ========================================\n identifier class name distance function\n ------------ ------------------ ----------------------------------------\n \"haversine\" HaversineDistance 2 arcsin(sqrt(sin^2(0.5*dx)\n + cos(x1)cos(x2)sin^2(0.5*dy)))\n ============ ================== ========================================\n\n\n **Metrics intended for integer-valued vector spaces:** Though intended\n for integer-valued vectors, these are also valid metrics in the case of\n real-valued vectors.\n\n ============= ==================== ========================================\n identifier class name distance function\n ------------- -------------------- ----------------------------------------\n \"hamming\" HammingDistance ``N_unequal(x, y) / N_tot``\n \"canberra\" CanberraDistance ``sum(|x - y| / (|x| + |y|))``\n \"braycurtis\" BrayCurtisDistance ``sum(|x - y|) / (sum(|x|) + sum(|y|))``\n ============= ==================== ========================================\n\n **Metrics intended for boolean-valued vector spaces:** Any nonzero entry\n is evaluated to \"True\". In the listings below, the following\n abbreviations are used:\n\n - N : number of dimensions\n - NTT : number of dims in which both values are True\n - NTF : number of dims in which the first value is True, second is False\n - NFT : number of dims in which the first value is False, second is True\n - NFF : number of dims in which both values are False\n - NNEQ : number of non-equal dimensions, NNEQ = NTF + NFT\n - NNZ : number of nonzero dimensions, NNZ = NTF + NFT + NTT\n\n ================= ======================= ===============================\n identifier class name distance function\n ----------------- ----------------------- -------------------------------\n \"jaccard\" JaccardDistance NNEQ / NNZ\n \"maching\" MatchingDistance NNEQ / N\n \"dice\" DiceDistance NNEQ / (NTT + NNZ)\n \"kulsinski\" KulsinskiDistance (NNEQ + N - NTT) / (NNEQ + N)\n \"rogerstanimoto\" RogersTanimotoDistance 2 * NNEQ / (N + NNEQ)\n \"russellrao\" RussellRaoDistance NNZ / N\n \"sokalmichener\" SokalMichenerDistance 2 * NNEQ / (N + NNEQ)\n \"sokalsneath\" SokalSneathDistance NNEQ / (NNEQ + 0.5 * NTT)\n ================= ======================= ===============================\n\n **User-defined distance:**\n\n =========== =============== =======\n identifier class name args\n ----------- --------------- -------\n \"pyfunc\" PyFuncDistance func\n =========== =============== =======\n\n Here ``func`` is a function which takes two one-dimensional numpy\n arrays, and returns a distance. Note that in order to be used within\n the BallTree, the distance must be a true metric:\n i.e. it must satisfy the following properties\n\n 1) Non-negativity: d(x, y) >= 0\n 2) Identity: d(x, y) = 0 if and only if x == y\n 3) Symmetry: d(x, y) = d(y, x)\n 4) Triangle Inequality: d(x, y) + d(y, z) >= d(x, z)\n\n Because of the Python object overhead involved in calling the python\n function, this will be fairly slow, but it will have the same\n scaling as other distances.\n "), /*tp_doc*/ + "Standardized Euclidean Distance metric\n\n .. math::\n D(x, y) = \\sqrt{ \\sum_i \014rac{ (x_i - y_i) ^ 2}{V_i} }\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_methods*/ + __pyx_methods_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22368,9 +24068,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ + __pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22379,202 +24079,32 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ManhattanDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; -static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryview_obj *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ManhattanDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance *p; + PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryview_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_memoryview; - p->obj = Py_None; Py_INCREF(Py_None); - p->_size = Py_None; Py_INCREF(Py_None); - p->_array_interface = Py_None; Py_INCREF(Py_None); - p->view.obj = NULL; - if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; return o; } -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); - ++Py_REFCNT(o); - __pyx_memoryview___dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->obj); - Py_CLEAR(p->_size); - Py_CLEAR(p->_array_interface); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - if (p->obj) { - e = (*v)(p->obj, a); if (e) return e; - } - if (p->_size) { - e = (*v)(p->_size, a); if (e) return e; - } - if (p->_array_interface) { - e = (*v)(p->_array_interface, a); if (e) return e; - } - if (p->view.obj) { - e = (*v)(p->view.obj, a); if (e) return e; - } - return 0; -} +static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_ManhattanDistance[] = { + {0, 0, 0, 0} +}; -static int __pyx_tp_clear_memoryview(PyObject *o) { - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - PyObject* tmp; - tmp = ((PyObject*)p->obj); - p->obj = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_size); - p->_size = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_array_interface); - p->_array_interface = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - Py_CLEAR(p->view.obj); - return 0; -} -static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_memoryview___setitem__(o, i, v); - } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); - return -1; - } -} - -static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryview_transpose(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryview__get__base(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryview_get_shape(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryview_get_strides(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryview_get_suboffsets(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryview_get_ndim(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryview_get_itemsize(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryview_get_nbytes(o); -} - -static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryview_get_size(o); -} - -static PyMethodDef __pyx_methods_memoryview[] = { - {__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_memoryview[] = { - {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, - {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, - {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, - {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, - {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, - {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, - {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, - {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, - {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_memoryview = { - __pyx_memoryview___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_memoryview, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_memoryview = { - __pyx_memoryview___len__, /*mp_length*/ - __pyx_memoryview___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_memoryview = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - __pyx_memoryview_getbuffer, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type___pyx_memoryview = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.memoryview"), /*tp_name*/ - sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.ManhattanDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22583,35 +24113,35 @@ static PyTypeObject __pyx_type___pyx_memoryview = { #else 0, /*reserved*/ #endif - __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_repr*/ 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_memoryview, /*tp_traverse*/ - __pyx_tp_clear_memoryview, /*tp_clear*/ + "Manhattan/City-block Distance metric\n\n .. math::\n D(x, y) = \\sum_i |x_i - y_i|\n ", /*tp_doc*/ + __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_memoryview, /*tp_methods*/ + __pyx_methods_7sklearn_9neighbors_12dist_metrics_ManhattanDistance, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_memoryview, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_memoryview, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ManhattanDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22620,29 +24150,30 @@ static PyTypeObject __pyx_type___pyx_memoryview = { 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance[] = { +static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.KulsinskiDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.ChebyshevDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -22664,14 +24195,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDista 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Kulsinski Distance\n\n Kulsinski Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = 1 - \014rac{N_{TT}}{N + N_{TF} + N_{FT}}\n "), /*tp_doc*/ + "Chebyshev/Infinity Distance\n\n .. math::\n D(x, y) = max_i (|x_i - y_i|)\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance, /*tp_methods*/ + __pyx_methods_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22679,13 +24210,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDista 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ - #else - 0, /*tp_init*/ - #endif + __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22694,29 +24221,32 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDista 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance[] = { +static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance[] = { + {"rdist_to_dist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_3rdist_to_dist, METH_O, 0}, + {"dist_to_rdist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_5dist_to_rdist, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.SokalSneathDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.MinkowskiDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -22738,14 +24268,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDis 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Sokal-Sneath Distance\n\n Sokal-Sneath Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N_{TF} + N_{FT}}{N_{TT} / 2 + N_{TF} + N_{FT}}\n "), /*tp_doc*/ + "Minkowski Distance\n\n .. math::\n D(x, y) = [\\sum_i (x_i - y_i)^p] ^ (1/p)\n\n Minkowski Distance requires p >= 1 and finite. For p = infinity,\n use ChebyshevDistance.\n Note that for p=1, ManhattanDistance is more efficient, and for\n p=2, EuclideanDistance is more efficient.\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance, /*tp_methods*/ + __pyx_methods_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22753,13 +24283,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDis 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ - #else - 0, /*tp_init*/ - #endif + __pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22768,31 +24294,32 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDis 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance[] = { - {__Pyx_NAMESTR("rdist_to_dist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_3rdist_to_dist, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dist_to_rdist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_5dist_to_rdist, METH_O, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance[] = { + {"rdist_to_dist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_3rdist_to_dist, METH_O, 0}, + {"dist_to_rdist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_5dist_to_rdist, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.SEuclideanDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.WMinkowskiDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -22814,14 +24341,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDist 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Standardized Euclidean Distance metric\n\n .. math::\n D(x, y) = \\sqrt{ \\sum_i \014rac{ (x_i - y_i) ^ 2}{V_i} }\n "), /*tp_doc*/ + "Weighted Minkowski Distance\n\n .. math::\n D(x, y) = [\\sum_i w_i (x_i - y_i)^p] ^ (1/p)\n\n Weighted Minkowski Distance requires p >= 1 and finite.\n\n Parameters\n ----------\n p : int\n The order of the norm of the difference :math:`{||u-v||}_p`.\n w : (N,) array_like\n The weight vector.\n\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance, /*tp_methods*/ + __pyx_methods_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22829,9 +24356,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDist 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_1__init__, /*tp_init*/ + __pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22840,29 +24367,32 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDist 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_JaccardDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_JaccardDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_JaccardDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_JaccardDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_JaccardDistance[] = { +static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance[] = { + {"rdist_to_dist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_3rdist_to_dist, METH_O, 0}, + {"dist_to_rdist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_5dist_to_rdist, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.JaccardDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.MahalanobisDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -22884,14 +24414,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistanc 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Jaccard Distance\n\n Jaccard Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N_{TF} + N_{FT}}{N_{TT} + N_{TF} + N_{FT}}\n "), /*tp_doc*/ + "Mahalanobis Distance\n\n .. math::\n D(x, y) = \\sqrt{ (x - y)^T V^{-1} (x - y) }\n\n Parameters\n ----------\n V : array_like\n Symmetric positive-definite covariance matrix.\n The inverse of this matrix will be explicitly computed.\n VI : array_like\n optionally specify the inverse directly. If VI is passed,\n then V is not referenced.\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_JaccardDistance, /*tp_methods*/ + __pyx_methods_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22899,13 +24429,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistanc 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ - #else - 0, /*tp_init*/ - #endif + __pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_JaccardDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22914,8 +24440,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistanc 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HammingDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HammingDistance; @@ -22929,13 +24456,9 @@ static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_HammingDistance return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_HammingDistance[] = { - {0, 0, 0, 0} -}; - static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.HammingDistance"), /*tp_name*/ + "sklearn.neighbors.dist_metrics.HammingDistance", /*tp_name*/ sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HammingDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ @@ -22958,14 +24481,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistanc 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Hamming Distance\n\n Hamming distance is meant for discrete-valued vectors, though it is\n a valid metric for real-valued vectors.\n\n .. math::\n D(x, y) = \014rac{1}{N} \\sum_i \\delta_{x_i, y_i}\n "), /*tp_doc*/ + "Hamming Distance\n\n Hamming distance is meant for discrete-valued vectors, though it is\n a valid metric for real-valued vectors.\n\n .. math::\n D(x, y) = \014rac{1}{N} \\sum_i \\delta_{x_i, y_i}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_HammingDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22988,29 +24511,26 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistanc 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_CanberraDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_CanberraDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_CanberraDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_CanberraDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_CanberraDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_CanberraDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.BrayCurtisDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.CanberraDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_CanberraDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -23032,14 +24552,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDist 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Bray-Curtis Distance\n\n Bray-Curtis distance is meant for discrete-valued vectors, though it is\n a valid metric for real-valued vectors.\n\n .. math::\n D(x, y) = \014rac{\\sum_i |x_i - y_i|}{\\sum_i(|x_i| + |y_i|)}\n "), /*tp_doc*/ + "Canberra Distance\n\n Canberra distance is meant for discrete-valued vectors, though it is\n a valid metric for real-valued vectors.\n\n .. math::\n D(x, y) = \\sum_i \014rac{|x_i - y_i|}{|x_i| + |y_i|}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23053,7 +24573,7 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDist 0, /*tp_init*/ #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_CanberraDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23062,29 +24582,26 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDist 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_CanberraDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_CanberraDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_CanberraDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_CanberraDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_CanberraDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_CanberraDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_CanberraDistance[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.CanberraDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_CanberraDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.BrayCurtisDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -23106,14 +24623,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistan 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Canberra Distance\n\n Canberra distance is meant for discrete-valued vectors, though it is\n a valid metric for real-valued vectors.\n\n .. math::\n D(x, y) = \\sum_i \014rac{|x_i - y_i|}{|x_i| + |y_i|}\n "), /*tp_doc*/ + "Bray-Curtis Distance\n\n Bray-Curtis distance is meant for discrete-valued vectors, though it is\n a valid metric for real-valued vectors.\n\n .. math::\n D(x, y) = \014rac{\\sum_i |x_i - y_i|}{\\sum_i(|x_i| + |y_i|)}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_CanberraDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23127,7 +24644,7 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistan 0, /*tp_init*/ #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_CanberraDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23136,29 +24653,26 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistan 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_JaccardDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_JaccardDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_JaccardDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_JaccardDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.RussellRaoDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.JaccardDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_JaccardDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -23180,14 +24694,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDist 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Russell-Rao Distance\n\n Russell-Rao Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N - N_{TT}}{N}\n "), /*tp_doc*/ + "Jaccard Distance\n\n Jaccard Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N_{TF} + N_{FT}}{N_{TT} + N_{TF} + N_{FT}}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23201,7 +24715,7 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDist 0, /*tp_init*/ #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_JaccardDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23210,31 +24724,26 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDist 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_EuclideanDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MatchingDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MatchingDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_EuclideanDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MatchingDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MatchingDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_EuclideanDistance[] = { - {__Pyx_NAMESTR("rdist_to_dist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_3rdist_to_dist, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dist_to_rdist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_5dist_to_rdist, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.EuclideanDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_EuclideanDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.MatchingDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -23256,14 +24765,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDista 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Euclidean Distance metric\n\n .. math::\n D(x, y) = \\sqrt{ \\sum_i (x_i - y_i) ^ 2 }\n "), /*tp_doc*/ + "Matching Distance\n\n Matching Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N_{TF} + N_{FT}}{N}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_EuclideanDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23271,9 +24780,13 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDista 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_1__init__, /*tp_init*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_EuclideanDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MatchingDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23282,31 +24795,26 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDista 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DiceDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DiceDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DiceDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DiceDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance[] = { - {__Pyx_NAMESTR("rdist_to_dist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_3rdist_to_dist, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dist_to_rdist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_5dist_to_rdist, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.WMinkowskiDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.DiceDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -23328,14 +24836,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDist 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Weighted Minkowski Distance\n\n .. math::\n D(x, y) = [\\sum_i w_i (x_i - y_i)^p] ^ (1/p)\n\n Weighted Minkowski Distance requires p >= 1 and finite.\n\n Parameters\n ----------\n p : int\n The order of the norm of the difference :math:`{||u-v||}_p`.\n w : (N,) array_like\n The weight vector.\n\n "), /*tp_doc*/ + "Dice Distance\n\n Dice Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N_{TF} + N_{FT}}{2 * N_{TT} + N_{TF} + N_{FT}}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23343,9 +24851,13 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDist 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_1__init__, /*tp_init*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DiceDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23354,31 +24866,26 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDist 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance[] = { - {__Pyx_NAMESTR("rdist_to_dist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_3rdist_to_dist, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dist_to_rdist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_5dist_to_rdist, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.MinkowskiDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.KulsinskiDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -23400,14 +24907,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDista 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Minkowski Distance\n\n .. math::\n D(x, y) = [\\sum_i (x_i - y_i)^p] ^ (1/p)\n\n Minkowski Distance requires p >= 1 and finite. For p = infinity,\n use ChebyshevDistance.\n Note that for p=1, ManhattanDistance is more efficient, and for\n p=2, EuclideanDistance is more efficient.\n "), /*tp_doc*/ + "Kulsinski Distance\n\n Kulsinski Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = 1 - \014rac{N_{TT}}{N + N_{TF} + N_{FT}}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23415,9 +24922,13 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDista 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_1__init__, /*tp_init*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23426,31 +24937,26 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDista 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance[] = { - {__Pyx_NAMESTR("rdist_to_dist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_3rdist_to_dist, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dist_to_rdist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_5dist_to_rdist, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.MahalanobisDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.RogersTanimotoDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -23472,14 +24978,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDis 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Mahalanobis Distance\n\n .. math::\n D(x, y) = \\sqrt{ (x - y)^T V^{-1} (x - y) }\n\n Parameters\n ----------\n V : array_like\n Symmetric positive-definite covariance matrix.\n The inverse of this matrix will be explicitly computed.\n VI : array_like\n optionally specify the inverse directly. If VI is passed,\n then V is not referenced.\n "), /*tp_doc*/ + "Rogers-Tanimoto Distance\n\n Rogers-Tanimoto Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{2 (N_{TF} + N_{FT})}{N + N_{TF} + N_{FT}}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23487,9 +24993,13 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDis 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_1__init__, /*tp_init*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23498,29 +25008,26 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDis 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ManhattanDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ManhattanDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_ManhattanDistance[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.ManhattanDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ManhattanDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.RussellRaoDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -23542,14 +25049,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDista 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Manhattan/City-block Distance metric\n\n .. math::\n D(x, y) = \\sum_i |x_i - y_i|\n "), /*tp_doc*/ + "Russell-Rao Distance\n\n Russell-Rao Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N - N_{TT}}{N}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_ManhattanDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23557,9 +25064,13 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDista 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance_1__init__, /*tp_init*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ManhattanDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23568,8 +25079,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDista 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance; @@ -23583,13 +25095,9 @@ static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SokalMichenerDi return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance[] = { - {0, 0, 0, 0} -}; - static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.SokalMichenerDistance"), /*tp_name*/ + "sklearn.neighbors.dist_metrics.SokalMichenerDistance", /*tp_name*/ sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ @@ -23612,14 +25120,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerD 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Sokal-Michener Distance\n\n Sokal-Michener Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{2 (N_{TF} + N_{FT})}{N + N_{TF} + N_{FT}}\n "), /*tp_doc*/ + "Sokal-Michener Distance\n\n Sokal-Michener Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{2 (N_{TF} + N_{FT})}{N + N_{TF} + N_{FT}}\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23642,272 +25150,28 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerD 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_array_obj *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance *p; + PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_array_obj *)o); - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; return o; } -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); - ++Py_REFCNT(o); - __pyx_array___dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->mode); - Py_CLEAR(p->_format); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - if (p->mode) { - e = (*v)(p->mode, a); if (e) return e; - } - if (p->_format) { - e = (*v)(p->_format, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_array(PyObject *o) { - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - PyObject* tmp; - tmp = ((PyObject*)p->mode); - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_format); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} -static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_array___setitem__(o, i, v); - } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); - return -1; - } -} - -static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { - PyObject *v = PyObject_GenericGetAttr(o, n); - if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - v = __pyx_array___getattr__(o, n); - } - return v; -} - -static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { - return get_memview(o); -} - -static PyMethodDef __pyx_methods_array[] = { - {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_array[] = { - {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_array = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_array, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_array = { - 0, /*mp_length*/ - __pyx_array___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_array = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - __pyx_array_getbuffer, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type___pyx_array = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.array"), /*tp_name*/ - sizeof(struct __pyx_array_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_array, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - __pyx_tp_getattro_array, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_array, /*tp_traverse*/ - __pyx_tp_clear_array, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_array, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_array, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_array, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; - -static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryviewslice_obj *p; - PyObject *o = __pyx_tp_new_memoryview(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryviewslice_obj *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; - p->from_object = Py_None; Py_INCREF(Py_None); - p->from_slice.memview = NULL; - return o; -} - -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); - ++Py_REFCNT(o); - __pyx_memoryviewslice___dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->from_object); - PyObject_GC_Track(o); - __pyx_tp_dealloc_memoryview(o); -} - -static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; - if (p->from_object) { - e = (*v)(p->from_object, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear__memoryviewslice(PyObject *o) { - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - PyObject* tmp; - __pyx_tp_clear_memoryview(o); - tmp = ((PyObject*)p->from_object); - p->from_object = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - __PYX_XDEC_MEMVIEW(&p->from_slice, 1); - return 0; -} - -static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_memoryviewslice__get__base(o); -} - -static PyMethodDef __pyx_methods__memoryviewslice[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { - {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type___pyx_memoryviewslice = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics._memoryviewslice"), /*tp_name*/ - sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.SokalSneathDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23916,43 +25180,39 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #else 0, /*reserved*/ #endif - #if CYTHON_COMPILING_IN_PYPY - __pyx_memoryview___repr__, /*tp_repr*/ - #else 0, /*tp_repr*/ - #endif 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_memoryview___str__, /*tp_str*/ - #else 0, /*tp_str*/ - #endif 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ - __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ - __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + "Sokal-Sneath Distance\n\n Sokal-Sneath Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N_{TF} + N_{FT}}{N_{TT} / 2 + N_{TF} + N_{FT}}\n ", /*tp_doc*/ + __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods__memoryviewslice, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets__memoryviewslice, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ + #else 0, /*tp_init*/ + #endif 0, /*tp_alloc*/ - __pyx_tp_new__memoryviewslice, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23961,29 +25221,32 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; +static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HaversineDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HaversineDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance *p; +static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_HaversineDistance(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *p; PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; + p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HaversineDistance; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance[] = { +static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_HaversineDistance[] = { + {"rdist_to_dist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_1rdist_to_dist, METH_O, 0}, + {"dist_to_rdist", (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_3dist_to_rdist, METH_O, 0}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance = { +static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.RogersTanimotoDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.HaversineDistance", /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ 0, /*tp_print*/ @@ -24005,14 +25268,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimoto 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Rogers-Tanimoto Distance\n\n Rogers-Tanimoto Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{2 (N_{TF} + N_{FT})}{N + N_{TF} + N_{FT}}\n "), /*tp_doc*/ + "Haversine (Spherical) Distance\n\n The Haversine distance is the angular distance between two points on\n the surface of a sphere. The first distance of each point is assumed\n to be the latitude, the second is the longitude, given in radians.\n The dimension of the points must be 2:\n\n .. math::\n D(x, y) = 2\007rcsin[\\sqrt{\\sin^2((x1 - y1) / 2)\n + cos(x1)cos(y1)sin^2((x2 - y2) / 2)}]\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance, /*tp_methods*/ + __pyx_methods_7sklearn_9neighbors_12dist_metrics_HaversineDistance, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24026,7 +25289,7 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimoto 0, /*tp_init*/ #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance, /*tp_new*/ + __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_HaversineDistance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24035,8 +25298,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimoto 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_PyFuncDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_PyFuncDistance; @@ -24056,7 +25320,7 @@ static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_PyFuncDistan static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.PyFuncDistance"), /*tp_name*/ + "sklearn.neighbors.dist_metrics.PyFuncDistance", /*tp_name*/ sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_PyFuncDistance), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ @@ -24079,7 +25343,7 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("PyFunc Distance\n\n A user-defined distance\n\n Parameters\n ----------\n func : function\n func should take two numpy arrays as input, and return a distance.\n "), /*tp_doc*/ + "PyFunc Distance\n\n A user-defined distance\n\n Parameters\n ----------\n func : function\n func should take two numpy arrays as input, and return a distance.\n ", /*tp_doc*/ __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -24105,72 +25369,170 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_MatchingDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MatchingDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MatchingDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance *p; - PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MatchingDistance; + p = ((struct __pyx_array_obj *)o); + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_MatchingDistance[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.MatchingDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_MatchingDistance), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Matching Distance\n\n Matching Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N_{TF} + N_{FT}}{N}\n "), /*tp_doc*/ - __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ - __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_array___dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + (*Py_TYPE(o)->tp_free)(o); +} +static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return get_memview(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_array = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + 0, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "sklearn.neighbors.dist_metrics.array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_MatchingDistance, /*tp_methods*/ + __pyx_methods_array, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_array, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ - #else 0, /*tp_init*/ - #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_MatchingDistance, /*tp_new*/ + __pyx_tp_new_array, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24179,31 +25541,66 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistan 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance *p; - PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance[] = { +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_Enum[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance = { +static PyTypeObject __pyx_type___pyx_MemviewEnum = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.ChebyshevDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24212,7 +25609,7 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDista #else 0, /*reserved*/ #endif - 0, /*tp_repr*/ + __pyx_MemviewEnum___repr__, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ @@ -24223,14 +25620,14 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDista 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Chebyshev/Infinity Distance\n\n .. math::\n D(x, y) = max_i (|x_i - y_i|)\n "), /*tp_doc*/ - __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ - __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance, /*tp_methods*/ + __pyx_methods_Enum, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24238,9 +25635,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDista 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance_1__init__, /*tp_init*/ + __pyx_MemviewEnum___init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance, /*tp_new*/ + __pyx_tp_new_Enum, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24249,33 +25646,207 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDista 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_HaversineDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HaversineDistance; +static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_HaversineDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *p; - PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HaversineDistance; + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->_array_interface = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_HaversineDistance[] = { - {__Pyx_NAMESTR("rdist_to_dist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_1rdist_to_dist, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dist_to_rdist"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_3dist_to_rdist, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_memoryview___dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + Py_CLEAR(p->_array_interface); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->_array_interface) { + e = (*v)(p->_array_interface, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_array_interface); + p->_array_interface = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryview_transpose(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryview__get__base(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryview_get_shape(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryview_get_strides(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryview_get_suboffsets(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryview_get_ndim(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryview_get_itemsize(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryview_get_nbytes(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryview_get_size(o); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0}, + {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, + {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, + {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0}, + {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0}, + {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0}, + {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0}, + {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0}, + {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0}, + {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0}, + {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0}, + {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ }; -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance = { +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.HaversineDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_HaversineDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics.memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24284,39 +25855,35 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDista #else 0, /*reserved*/ #endif - 0, /*tp_repr*/ + __pyx_memoryview___repr__, /*tp_repr*/ 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_memoryview___str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Haversine (Spherical) Distance\n\n The Haversine distance is the angular distance between two points on\n the surface of a sphere. The first distance of each point is assumed\n to be the latitude, the second is the longitude, given in radians.\n The dimension of the points must be 2:\n\n .. math::\n D(x, y) = 2\007rcsin[\\sqrt{\\sin^2((x1 - y1) / 2)\n + cos(x1)cos(y1)sin^2((x2 - y2) / 2)}]\n "), /*tp_doc*/ - __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ - __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_HaversineDistance, /*tp_methods*/ + __pyx_methods_memoryview, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_memoryview, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ - #else 0, /*tp_init*/ - #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_HaversineDistance, /*tp_new*/ + __pyx_tp_new_memoryview, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24325,31 +25892,85 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDista 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; -static struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DiceDistance __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DiceDistance; +static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DiceDistance(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance *p; - PyObject *o = __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DistanceMetric(t, a, k); +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_9neighbors_12dist_metrics_DistanceMetric*)__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DiceDistance; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; return o; } -static PyMethodDef __pyx_methods_7sklearn_9neighbors_12dist_metrics_DiceDistance[] = { +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_memoryviewslice___dealloc__(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XDEC_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_memoryviewslice__get__base(o); +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance = { +static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { + {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("sklearn.neighbors.dist_metrics.DiceDistance"), /*tp_name*/ - sizeof(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DiceDistance), /*tp_basicsize*/ + "sklearn.neighbors.dist_metrics._memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_dealloc*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24358,39 +25979,43 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance = #else 0, /*reserved*/ #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_memoryview___repr__, /*tp_repr*/ + #else 0, /*tp_repr*/ + #endif 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_memoryview___str__, /*tp_str*/ + #else 0, /*tp_str*/ + #endif 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Dice Distance\n\n Dice Distance is a dissimilarity measure for boolean-valued\n vectors. All nonzero entries will be treated as True, zero entries will\n be treated as False.\n\n .. math::\n D(x, y) = \014rac{N_{TF} + N_{FT}}{2 * N_{TT} + N_{TF} + N_{FT}}\n "), /*tp_doc*/ - __pyx_tp_traverse_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_traverse*/ - __pyx_tp_clear_7sklearn_9neighbors_12dist_metrics_DistanceMetric, /*tp_clear*/ + "Internal class for passing memoryview slices to Python", /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_9neighbors_12dist_metrics_DiceDistance, /*tp_methods*/ + __pyx_methods__memoryviewslice, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets__memoryviewslice, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_11__init__, /*tp_init*/ - #else 0, /*tp_init*/ - #endif 0, /*tp_alloc*/ - __pyx_tp_new_7sklearn_9neighbors_12dist_metrics_DiceDistance, /*tp_new*/ + __pyx_tp_new__memoryviewslice, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24399,8 +26024,9 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance = 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ #endif }; @@ -24415,7 +26041,7 @@ static struct PyModuleDef __pyx_moduledef = { #else PyModuleDef_HEAD_INIT, #endif - __Pyx_NAMESTR("dist_metrics"), + "dist_metrics", 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, @@ -24427,185 +26053,180 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, - {&__pyx_kp_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 0}, - {&__pyx_kp_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 0}, - {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, - {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, - {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, - {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, - {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, - {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, - {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, - {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0}, - {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, - {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0}, - {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0}, - {&__pyx_kp_u_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0, 0}, - {&__pyx_kp_u_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0, 0}, - {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, - {&__pyx_kp_u_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0, 0}, - {&__pyx_kp_u_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 1, 0, 0}, - {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0}, - {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0}, - {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0}, - {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0}, - {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0}, - {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0}, - {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0}, - {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0}, - {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, - {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0}, - {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0}, - {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0}, - {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0}, - {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0}, - {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0}, - {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0}, - {&__pyx_kp_b_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 0, 0}, - {&__pyx_kp_b_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 0, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, - {&__pyx_kp_b_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 0, 0}, - {&__pyx_kp_b_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 0, 0}, - {&__pyx_kp_b_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 0, 0}, - {&__pyx_kp_u_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 1, 0, 0}, - {&__pyx_kp_u_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 1, 0, 0}, - {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0}, - {&__pyx_n_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 1}, - {&__pyx_n_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 1}, - {&__pyx_kp_u_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 1, 0, 0}, - {&__pyx_kp_u_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 1, 0, 0}, - {&__pyx_kp_s_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 0, 1, 0}, - {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0}, - {&__pyx_kp_s_99, __pyx_k_99, sizeof(__pyx_k_99), 0, 0, 1, 0}, - {&__pyx_n_s__ASCII, __pyx_k__ASCII, sizeof(__pyx_k__ASCII), 0, 0, 1, 1}, - {&__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__Ellipsis, __pyx_k__Ellipsis, sizeof(__pyx_k__Ellipsis), 0, 0, 1, 1}, - {&__pyx_n_s__ITYPE, __pyx_k__ITYPE, sizeof(__pyx_k__ITYPE), 0, 0, 1, 1}, - {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, - {&__pyx_n_s__L, __pyx_k__L, sizeof(__pyx_k__L), 0, 0, 1, 1}, - {&__pyx_n_s__METRIC_MAPPING, __pyx_k__METRIC_MAPPING, sizeof(__pyx_k__METRIC_MAPPING), 0, 0, 1, 1}, - {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1}, - {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1}, - {&__pyx_n_b__O, __pyx_k__O, sizeof(__pyx_k__O), 0, 0, 0, 1}, - {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, - {&__pyx_n_s__V, __pyx_k__V, sizeof(__pyx_k__V), 0, 0, 1, 1}, - {&__pyx_n_s__VI, __pyx_k__VI, sizeof(__pyx_k__VI), 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__Y, __pyx_k__Y, sizeof(__pyx_k__Y), 0, 0, 1, 1}, - {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, - {&__pyx_n_s____getstate__, __pyx_k____getstate__, sizeof(__pyx_k____getstate__), 0, 0, 1, 1}, - {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, - {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, - {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1}, - {&__pyx_n_s____new__, __pyx_k____new__, sizeof(__pyx_k____new__), 0, 0, 1, 1}, - {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, - {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, - {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1}, - {&__pyx_n_s__arcsin, __pyx_k__arcsin, sizeof(__pyx_k__arcsin), 0, 0, 1, 1}, - {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__braycurtis, __pyx_k__braycurtis, sizeof(__pyx_k__braycurtis), 0, 0, 1, 1}, - {&__pyx_n_b__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 0, 1}, - {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, - {&__pyx_n_u__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 1, 0, 1}, - {&__pyx_n_s__canberra, __pyx_k__canberra, sizeof(__pyx_k__canberra), 0, 0, 1, 1}, - {&__pyx_n_s__chebyshev, __pyx_k__chebyshev, sizeof(__pyx_k__chebyshev), 0, 0, 1, 1}, - {&__pyx_n_s__cityblock, __pyx_k__cityblock, sizeof(__pyx_k__cityblock), 0, 0, 1, 1}, - {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1}, - {&__pyx_n_s__dice, __pyx_k__dice, sizeof(__pyx_k__dice), 0, 0, 1, 1}, - {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, - {&__pyx_n_s__dtype_is_object, __pyx_k__dtype_is_object, sizeof(__pyx_k__dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1}, - {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, - {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1}, - {&__pyx_n_s__euclidean, __pyx_k__euclidean, sizeof(__pyx_k__euclidean), 0, 0, 1, 1}, - {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1}, - {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_b__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 0, 1}, - {&__pyx_n_s__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 1, 1}, - {&__pyx_n_s__func, __pyx_k__func, sizeof(__pyx_k__func), 0, 0, 1, 1}, - {&__pyx_n_s__get_metric, __pyx_k__get_metric, sizeof(__pyx_k__get_metric), 0, 0, 1, 1}, - {&__pyx_n_s__hamming, __pyx_k__hamming, sizeof(__pyx_k__hamming), 0, 0, 1, 1}, - {&__pyx_n_s__haversine, __pyx_k__haversine, sizeof(__pyx_k__haversine), 0, 0, 1, 1}, - {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, - {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1}, - {&__pyx_n_s__infinity, __pyx_k__infinity, sizeof(__pyx_k__infinity), 0, 0, 1, 1}, - {&__pyx_n_s__inv, __pyx_k__inv, sizeof(__pyx_k__inv), 0, 0, 1, 1}, - {&__pyx_n_s__isinf, __pyx_k__isinf, sizeof(__pyx_k__isinf), 0, 0, 1, 1}, - {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__jaccard, __pyx_k__jaccard, sizeof(__pyx_k__jaccard), 0, 0, 1, 1}, - {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, - {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1}, - {&__pyx_n_s__kulsinski, __pyx_k__kulsinski, sizeof(__pyx_k__kulsinski), 0, 0, 1, 1}, - {&__pyx_n_s__l1, __pyx_k__l1, sizeof(__pyx_k__l1), 0, 0, 1, 1}, - {&__pyx_n_s__l2, __pyx_k__l2, sizeof(__pyx_k__l2), 0, 0, 1, 1}, - {&__pyx_n_s__linalg, __pyx_k__linalg, sizeof(__pyx_k__linalg), 0, 0, 1, 1}, - {&__pyx_n_s__mahalanobis, __pyx_k__mahalanobis, sizeof(__pyx_k__mahalanobis), 0, 0, 1, 1}, - {&__pyx_n_s__manhattan, __pyx_k__manhattan, sizeof(__pyx_k__manhattan), 0, 0, 1, 1}, - {&__pyx_n_s__matching, __pyx_k__matching, sizeof(__pyx_k__matching), 0, 0, 1, 1}, - {&__pyx_n_s__memview, __pyx_k__memview, sizeof(__pyx_k__memview), 0, 0, 1, 1}, - {&__pyx_n_s__metric, __pyx_k__metric, sizeof(__pyx_k__metric), 0, 0, 1, 1}, - {&__pyx_n_s__minkowski, __pyx_k__minkowski, sizeof(__pyx_k__minkowski), 0, 0, 1, 1}, - {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, - {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, - {&__pyx_n_s__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__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, - {&__pyx_n_s__p, __pyx_k__p, sizeof(__pyx_k__p), 0, 0, 1, 1}, - {&__pyx_n_s__pack, __pyx_k__pack, sizeof(__pyx_k__pack), 0, 0, 1, 1}, - {&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1}, - {&__pyx_n_s__pyfunc, __pyx_k__pyfunc, sizeof(__pyx_k__pyfunc), 0, 0, 1, 1}, - {&__pyx_n_s__random, __pyx_k__random, sizeof(__pyx_k__random), 0, 0, 1, 1}, - {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__rogerstanimoto, __pyx_k__rogerstanimoto, sizeof(__pyx_k__rogerstanimoto), 0, 0, 1, 1}, - {&__pyx_n_s__russellrao, __pyx_k__russellrao, sizeof(__pyx_k__russellrao), 0, 0, 1, 1}, - {&__pyx_n_s__seuclidean, __pyx_k__seuclidean, sizeof(__pyx_k__seuclidean), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__sin, __pyx_k__sin, sizeof(__pyx_k__sin), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__sokalmichener, __pyx_k__sokalmichener, sizeof(__pyx_k__sokalmichener), 0, 0, 1, 1}, - {&__pyx_n_s__sokalsneath, __pyx_k__sokalsneath, sizeof(__pyx_k__sokalsneath), 0, 0, 1, 1}, - {&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1}, - {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, - {&__pyx_n_s__step, __pyx_k__step, sizeof(__pyx_k__step), 0, 0, 1, 1}, - {&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1}, - {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1}, - {&__pyx_n_s__typedefs, __pyx_k__typedefs, sizeof(__pyx_k__typedefs), 0, 0, 1, 1}, - {&__pyx_n_s__unpack, __pyx_k__unpack, sizeof(__pyx_k__unpack), 0, 0, 1, 1}, - {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1}, - {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1}, - {&__pyx_n_s__wminkowski, __pyx_k__wminkowski, sizeof(__pyx_k__wminkowski), 0, 0, 1, 1}, - {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1}, - {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, + {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1}, + {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, + {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1}, + {&__pyx_kp_s_DistanceMetric_is_an_abstract_cl, __pyx_k_DistanceMetric_is_an_abstract_cl, sizeof(__pyx_k_DistanceMetric_is_an_abstract_cl), 0, 0, 1, 0}, + {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, + {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, + {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, + {&__pyx_kp_u_Given_an_iterable_of_metric_clas, __pyx_k_Given_an_iterable_of_metric_clas, sizeof(__pyx_k_Given_an_iterable_of_metric_clas), 0, 1, 0, 0}, + {&__pyx_kp_s_Haversine_distance_only_valid_in, __pyx_k_Haversine_distance_only_valid_in, sizeof(__pyx_k_Haversine_distance_only_valid_in), 0, 0, 1, 0}, + {&__pyx_n_s_ITYPE, __pyx_k_ITYPE, sizeof(__pyx_k_ITYPE), 0, 0, 1, 1}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, + {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, + {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, + {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1}, + {&__pyx_n_s_METRIC_MAPPING, __pyx_k_METRIC_MAPPING, sizeof(__pyx_k_METRIC_MAPPING), 0, 0, 1, 1}, + {&__pyx_kp_s_Mahalanobis_dist_size_of_V_does, __pyx_k_Mahalanobis_dist_size_of_V_does, sizeof(__pyx_k_Mahalanobis_dist_size_of_V_does), 0, 0, 1, 0}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, + {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_kp_s_MinkowskiDistance_requires_finit, __pyx_k_MinkowskiDistance_requires_finit, sizeof(__pyx_k_MinkowskiDistance_requires_finit), 0, 0, 1, 0}, + {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, + {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, + {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, + {&__pyx_n_s_PyFuncDistance, __pyx_k_PyFuncDistance, sizeof(__pyx_k_PyFuncDistance), 0, 0, 1, 1}, + {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_kp_s_SEuclidean_dist_size_of_V_does_n, __pyx_k_SEuclidean_dist_size_of_V_does_n, sizeof(__pyx_k_SEuclidean_dist_size_of_V_does_n), 0, 0, 1, 0}, + {&__pyx_kp_b_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 0, 0}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, + {&__pyx_kp_s_Unrecognized_metric_s, __pyx_k_Unrecognized_metric_s, sizeof(__pyx_k_Unrecognized_metric_s), 0, 0, 1, 0}, + {&__pyx_n_s_V, __pyx_k_V, sizeof(__pyx_k_V), 0, 0, 1, 1}, + {&__pyx_n_s_VI, __pyx_k_VI, sizeof(__pyx_k_VI), 0, 0, 1, 1}, + {&__pyx_kp_s_V_VI_must_be_square, __pyx_k_V_VI_must_be_square, sizeof(__pyx_k_V_VI_must_be_square), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_kp_s_WMinkowskiDistance_dist_size_of, __pyx_k_WMinkowskiDistance_dist_size_of, sizeof(__pyx_k_WMinkowskiDistance_dist_size_of), 0, 0, 1, 0}, + {&__pyx_kp_s_WMinkowskiDistance_requires_fini, __pyx_k_WMinkowskiDistance_requires_fini, sizeof(__pyx_k_WMinkowskiDistance_requires_fini), 0, 0, 1, 0}, + {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1}, + {&__pyx_kp_s_X_and_Y_must_have_the_same_secon, __pyx_k_X_and_Y_must_have_the_same_secon, sizeof(__pyx_k_X_and_Y_must_have_the_same_secon), 0, 0, 1, 0}, + {&__pyx_n_s_Y, __pyx_k_Y, sizeof(__pyx_k_Y), 0, 0, 1, 1}, + {&__pyx_kp_b__37, __pyx_k__37, sizeof(__pyx_k__37), 0, 0, 0, 0}, + {&__pyx_kp_b__38, __pyx_k__38, sizeof(__pyx_k__38), 0, 0, 0, 0}, + {&__pyx_kp_b__39, __pyx_k__39, sizeof(__pyx_k__39), 0, 0, 0, 0}, + {&__pyx_kp_b__40, __pyx_k__40, sizeof(__pyx_k__40), 0, 0, 0, 0}, + {&__pyx_kp_u__41, __pyx_k__41, sizeof(__pyx_k__41), 0, 1, 0, 0}, + {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_arcsin, __pyx_k_arcsin, sizeof(__pyx_k_arcsin), 0, 0, 1, 1}, + {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_braycurtis, __pyx_k_braycurtis, sizeof(__pyx_k_braycurtis), 0, 0, 1, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_canberra, __pyx_k_canberra, sizeof(__pyx_k_canberra), 0, 0, 1, 1}, + {&__pyx_n_s_chebyshev, __pyx_k_chebyshev, sizeof(__pyx_k_chebyshev), 0, 0, 1, 1}, + {&__pyx_n_s_cityblock, __pyx_k_cityblock, sizeof(__pyx_k_cityblock), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_dice, __pyx_k_dice, sizeof(__pyx_k_dice), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_euclidean, __pyx_k_euclidean, sizeof(__pyx_k_euclidean), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, + {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, + {&__pyx_n_s_func, __pyx_k_func, sizeof(__pyx_k_func), 0, 0, 1, 1}, + {&__pyx_kp_s_func_must_be_a_callable_taking_t, __pyx_k_func_must_be_a_callable_taking_t, sizeof(__pyx_k_func_must_be_a_callable_taking_t), 0, 0, 1, 0}, + {&__pyx_kp_s_func_must_return_a_float, __pyx_k_func_must_return_a_float, sizeof(__pyx_k_func_must_return_a_float), 0, 0, 1, 0}, + {&__pyx_n_s_get_metric, __pyx_k_get_metric, sizeof(__pyx_k_get_metric), 0, 0, 1, 1}, + {&__pyx_n_s_get_valid_metric_ids, __pyx_k_get_valid_metric_ids, sizeof(__pyx_k_get_valid_metric_ids), 0, 0, 1, 1}, + {&__pyx_kp_u_get_valid_metric_ids_line_92, __pyx_k_get_valid_metric_ids_line_92, sizeof(__pyx_k_get_valid_metric_ids_line_92), 0, 1, 0, 0}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, + {&__pyx_n_s_hamming, __pyx_k_hamming, sizeof(__pyx_k_hamming), 0, 0, 1, 1}, + {&__pyx_n_s_haversine, __pyx_k_haversine, sizeof(__pyx_k_haversine), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1}, + {&__pyx_n_s_infinity, __pyx_k_infinity, sizeof(__pyx_k_infinity), 0, 0, 1, 1}, + {&__pyx_n_s_inv, __pyx_k_inv, sizeof(__pyx_k_inv), 0, 0, 1, 1}, + {&__pyx_n_s_isinf, __pyx_k_isinf, sizeof(__pyx_k_isinf), 0, 0, 1, 1}, + {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_jaccard, __pyx_k_jaccard, sizeof(__pyx_k_jaccard), 0, 0, 1, 1}, + {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, + {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1}, + {&__pyx_n_s_kulsinski, __pyx_k_kulsinski, sizeof(__pyx_k_kulsinski), 0, 0, 1, 1}, + {&__pyx_n_s_l1, __pyx_k_l1, sizeof(__pyx_k_l1), 0, 0, 1, 1}, + {&__pyx_n_s_l2, __pyx_k_l2, sizeof(__pyx_k_l2), 0, 0, 1, 1}, + {&__pyx_n_s_linalg, __pyx_k_linalg, sizeof(__pyx_k_linalg), 0, 0, 1, 1}, + {&__pyx_n_s_mahalanobis, __pyx_k_mahalanobis, sizeof(__pyx_k_mahalanobis), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_manhattan, __pyx_k_manhattan, sizeof(__pyx_k_manhattan), 0, 0, 1, 1}, + {&__pyx_n_s_matching, __pyx_k_matching, sizeof(__pyx_k_matching), 0, 0, 1, 1}, + {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_metric, __pyx_k_metric, sizeof(__pyx_k_metric), 0, 0, 1, 1}, + {&__pyx_n_s_minkowski, __pyx_k_minkowski, sizeof(__pyx_k_minkowski), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, + {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__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_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, + {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1}, + {&__pyx_kp_s_p_must_be_greater_than_1, __pyx_k_p_must_be_greater_than_1, sizeof(__pyx_k_p_must_be_greater_than_1), 0, 0, 1, 0}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1}, + {&__pyx_n_s_pyfunc, __pyx_k_pyfunc, sizeof(__pyx_k_pyfunc), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_rogerstanimoto, __pyx_k_rogerstanimoto, sizeof(__pyx_k_rogerstanimoto), 0, 0, 1, 1}, + {&__pyx_n_s_russellrao, __pyx_k_russellrao, sizeof(__pyx_k_russellrao), 0, 0, 1, 1}, + {&__pyx_kp_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 0}, + {&__pyx_kp_s_scikit_learn_sklearn_neighbors, __pyx_k_scikit_learn_sklearn_neighbors, sizeof(__pyx_k_scikit_learn_sklearn_neighbors), 0, 0, 1, 0}, + {&__pyx_n_s_seuclidean, __pyx_k_seuclidean, sizeof(__pyx_k_seuclidean), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_sin, __pyx_k_sin, sizeof(__pyx_k_sin), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_sklearn_neighbors_dist_metrics, __pyx_k_sklearn_neighbors_dist_metrics, sizeof(__pyx_k_sklearn_neighbors_dist_metrics), 0, 0, 1, 1}, + {&__pyx_n_s_sokalmichener, __pyx_k_sokalmichener, sizeof(__pyx_k_sokalmichener), 0, 0, 1, 1}, + {&__pyx_n_s_sokalsneath, __pyx_k_sokalsneath, sizeof(__pyx_k_sokalsneath), 0, 0, 1, 1}, + {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, + {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, + {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_typedefs, __pyx_k_typedefs, sizeof(__pyx_k_typedefs), 0, 0, 1, 1}, + {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, + {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1}, + {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, + {&__pyx_n_s_wminkowski, __pyx_k_wminkowski, sizeof(__pyx_k_wminkowski), 0, 0, 1, 1}, + {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 - __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -24622,9 +26243,9 @@ static int __Pyx_InitCachedConstants(void) { * self.mat = np.zeros((1, 1), dtype=DTYPE, order='c') * self.vec_ptr = get_vec_ptr(self.vec) */ - __pyx_k_tuple_1 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_1); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); + __pyx_tuple_ = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); /* "sklearn/neighbors/dist_metrics.pyx":212 * self.p = 2 @@ -24633,397 +26254,375 @@ static int __Pyx_InitCachedConstants(void) { * self.vec_ptr = get_vec_ptr(self.vec) * self.mat_ptr = get_mat_ptr(self.mat) */ - __pyx_k_tuple_2 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_2); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - __pyx_k_tuple_3 = PyTuple_Pack(1, ((PyObject *)__pyx_k_tuple_2)); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_3); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); + __pyx_tuple__2 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_tuple__2); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); - /* "sklearn/neighbors/dist_metrics.pyx":270 + /* "sklearn/neighbors/dist_metrics.pyx":275 * # In Minkowski special cases, return more efficient methods * if metric is MinkowskiDistance: * p = kwargs.pop('p', 2) # <<<<<<<<<<<<<< * if p == 1: * return ManhattanDistance(**kwargs) */ - __pyx_k_tuple_5 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__p), __pyx_int_2); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_5); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_p, __pyx_int_2); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); - /* "sklearn/neighbors/dist_metrics.pyx":284 + /* "sklearn/neighbors/dist_metrics.pyx":289 * def __init__(self): * if self.__class__ is DistanceMetric: * raise NotImplementedError("DistanceMetric is an abstract class") # <<<<<<<<<<<<<< * * cdef DTYPE_t dist(self, DTYPE_t* x1, DTYPE_t* x2, ITYPE_t size) except -1: */ - __pyx_k_tuple_7 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_7); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_DistanceMetric_is_an_abstract_cl); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); - /* "sklearn/neighbors/dist_metrics.pyx":319 + /* "sklearn/neighbors/dist_metrics.pyx":324 * cdef ITYPE_t i1, i2 * if X.shape[1] != Y.shape[1]: * raise ValueError('X and Y must have the same second dimension') # <<<<<<<<<<<<<< * for i1 in range(X.shape[0]): * for i2 in range(Y.shape[0]): */ - __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_9); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_X_and_Y_must_have_the_same_secon); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); - /* "sklearn/neighbors/dist_metrics.pyx":444 + /* "sklearn/neighbors/dist_metrics.pyx":449 * ITYPE_t size) except -1: * if size != self.size: * raise ValueError('SEuclidean dist: size of V does not match') # <<<<<<<<<<<<<< * cdef DTYPE_t tmp, d=0 * cdef np.intp_t j */ - __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_10)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_11); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_SEuclidean_dist_size_of_V_does_n); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); - /* "sklearn/neighbors/dist_metrics.pyx":527 + /* "sklearn/neighbors/dist_metrics.pyx":532 * def __init__(self, p): * if p < 1: * raise ValueError("p must be greater than 1") # <<<<<<<<<<<<<< * elif np.isinf(p): * raise ValueError("MinkowskiDistance requires finite p. " */ - __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_13); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_p_must_be_greater_than_1); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "sklearn/neighbors/dist_metrics.pyx":529 + /* "sklearn/neighbors/dist_metrics.pyx":534 * raise ValueError("p must be greater than 1") * elif np.isinf(p): * raise ValueError("MinkowskiDistance requires finite p. " # <<<<<<<<<<<<<< * "For p=inf, use ChebyshevDistance.") * self.p = p */ - __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_15); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_MinkowskiDistance_requires_finit); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "sklearn/neighbors/dist_metrics.pyx":579 + /* "sklearn/neighbors/dist_metrics.pyx":584 * def __init__(self, p, w): * if p < 1: * raise ValueError("p must be greater than 1") # <<<<<<<<<<<<<< * elif np.isinf(p): * raise ValueError("WMinkowskiDistance requires finite p. " */ - __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_12)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_16); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_p_must_be_greater_than_1); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); - /* "sklearn/neighbors/dist_metrics.pyx":581 + /* "sklearn/neighbors/dist_metrics.pyx":586 * raise ValueError("p must be greater than 1") * elif np.isinf(p): * raise ValueError("WMinkowskiDistance requires finite p. " # <<<<<<<<<<<<<< * "For p=inf, use ChebyshevDistance.") * self.p = p */ - __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_18); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_WMinkowskiDistance_requires_fini); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); - /* "sklearn/neighbors/dist_metrics.pyx":591 + /* "sklearn/neighbors/dist_metrics.pyx":596 * ITYPE_t size) except -1: * if size != self.size: * raise ValueError('WMinkowskiDistance dist: ' # <<<<<<<<<<<<<< * 'size of w does not match') * cdef DTYPE_t d=0 */ - __pyx_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_20); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_WMinkowskiDistance_dist_size_of); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); - /* "sklearn/neighbors/dist_metrics.pyx":638 + /* "sklearn/neighbors/dist_metrics.pyx":643 * VI = np.linalg.inv(V) * if VI.ndim != 2 or VI.shape[0] != VI.shape[1]: * raise ValueError("V/VI must be square") # <<<<<<<<<<<<<< * * self.mat = np.asarray(VI, dtype=float, order='C') */ - __pyx_k_tuple_22 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_21)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_22); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_V_VI_must_be_square); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); - /* "sklearn/neighbors/dist_metrics.pyx":652 + /* "sklearn/neighbors/dist_metrics.pyx":657 * ITYPE_t size) except -1: * if size != self.size: * raise ValueError('Mahalanobis dist: size of V does not match') # <<<<<<<<<<<<<< * * cdef DTYPE_t tmp, d = 0 */ - __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_24); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Mahalanobis_dist_size_of_V_does); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); - /* "sklearn/neighbors/dist_metrics.pyx":970 + /* "sklearn/neighbors/dist_metrics.pyx":975 * ITYPE_t size) except -1: * if size != 2: * raise ValueError("Haversine distance only valid in 2 dimensions") # <<<<<<<<<<<<<< * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) * cdef DTYPE_t sin_1 = sin(0.5 * (x1[1] - x2[1])) */ - __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_25)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_26); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Haversine_distance_only_valid_in); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); - /* "sklearn/neighbors/dist_metrics.pyx":978 + /* "sklearn/neighbors/dist_metrics.pyx":983 * ITYPE_t size) except -1: * if size != 2: * raise ValueError("Haversine distance only valid in 2 dimensions") # <<<<<<<<<<<<<< * cdef DTYPE_t sin_0 = sin(0.5 * (x1[0] - x2[0])) * cdef DTYPE_t sin_1 = sin(0.5 * (x1[1] - x2[1])) */ - __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_25)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_27); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Haversine_distance_only_valid_in); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); - /* "sklearn/neighbors/dist_metrics.pyx":1076 + /* "sklearn/neighbors/dist_metrics.pyx":1081 * def __init__(self, func, **kwargs): * self.func = func * x = np.random.random(10) # <<<<<<<<<<<<<< * try: * d = self.func(x, x, **kwargs) */ - __pyx_k_tuple_28 = PyTuple_Pack(1, __pyx_int_10); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_28); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_int_10); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); - /* "sklearn/neighbors/dist_metrics.pyx":1080 + /* "sklearn/neighbors/dist_metrics.pyx":1085 * d = self.func(x, x, **kwargs) * except TypeError: * raise ValueError("func must be a callable taking two arrays") # <<<<<<<<<<<<<< * * try: */ - __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_29)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_30); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_func_must_be_a_callable_taking_t); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); - /* "sklearn/neighbors/dist_metrics.pyx":1085 + /* "sklearn/neighbors/dist_metrics.pyx":1090 * d = float(d) * except TypeError: * raise ValueError("func must return a float") # <<<<<<<<<<<<<< * * self.kwargs = kwargs */ - __pyx_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_32); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_func_must_return_a_float); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); - /* "numpy.pxd":215 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_33)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_34); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); - /* "numpy.pxd":219 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_36 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_35)); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_36); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); - /* "numpy.pxd":257 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_37)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_38); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); - /* "numpy.pxd":799 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":799 * - * if (end - f) - (new_offset - offset[0]) < 15: + * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_40)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_41); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); - /* "numpy.pxd":803 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_42 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_37)); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_42); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42)); + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); - /* "numpy.pxd":823 + /* "../../../usr/local/lib/python3.4/dist-packages/Cython/Includes/numpy/__init__.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_44 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_43)); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_44); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44)); + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); - /* "View.MemoryView":124 + /* "View.MemoryView":127 * * if not self.ndim: * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< * - * if self.itemsize <= 0: + * if itemsize <= 0: */ - __pyx_k_tuple_46 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_46); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46)); + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); - /* "View.MemoryView":127 + /* "View.MemoryView":130 * - * if self.itemsize <= 0: + * if itemsize <= 0: * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * - * encode = getattr(format, 'encode', None) - */ - __pyx_k_tuple_48 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_47)); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_48); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48)); - - /* "View.MemoryView":131 - * encode = getattr(format, 'encode', None) - * if encode: - * format = encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format - * self.format = self._format + * if isinstance(format, unicode): */ - __pyx_k_tuple_49 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_49); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); - /* "View.MemoryView":141 - * free(self._shape) - * free(self._strides) - * raise MemoryError("unable to allocate shape or strides.") # <<<<<<<<<<<<<< + /* "View.MemoryView":142 * + * if not self._shape: + * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< * - */ - __pyx_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_51); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); - - /* "View.MemoryView":166 - * decode = getattr(mode, 'decode', None) - * if decode: - * mode = decode('ASCII') # <<<<<<<<<<<<<< - * self.mode = mode * */ - __pyx_k_tuple_54 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_54); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54)); + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); - /* "View.MemoryView":174 + /* "View.MemoryView":170 * self.data = malloc(self.len) * if not self.data: * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< * * if self.dtype_is_object: */ - __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_55)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_56); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56)); + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); - /* "View.MemoryView":190 + /* "View.MemoryView":186 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< * info.buf = self.data * info.len = self.len */ - __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_58); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58)); + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); - /* "View.MemoryView":452 + /* "View.MemoryView":445 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< * else: * if len(self.view.format) == 1: */ - __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_60); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60)); + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); - /* "View.MemoryView":528 + /* "View.MemoryView":521 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([self.view.strides[i] for i in xrange(self.view.ndim)]) */ - __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_62); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); + __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); - /* "View.MemoryView":643 + /* "View.MemoryView":638 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ - __pyx_k_tuple_65 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_65); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65)); + __pyx_slice__33 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__33)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_slice__33); + __Pyx_GIVEREF(__pyx_slice__33); - /* "View.MemoryView":646 + /* "View.MemoryView":641 * seen_ellipsis = True * else: * result.append(slice(None)) # <<<<<<<<<<<<<< * have_slices = True * else: */ - __pyx_k_tuple_66 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_66); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66)); + __pyx_slice__34 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__34)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_slice__34); + __Pyx_GIVEREF(__pyx_slice__34); - /* "View.MemoryView":657 + /* "View.MemoryView":652 * nslices = ndim - len(result) * if nslices: * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< * * return have_slices or nslices, tuple(result) */ - __pyx_k_tuple_68 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_68); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68)); + __pyx_slice__35 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__35)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_slice__35); + __Pyx_GIVEREF(__pyx_slice__35); - /* "View.MemoryView":665 + /* "View.MemoryView":660 * for i in range(ndim): * if suboffsets[i] >= 0: * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< * * */ - __pyx_k_tuple_70 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_69)); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_70); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70)); + __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); /* "sklearn/neighbors/dist_metrics.pyx":58 * # newObj function @@ -25032,10 +26631,10 @@ static int __Pyx_InitCachedConstants(void) { * return obj.__new__(obj) * */ - __pyx_k_tuple_85 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__obj)); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_85); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85)); - __pyx_k_codeobj_86 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_87, __pyx_n_s__newObj, 58, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_86)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__42 = PyTuple_Pack(1, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__42)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_scikit_learn_sklearn_neighbors, __pyx_n_s_newObj, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":92 * @@ -25044,65 +26643,65 @@ static int __Pyx_InitCachedConstants(void) { * """Given an iterable of metric class names or class identifiers, * return a list of metric IDs which map to those classes. */ - __pyx_k_tuple_89 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__L), ((PyObject *)__pyx_n_s__key), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_89); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89)); - __pyx_k_codeobj_90 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_87, __pyx_n_s_91, 92, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_90)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__44 = PyTuple_Pack(3, __pyx_n_s_L, __pyx_n_s_key, __pyx_n_s_val); if (unlikely(!__pyx_tuple__44)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_scikit_learn_sklearn_neighbors, __pyx_n_s_get_valid_metric_ids, 92, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":282 + /* "View.MemoryView":276 * return self.name * * cdef generic = Enum("") # <<<<<<<<<<<<<< * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_k_tuple_96 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_95)); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_96); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96)); + __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__46)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); - /* "View.MemoryView":283 + /* "View.MemoryView":277 * * cdef generic = Enum("") * cdef strided = Enum("") # default # <<<<<<<<<<<<<< * cdef indirect = Enum("") * */ - __pyx_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_97)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_98); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98)); + __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); - /* "View.MemoryView":284 + /* "View.MemoryView":278 * cdef generic = Enum("") * cdef strided = Enum("") # default * cdef indirect = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_k_tuple_100 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_99)); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_100); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100)); + __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__48)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); - /* "View.MemoryView":287 + /* "View.MemoryView":281 * * * cdef contiguous = Enum("") # <<<<<<<<<<<<<< * cdef indirect_contiguous = Enum("") * */ - __pyx_k_tuple_102 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_101)); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_102); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_102)); + __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__49); + __Pyx_GIVEREF(__pyx_tuple__49); - /* "View.MemoryView":288 + /* "View.MemoryView":282 * * cdef contiguous = Enum("") * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_k_tuple_104 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_103)); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_104); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104)); + __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__50)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -25112,12 +26711,12 @@ static int __Pyx_InitCachedConstants(void) { static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[1]; __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[1]; __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[1]; __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[1]; __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[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[1]; __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[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) {__pyx_filename = __pyx_f[1]; __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[1]; __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[1]; __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[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[1]; __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[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -25169,34 +26768,34 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("dist_metrics"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + __pyx_m = Py_InitModule4("dist_metrics", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_d); - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!PyDict_GetItemString(modules, "sklearn.neighbors.dist_metrics")) { - if (unlikely(PyDict_SetItemString(modules, "sklearn.neighbors.dist_metrics", __pyx_m) < 0)) {__pyx_filename = __pyx_f[1]; __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[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[1]; __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[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__pyx_module_is_main_sklearn__neighbors__dist_metrics) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[1]; __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[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.neighbors.dist_metrics")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.neighbors.dist_metrics", __pyx_m) < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } + #endif /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ @@ -25210,8 +26809,6 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_DistanceMetric; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DistanceMetric.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_dist; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DistanceMetric.rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric_rdist; @@ -25220,109 +26817,52 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DistanceMetric._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric__rdist_to_dist; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DistanceMetric._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_14DistanceMetric__dist_to_rdist; if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "DistanceMetric", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "DistanceMetric", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric = &__pyx_type_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; - __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; - __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; - __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; - __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; - __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; - __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; - __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_memoryview_type = &__pyx_type___pyx_memoryview; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17KulsinskiDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "KulsinskiDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_19SokalSneathDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SokalSneathDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_dist; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base.rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_rdist; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance__rdist_to_dist; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance__dist_to_rdist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SEuclideanDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_JaccardDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_JaccardDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_JaccardDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_JaccardDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_15JaccardDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_JaccardDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "JaccardDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_JaccardDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HammingDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_HammingDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HammingDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HammingDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_15HammingDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HammingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "HammingDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_HammingDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18BrayCurtisDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BrayCurtisDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_CanberraDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_CanberraDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_CanberraDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_CanberraDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_16CanberraDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_CanberraDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "CanberraDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_CanberraDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18RussellRaoDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "RussellRaoDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_EuclideanDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_dist; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.__pyx_base.rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance_rdist; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.__pyx_base._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance__rdist_to_dist; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.__pyx_base._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance__dist_to_rdist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_EuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "EuclideanDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_dist; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base.rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_rdist; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance__rdist_to_dist; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance__dist_to_rdist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "WMinkowskiDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.__pyx_base._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance__rdist_to_dist; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.__pyx_base._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17EuclideanDistance__dist_to_rdist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_EuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "EuclideanDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_EuclideanDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_dist; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base.rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance_rdist; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance__rdist_to_dist; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.__pyx_base._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18SEuclideanDistance__dist_to_rdist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "SEuclideanDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ManhattanDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ManhattanDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ManhattanDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ManhattanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "ManhattanDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "ChebyshevDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance_dist; @@ -25330,10 +26870,23 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance.__pyx_base._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance__rdist_to_dist; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance.__pyx_base._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17MinkowskiDistance__dist_to_rdist; __pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "MinkowskiDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "MinkowskiDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_dist; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base.rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance_rdist; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance__rdist_to_dist; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.__pyx_base._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18WMinkowskiDistance__dist_to_rdist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "WMinkowskiDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance; __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance_dist; @@ -25341,68 +26894,110 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance.__pyx_base._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance__rdist_to_dist; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance.__pyx_base._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_19MahalanobisDistance__dist_to_rdist; __pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "MahalanobisDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "MahalanobisDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ManhattanDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ManhattanDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ManhattanDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17ManhattanDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ManhattanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ManhattanDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_ManhattanDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_21SokalMichenerDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SokalMichenerDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_array_type = &__pyx_type___pyx_array; - __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; - __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; - __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; - __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_22RogersTanimotoDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "RogersTanimotoDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_PyFuncDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_PyFuncDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_PyFuncDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_PyFuncDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_PyFuncDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PyFuncDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_PyFuncDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HammingDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_HammingDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HammingDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HammingDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_15HammingDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HammingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "HammingDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_HammingDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_HammingDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_CanberraDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_CanberraDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_CanberraDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_CanberraDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_16CanberraDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_CanberraDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "CanberraDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_CanberraDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_CanberraDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18BrayCurtisDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "BrayCurtisDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_JaccardDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_JaccardDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_JaccardDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_JaccardDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_15JaccardDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_JaccardDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "JaccardDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_JaccardDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_JaccardDistance; __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MatchingDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_MatchingDistance; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MatchingDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_MatchingDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_16MatchingDistance_dist; __pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MatchingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "MatchingDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_MatchingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "MatchingDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_9neighbors_12dist_metrics_MatchingDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_MatchingDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17ChebyshevDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ChebyshevDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DiceDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_DiceDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DiceDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DiceDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_12DiceDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DiceDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "DiceDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DiceDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17KulsinskiDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "KulsinskiDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_22RogersTanimotoDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "RogersTanimotoDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_18RussellRaoDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "RussellRaoDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_21SokalMichenerDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "SokalMichenerDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_19SokalSneathDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "SokalSneathDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance; __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HaversineDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_HaversineDistance; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HaversineDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HaversineDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17HaversineDistance_dist; @@ -25410,18 +27005,47 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HaversineDistance.__pyx_base._rdist_to_dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17HaversineDistance__rdist_to_dist; __pyx_vtable_7sklearn_9neighbors_12dist_metrics_HaversineDistance.__pyx_base._dist_to_rdist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_17HaversineDistance__dist_to_rdist; __pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HaversineDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "HaversineDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_HaversineDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "HaversineDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_9neighbors_12dist_metrics_HaversineDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_HaversineDistance; - __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DiceDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_DiceDistance; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DiceDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - __pyx_vtable_7sklearn_9neighbors_12dist_metrics_DiceDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_12DiceDistance_dist; - __pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DiceDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "DiceDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DiceDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_DiceDistance; + __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_PyFuncDistance = &__pyx_vtable_7sklearn_9neighbors_12dist_metrics_PyFuncDistance; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_PyFuncDistance.__pyx_base = *__pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + __pyx_vtable_7sklearn_9neighbors_12dist_metrics_PyFuncDistance.__pyx_base.dist = (__pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_12dist_metrics_DistanceMetric *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_DTYPE_t *, __pyx_t_7sklearn_9neighbors_8typedefs_ITYPE_t))__pyx_f_7sklearn_9neighbors_12dist_metrics_14PyFuncDistance_dist; + __pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance.tp_base = __pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric; + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_12dist_metrics_PyFuncDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "PyFuncDistance", (PyObject *)&__pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_9neighbors_12dist_metrics_PyFuncDistance = &__pyx_type_7sklearn_9neighbors_12dist_metrics_PyFuncDistance; + if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type___pyx_array.tp_print = 0; + __pyx_array_type = &__pyx_type___pyx_array; + if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type___pyx_MemviewEnum.tp_print = 0; + __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type___pyx_memoryview.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_memoryview_type = &__pyx_type___pyx_memoryview; + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; + if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type___pyx_memoryviewslice.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY @@ -25446,9 +27070,9 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * cimport numpy as np * np.import_array() # required in order to use C-API */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/neighbors/dist_metrics.pyx":12 @@ -25467,9 +27091,9 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * * from typedefs cimport DTYPE_t, ITYPE_t, DITYPE_t, DTYPECODE */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 49; __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[1]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -25485,22 +27109,22 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) */ __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_n_s__DTYPE)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__DTYPE)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DTYPE)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__ITYPE)); - PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__ITYPE)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ITYPE)); - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__typedefs), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_DTYPE); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DTYPE); + __Pyx_GIVEREF(__pyx_n_s_DTYPE); + __Pyx_INCREF(__pyx_n_s_ITYPE); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ITYPE); + __Pyx_GIVEREF(__pyx_n_s_ITYPE); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_typedefs, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__ITYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ITYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __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; @@ -25511,9 +27135,9 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * return obj.__new__(obj) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_9neighbors_12dist_metrics_1newObj, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_9neighbors_12dist_metrics_1newObj, NULL, __pyx_n_s_sklearn_neighbors_dist_metrics); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__newObj, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_newObj, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/neighbors/dist_metrics.pyx":65 @@ -25524,8 +27148,8 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'minkowski': MinkowskiDistance, */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__euclidean), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_euclidean, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":66 * # These map from metric id strings to class names @@ -25534,7 +27158,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'minkowski': MinkowskiDistance, * 'p': MinkowskiDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l2), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_l2, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_EuclideanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":67 * METRIC_MAPPING = {'euclidean': EuclideanDistance, @@ -25543,7 +27167,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'p': MinkowskiDistance, * 'manhattan': ManhattanDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__minkowski), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_minkowski, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":68 * 'l2': EuclideanDistance, @@ -25552,7 +27176,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'manhattan': ManhattanDistance, * 'cityblock': ManhattanDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__p), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_p, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MinkowskiDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":69 * 'minkowski': MinkowskiDistance, @@ -25561,7 +27185,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'cityblock': ManhattanDistance, * 'l1': ManhattanDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__manhattan), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_manhattan, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":70 * 'p': MinkowskiDistance, @@ -25570,7 +27194,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'l1': ManhattanDistance, * 'chebyshev': ChebyshevDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__cityblock), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_cityblock, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":71 * 'manhattan': ManhattanDistance, @@ -25579,7 +27203,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'chebyshev': ChebyshevDistance, * 'infinity': ChebyshevDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l1), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_l1, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ManhattanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":72 * 'cityblock': ManhattanDistance, @@ -25588,7 +27212,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'infinity': ChebyshevDistance, * 'seuclidean': SEuclideanDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__chebyshev), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_chebyshev, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":73 * 'l1': ManhattanDistance, @@ -25597,7 +27221,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'seuclidean': SEuclideanDistance, * 'mahalanobis': MahalanobisDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__infinity), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_infinity, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_ChebyshevDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":74 * 'chebyshev': ChebyshevDistance, @@ -25606,7 +27230,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'mahalanobis': MahalanobisDistance, * 'wminkowski': WMinkowskiDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__seuclidean), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_seuclidean, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SEuclideanDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":75 * 'infinity': ChebyshevDistance, @@ -25615,7 +27239,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'wminkowski': WMinkowskiDistance, * 'hamming': HammingDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mahalanobis), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mahalanobis, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MahalanobisDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":76 * 'seuclidean': SEuclideanDistance, @@ -25624,7 +27248,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'hamming': HammingDistance, * 'canberra': CanberraDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__wminkowski), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_wminkowski, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_WMinkowskiDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":77 * 'mahalanobis': MahalanobisDistance, @@ -25633,7 +27257,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'canberra': CanberraDistance, * 'braycurtis': BrayCurtisDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__hamming), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_HammingDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_hamming, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_HammingDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":78 * 'wminkowski': WMinkowskiDistance, @@ -25642,7 +27266,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'braycurtis': BrayCurtisDistance, * 'matching': MatchingDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__canberra), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_CanberraDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_canberra, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_CanberraDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":79 * 'hamming': HammingDistance, @@ -25651,7 +27275,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'matching': MatchingDistance, * 'jaccard': JaccardDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__braycurtis), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_braycurtis, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_BrayCurtisDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":80 * 'canberra': CanberraDistance, @@ -25660,7 +27284,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'jaccard': JaccardDistance, * 'dice': DiceDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__matching), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MatchingDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_matching, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_MatchingDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":81 * 'braycurtis': BrayCurtisDistance, @@ -25669,7 +27293,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'dice': DiceDistance, * 'kulsinski': KulsinskiDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__jaccard), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_JaccardDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_jaccard, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_JaccardDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":82 * 'matching': MatchingDistance, @@ -25678,7 +27302,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'kulsinski': KulsinskiDistance, * 'rogerstanimoto': RogersTanimotoDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dice), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DiceDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dice, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DiceDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":83 * 'jaccard': JaccardDistance, @@ -25687,7 +27311,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'rogerstanimoto': RogersTanimotoDistance, * 'russellrao': RussellRaoDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__kulsinski), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_kulsinski, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_KulsinskiDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":84 * 'dice': DiceDistance, @@ -25696,7 +27320,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'russellrao': RussellRaoDistance, * 'sokalmichener': SokalMichenerDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__rogerstanimoto), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rogerstanimoto, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_RogersTanimotoDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":85 * 'kulsinski': KulsinskiDistance, @@ -25705,7 +27329,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'sokalmichener': SokalMichenerDistance, * 'sokalsneath': SokalSneathDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__russellrao), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_russellrao, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_RussellRaoDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":86 * 'rogerstanimoto': RogersTanimotoDistance, @@ -25714,7 +27338,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'sokalsneath': SokalSneathDistance, * 'haversine': HaversineDistance, */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sokalmichener), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sokalmichener, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalMichenerDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":87 * 'russellrao': RussellRaoDistance, @@ -25723,7 +27347,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'haversine': HaversineDistance, * 'pyfunc': PyFuncDistance} */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sokalsneath), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sokalsneath, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_SokalSneathDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":88 * 'sokalmichener': SokalMichenerDistance, @@ -25732,7 +27356,7 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * 'pyfunc': PyFuncDistance} * */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__haversine), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_HaversineDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_haversine, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_HaversineDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/neighbors/dist_metrics.pyx":89 * 'sokalsneath': SokalSneathDistance, @@ -25741,9 +27365,9 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * * */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pyfunc), ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_PyFuncDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_d, __pyx_n_s__METRIC_MAPPING, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_pyfunc, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_PyFuncDistance))) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_METRIC_MAPPING, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/neighbors/dist_metrics.pyx":92 * @@ -25752,24 +27376,32 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * """Given an iterable of metric class names or class identifiers, * return a list of metric IDs which map to those classes. */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_9neighbors_12dist_metrics_3get_valid_metric_ids, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_9neighbors_12dist_metrics_3get_valid_metric_ids, NULL, __pyx_n_s_sklearn_neighbors_dist_metrics); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_91, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_valid_metric_ids, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/dist_metrics.pyx":241 + /* "sklearn/neighbors/dist_metrics.pyx":246 * * @classmethod * def get_metric(cls, metric, **kwargs): # <<<<<<<<<<<<<< * """Get the given distance metric from the string identifier. * */ - __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric, __pyx_n_s__get_metric); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric, __pyx_n_s_get_metric); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/neighbors/dist_metrics.pyx":245 + * self.size = 1 + * + * @classmethod # <<<<<<<<<<<<<< + * def get_metric(cls, metric, **kwargs): + * """Get the given distance metric from the string identifier. + */ + __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric->tp_dict, __pyx_n_s__get_metric, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric->tp_dict, __pyx_n_s_get_metric, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7sklearn_9neighbors_12dist_metrics_DistanceMetric); @@ -25779,138 +27411,138 @@ PyMODINIT_FUNC PyInit_dist_metrics(void) * #cython: wraparound=False */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_92), ((PyObject *)__pyx_kp_u_93)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_get_valid_metric_ids_line_92, __pyx_kp_u_Given_an_iterable_of_metric_clas) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":207 + /* "View.MemoryView":203 * info.obj = self * * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * def __dealloc__(array self): */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_94); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_getbuffer_obj_view_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_array_type); - /* "View.MemoryView":282 + /* "View.MemoryView":276 * return self.name * * cdef generic = Enum("") # <<<<<<<<<<<<<< * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(generic); - __Pyx_DECREF(generic); + __Pyx_DECREF_SET(generic, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - generic = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":283 + /* "View.MemoryView":277 * * cdef generic = Enum("") * cdef strided = Enum("") # default # <<<<<<<<<<<<<< * cdef indirect = Enum("") * */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(strided); - __Pyx_DECREF(strided); + __Pyx_DECREF_SET(strided, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - strided = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":284 + /* "View.MemoryView":278 * cdef generic = Enum("") * cdef strided = Enum("") # default * cdef indirect = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(indirect); - __Pyx_DECREF(indirect); + __Pyx_DECREF_SET(indirect, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - indirect = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":287 + /* "View.MemoryView":281 * * * cdef contiguous = Enum("") # <<<<<<<<<<<<<< * cdef indirect_contiguous = Enum("") * */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(contiguous); - __Pyx_DECREF(contiguous); + __Pyx_DECREF_SET(contiguous, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - contiguous = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":288 + /* "View.MemoryView":282 * * cdef contiguous = Enum("") * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - indirect_contiguous = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":503 + /* "View.MemoryView":496 * info.obj = self * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_94); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_getbuffer_obj_view_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_memoryview_type); - /* "View.MemoryView":958 + /* "View.MemoryView":953 * return self.from_object * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_94); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_getbuffer_obj_view_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_memoryviewslice_type); - /* "BufferFormatFromTypeInfo":1421 + /* "BufferFormatFromTypeInfo":1417 * * @cname('__pyx_format_from_typeinfo') * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type): # <<<<<<<<<<<<<< * cdef __Pyx_StructField *field * cdef __pyx_typeinfo_string fmt */ + + /*--- Wrapped vars code ---*/ + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { - __Pyx_AddTraceback("init sklearn.neighbors.dist_metrics", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__pyx_d) { + __Pyx_AddTraceback("init sklearn.neighbors.dist_metrics", __pyx_clineno, __pyx_lineno, __pyx_filename); + } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init sklearn.neighbors.dist_metrics"); @@ -25939,7 +27571,7 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } -#endif /* CYTHON_REFNANNY */ +#endif static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); @@ -25948,7 +27580,7 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else - "name '%s' is not defined", PyString_AS_STRING(name)); + "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; @@ -26002,7 +27634,7 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { } static int __Pyx_BufFmt_ExpectNumber(const char **ts) { int number = __Pyx_BufFmt_ParseNumber(ts); - if (number == -1) /* First char was not a digit */ + if (number == -1) PyErr_Format(PyExc_ValueError,\ "Does not understand character buffer dtype format string ('%c')", **ts); return number; @@ -26247,7 +27879,7 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { ctx->fmt_offset += size; if (arraysize) ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; /* Consume from buffer string */ + --ctx->enc_count; while (1) { if (field == &ctx->root) { ctx->head = NULL; @@ -26255,7 +27887,7 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } - break; /* breaks both loops as ctx->enc_count == 0 */ + break; } ctx->head->field = ++field; if (field->type == NULL) { @@ -26264,7 +27896,7 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; /* empty struct */ + if (field->type->fields->type == NULL) continue; field = field->type->fields; ++ctx->head; ctx->head->field = field; @@ -26294,8 +27926,10 @@ __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; while (*ts && *ts != ')') { - if (isspace(*ts)) - continue; + switch (*ts) { + case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; + default: break; + } number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) @@ -26335,10 +27969,10 @@ 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: + case '\r': + case '\n': ++ts; break; case '<': @@ -26363,7 +27997,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case '^': ctx->new_packmode = *ts++; break; - case 'T': /* substruct */ + case 'T': { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; @@ -26375,7 +28009,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_type = 0; ctx->enc_count = 0; ctx->struct_alignment = 0; ++ts; @@ -26388,12 +28022,12 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; - case '}': /* end of substruct; either repeat or move on */ + case '}': { size_t alignment = ctx->struct_alignment; ++ts; if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_type = 0; if (alignment && ctx->fmt_offset % alignment) { ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); } @@ -26414,21 +28048,25 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; - } /* fall through */ + } 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 's': case 'p': + case 'O': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; - } else { - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; + ctx->new_count = 1; + got_Z = 0; + ++ts; + break; } + case 's': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; ++ts; ctx->new_count = 1; got_Z = 0; @@ -26589,7 +28227,7 @@ __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) int first_time; struct __pyx_memoryview_obj *memview = memslice->memview; if (!memview || (PyObject *) memview == Py_None) - return; /* allow uninitialized memoryview assignment */ + return; if (__pyx_get_slice_count(memview) < 0) __pyx_fatalerror("Acquisition count is %d (line %d)", __pyx_get_slice_count(memview), lineno); @@ -26664,10 +28302,18 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb } static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else @@ -26684,7 +28330,7 @@ static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); + PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) @@ -26694,11 +28340,79 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = func->ob_type->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject* args = PyTuple_Pack(1, arg); + return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL; +} +#endif + static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if CYTHON_COMPILING_IN_CPYTHON result = PyDict_GetItem(__pyx_d, name); - if (result) { + if (likely(result)) { Py_INCREF(result); } else { #else @@ -26711,6 +28425,21 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { return result; } +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); @@ -26718,7 +28447,7 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } @@ -26787,7 +28516,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -26799,36 +28528,156 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings( { PyObject* key = 0; Py_ssize_t pos = 0; -#if CPYTHON_COMPILING_IN_PYPY +#if CYTHON_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))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result = memcmp(ps1, ps2, (size_t)length); + 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; + } +#endif +} + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - return 0; #endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); + Py_XDECREF(owned_ref); #endif - return 0; + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { @@ -27008,12 +28857,12 @@ static int __Pyx_ParseOptionalKeywords( goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); + "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", + "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", @@ -27023,6 +28872,37 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +#else + PyErr_GetExcInfo(type, value, tb); +#endif +} +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(type, value, tb); +#endif +} + static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *local_type, *local_value, *local_tb; #if CYTHON_COMPILING_IN_CPYTHON @@ -27045,12 +28925,14 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif goto bad; #if PY_MAJOR_VERSION >= 3 - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } #endif - Py_INCREF(local_type); - Py_INCREF(local_value); - Py_INCREF(local_tb); + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); *type = local_type; *value = local_value; *tb = local_tb; @@ -27061,8 +28943,6 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; - /* Make sure tstate is in a consistent state when we XDECREF - these objects (DECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); @@ -27098,11 +28978,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, goto raise_error; } } - #if PY_VERSION_HEX < 0x02050000 - if (PyClass_Check(type)) { - #else if (PyType_Check(type)) { - #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); @@ -27117,17 +28993,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, goto raise_error; } value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; - } - #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { @@ -27135,7 +29000,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, "raise: exception class must be a subclass of BaseException"); goto raise_error; } - #endif } __Pyx_ErrRestore(type, value, tb); return; @@ -27145,7 +29009,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, Py_XDECREF(tb); return; } -#else /* Python 3+ */ +#else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { @@ -27166,27 +29030,40 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyEval_CallObject(type, args); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + if (PyObject_IsSubclass(instance_class, type)) { + type = instance_class; + } else { + instance_class = NULL; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } } } else { PyErr_SetString(PyExc_TypeError, @@ -27218,6 +29095,13 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } PyErr_SetObject(type, value); if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(tmp_type, tmp_value, tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { @@ -27225,6 +29109,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } +#endif } bad: Py_XDECREF(owned_instance); @@ -27233,7 +29118,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject #endif static void __Pyx_RaiseBufferFallbackError(void) { - PyErr_Format(PyExc_ValueError, + PyErr_SetString(PyExc_ValueError, "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } @@ -27280,23 +29165,29 @@ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, +static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); +} +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { - if (Py_TYPE(obj) == type) return 1; + if (likely(Py_TYPE(obj) == type)) return 1; + #if PY_MAJOR_VERSION == 2 + else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif } else { - if (PyObject_TypeCheck(obj, type)) return 1; + if (likely(PyObject_TypeCheck(obj, type))) return 1; } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); + __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } @@ -27312,66 +29203,6 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { return PyObject_GetAttr(o, n); } -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - if (!r) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - goto bad; - PyErr_Clear(); - r = d; - Py_INCREF(d); - } - return r; -bad: - return NULL; -} - -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { - #if CYTHON_PEP393_ENABLED - if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0)) - return -1; - if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) { - return (equals == Py_NE); - } else if (PyUnicode_GET_LENGTH(s1) == 1) { - Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0); - Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0); - return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); - #else - if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyUnicode_GET_SIZE(s1) == 1) { - Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0]; - Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0]; - return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); - #endif - } else { - 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; - } -#endif -} - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, @@ -27398,19 +29229,44 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( } } +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; +#else + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); +#endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} + static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } +#if !CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { + return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); +} +#endif + static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) +#if PY_VERSION_HEX >= 0x02070000 PyObject *ob = PyCapsule_New(vtable, 0, 0); #else PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); #endif if (!ob) goto bad; - if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) + if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; @@ -27419,25 +29275,184 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { + PyObject *result; + result = __Pyx_PyObject_GetAttrStr(nmspace, name); + if (!result) + result = __Pyx_GetModuleGlobalName(name); + return result; +} + +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, (size_t)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 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; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - "cannot import name %S", name); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } - return value; + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + __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,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; } - -static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { - PyObject *result; - result = __Pyx_PyObject_GetAttrStr(nmspace, name); - if (!result) - result = __Pyx_GetModuleGlobalName(name); - return result; +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 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_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { @@ -27448,7 +29463,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif @@ -27466,7 +29481,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; - #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { @@ -27488,7 +29502,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyErr_Clear(); } } - level = 0; /* try absolute import on failure */ + level = 0; } #endif if (!module) { @@ -27505,14 +29519,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { #endif } } - #else - if (level>0) { - PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); - goto bad; - } - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, NULL); - #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); @@ -27522,200 +29528,237 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { return module; } -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { - const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(Py_intptr_t) == sizeof(char)) || - (sizeof(Py_intptr_t) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(Py_intptr_t) == sizeof(int)) || - (sizeof(Py_intptr_t) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) { + const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(Py_intptr_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } } else { + if (sizeof(Py_intptr_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; + unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), little, !is_unsigned); } } -static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject* x) { - const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(Py_intptr_t) == sizeof(char)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedChar(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(Py_intptr_t) == sizeof(short)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedShort(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(Py_intptr_t) == sizeof(int)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedInt(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(Py_intptr_t) == sizeof(long)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedLong(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedLongLong(x); - } else { - #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); - #else - Py_intptr_t val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } - #endif - return (Py_intptr_t)-1; +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \ + { \ + func_type value = func_value; \ + if (sizeof(target_type) < sizeof(func_type)) { \ + if (unlikely(value != (func_type) (target_type) value)) { \ + func_type zero = 0; \ + if (is_unsigned && unlikely(value < zero)) \ + goto raise_neg_overflow; \ + else \ + goto raise_overflow; \ + } \ + } \ + return (target_type) value; \ } -} -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -#else - PyErr_GetExcInfo(type, value, tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif #endif -} -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); + +static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) { + const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(Py_intptr_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (Py_intptr_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } + if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long long, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (sizeof(Py_intptr_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyLong_AsLong(x)) + } else if (sizeof(Py_intptr_t) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, long long, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - PyErr_SetExcInfo(type, value, tb); + Py_intptr_t val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } #endif + return (Py_intptr_t) -1; + } + } else { + Py_intptr_t val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (Py_intptr_t) -1; + val = __Pyx_PyInt_As_Py_intptr_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to Py_intptr_t"); + return (Py_intptr_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to Py_intptr_t"); + return (Py_intptr_t) -1; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { - #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 (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - #if PY_VERSION_HEX < 0x02060000 - if (obj->ob_type->tp_dict) { - PyObject *getbuffer_cobj = PyObject_GetItem( - obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer); - if (getbuffer_cobj) { - getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); - 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 + PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *obj = view->obj; 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) { - PyObject *releasebuffer_cobj = PyObject_GetItem( - obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer); - if (releasebuffer_cobj) { - releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); - 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 CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(long) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(int) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} - static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { +static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { #if CYTHON_COMPILING_IN_PYPY - if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) { /* cdef classes */ + if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) { return PyClassMethod_New(method); } #else static PyTypeObject *methoddescr_type = NULL; if (methoddescr_type == NULL) { - PyObject *meth = __Pyx_GetAttrString((PyObject*)&PyList_Type, "append"); + PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append"); if (!meth) return NULL; methoddescr_type = Py_TYPE(meth); Py_DECREF(meth); } - if (PyObject_TypeCheck(method, methoddescr_type)) { /* cdef classes */ + if (PyObject_TypeCheck(method, methoddescr_type)) { PyMethodDescrObject *descr = (PyMethodDescrObject *)method; #if PY_VERSION_HEX < 0x03020000 PyTypeObject *d_type = descr->d_type; @@ -27725,7 +29768,7 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { return PyDescr_NewClassMethod(d_type, descr->d_method); } #endif - else if (PyMethod_Check(method)) { /* python classes */ + else if (PyMethod_Check(method)) { return PyClassMethod_New(PyMethod_GET_FUNCTION(method)); } else if (PyCFunction_Check(method)) { @@ -27736,9 +29779,9 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { return PyClassMethod_New(method); } #endif - PyErr_Format(PyExc_TypeError, - "Class-level classmethod() can only be called on " - "a method_descriptor or instance method."); + PyErr_SetString(PyExc_TypeError, + "Class-level classmethod() can only be called on " + "a method_descriptor or instance method."); return NULL; } @@ -27972,15 +30015,110 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); - z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); - return z; + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(int) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x)) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); + } + #endif +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x)) + } else if (sizeof(int) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x)) + } } - #endif + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } #endif + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice *mvs, @@ -28068,7 +30206,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } __Pyx_GOTREF(shape_tuple); for(i = 0; i < ndim; i++) { - temp_int = PyInt_FromLong(from_mvs->shape[i]); + temp_int = PyInt_FromSsize_t(from_mvs->shape[i]); if(unlikely(!temp_int)) { goto fail; } else { @@ -28109,613 +30247,247 @@ static CYTHON_INLINE PyObject * __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) { PyObject *cobj; -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) +#if PY_VERSION_HEX >= 0x02070000 cobj = PyCapsule_New(p, sig, NULL); #else - cobj = PyCObject_FromVoidPtr(p, NULL); -#endif - return cobj; -} - -static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type) { - struct __pyx_typeinfo_string result = { {0} }; - char *buf = (char *) result.string; - size_t size = type->size; - switch (type->typegroup) { - case 'H': - *buf = 'c'; - break; - case 'I': - case 'U': - if (size == 1) - *buf = 'b'; - else if (size == 2) - *buf = 'h'; - else if (size == 4) - *buf = 'i'; - else if (size == 8) - *buf = 'q'; - if (type->is_unsigned) - *buf = toupper(*buf); - break; - case 'P': - *buf = 'P'; - break; - case 'C': - { - __Pyx_TypeInfo complex_type = *type; - complex_type.typegroup = 'R'; - complex_type.size /= 2; - *buf++ = 'Z'; - *buf = __Pyx_TypeInfoToFormat(&complex_type).string[0]; - break; - } - case 'R': - if (size == 4) - *buf = 'f'; - else if (size == 8) - *buf = 'd'; - else - *buf = 'g'; - break; - } - return result; -} - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { - const unsigned char neg_one = (unsigned char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned char" : - "value too large to convert to unsigned char"); - } - return (unsigned char)-1; - } - return (unsigned char)val; - } - return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { - const unsigned short neg_one = (unsigned short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned short" : - "value too large to convert to unsigned short"); - } - return (unsigned short)-1; - } - return (unsigned short)val; - } - return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { - const unsigned int neg_one = (unsigned int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned int" : - "value too large to convert to unsigned int"); - } - return (unsigned int)-1; - } - return (unsigned int)val; - } - return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { - const char neg_one = (char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to char" : - "value too large to convert to char"); - } - return (char)-1; - } - return (char)val; - } - return (char)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { - const short neg_one = (short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to short" : - "value too large to convert to short"); - } - return (short)-1; - } - return (short)val; - } - return (short)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { - const signed char neg_one = (signed char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed char" : - "value too large to convert to signed char"); - } - return (signed char)-1; - } - return (signed char)val; - } - return (signed char)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { - const signed short neg_one = (signed short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed short" : - "value too large to convert to signed short"); - } - return (signed short)-1; - } - return (signed short)val; - } - return (signed short)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed int" : - "value too large to convert to signed int"); - } - return (signed int)-1; - } - return (signed int)val; - } - return (signed int)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { - const unsigned long neg_one = (unsigned long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return (unsigned long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return (unsigned long)PyLong_AsUnsignedLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - return (unsigned long)PyLong_AsLong(x); - } - } else { - unsigned long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned long)-1; - val = __Pyx_PyInt_AsUnsignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return (unsigned PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); - } - } else { - unsigned PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { - const long neg_one = (long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return (long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return (long)PyLong_AsUnsignedLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - return (long)PyLong_AsLong(x); - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (long)-1; - val = __Pyx_PyInt_AsLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { - const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return (PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - return (PY_LONG_LONG)PyLong_AsLongLong(x); - } - } else { - PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } + cobj = PyCObject_FromVoidPtr(p, NULL); +#endif + return cobj; } -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { - const signed long neg_one = (signed long)-1, const_zero = 0; +static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { + const char neg_one = (char) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; + if (sizeof(char) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (char) val; } - return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; - } + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(char, digit, ((PyLongObject*)x)->ob_digit[0]); } -#endif + #endif #endif if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; + goto raise_neg_overflow; + } + if (sizeof(char) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(char) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long long, PyLong_AsUnsignedLongLong(x)) } - return (signed long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; - } + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(char, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); } + #endif #endif + if (sizeof(char) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(char, long, PyLong_AsLong(x)) + } else if (sizeof(char) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(char, long long, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + char val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } #endif - return (signed long)PyLong_AsLong(x); + return (char) -1; } } else { - signed long val; + char val; PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed long)-1; - val = __Pyx_PyInt_AsSignedLong(tmp); + if (!tmp) return (char) -1; + val = __Pyx_PyInt_As_char(tmp); Py_DECREF(tmp); return val; } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to char"); + return (char) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -1; } -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { - const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; +static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type) { + struct __pyx_typeinfo_string result = { {0} }; + char *buf = (char *) result.string; + size_t size = type->size; + switch (type->typegroup) { + case 'H': + *buf = 'c'; + break; + case 'I': + case 'U': + if (size == 1) + *buf = 'b'; + else if (size == 2) + *buf = 'h'; + else if (size == 4) + *buf = 'i'; + else if (size == 8) + *buf = 'q'; + if (type->is_unsigned) + *buf = toupper(*buf); + break; + case 'P': + *buf = 'P'; + break; + case 'C': + { + __Pyx_TypeInfo complex_type = *type; + complex_type.typegroup = 'R'; + complex_type.size /= 2; + *buf++ = 'Z'; + *buf = __Pyx_TypeInfoToFormat(&complex_type).string[0]; + break; + } + case 'R': + if (size == 4) + *buf = 'f'; + else if (size == 8) + *buf = 'd'; + else + *buf = 'g'; + break; + } + return result; +} + +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (long) val; } - return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]); } -#endif + #endif #endif if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; + goto raise_neg_overflow; + } + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x)) + } else if (sizeof(long) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x)) } - return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); } + #endif #endif + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x)) + } else if (sizeof(long) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x)) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + long val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } #endif - return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + return (long) -1; } } else { - signed PY_LONG_LONG val; + long val; PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsSignedLongLong(tmp); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; } static int @@ -28825,7 +30597,7 @@ __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec if (spec & __Pyx_MEMVIEW_PTR) { if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) { PyErr_Format(PyExc_ValueError, - "Buffer is not indirectly accessisble " + "Buffer is not indirectly accessible " "in dimension %d.", dim); goto fail; } @@ -28971,11 +30743,7 @@ static int __Pyx_check_binary_version(void) { "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); - #if PY_VERSION_HEX < 0x02050000 - return PyErr_Warn(NULL, message); - #else return PyErr_WarnEx(NULL, message, 1); - #endif } return 0; } @@ -29025,7 +30793,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, - "%s.%s is not a type object", + "%.200s.%.200s is not a type object", module_name, class_name); goto bad; } @@ -29045,15 +30813,11 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - #if PY_VERSION_HEX < 0x02050000 - if (PyErr_Warn(NULL, warning) < 0) goto bad; - #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s has the wrong size, try recompiling", + "%.200s.%.200s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -29065,168 +30829,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #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) { - 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 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; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, /*int argcount,*/ - 0, /*int kwonlyargcount,*/ - 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,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, /*int firstlineno,*/ - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - 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,*/ - py_globals, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - py_frame->f_lineno = py_line; - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 @@ -29237,7 +30839,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else /* Python 3+ has unicode identifiers */ + #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); @@ -29257,8 +30859,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; @@ -29287,29 +30889,35 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_ } } } -#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ +#endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; -#else /* PY_VERSION_HEX < 0x03030000 */ - if (PyUnicode_READY(o) == -1) return NULL; +#else + if (__Pyx_PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_DATA_SIZE(o); + *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } -#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#else return PyUnicode_AsUTF8AndSize(o, length); -#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ -#endif /* PY_VERSION_HEX < 0x03030000 */ +#endif +#endif + } else +#endif +#if !CYTHON_COMPILING_IN_PYPY + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); } else -#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ +#endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); - if (r < 0) { + if (unlikely(r < 0)) { return NULL; } else { return result; @@ -29354,7 +30962,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, - "__%s__ returned non-%s (type %.200s)", + "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; @@ -29368,34 +30976,31 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) + return PyInt_AS_LONG(b); +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(b)) { + case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0]; + case 0: return 0; + case 1: return ((PyLongObject*)b)->ob_digit[0]; + } + #endif + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { -#if PY_VERSION_HEX < 0x02050000 - if (ival <= LONG_MAX) - return PyInt_FromLong((long)ival); - else { - unsigned char *bytes = (unsigned char *) &ival; - int one = 1; int little = (int)*(unsigned char*)&one; - return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); - } -#else - return PyInt_FromSize_t(ival); -#endif -} -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { - unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); - if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { - if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t)-1; - } - return (size_t)val; + return PyInt_FromSize_t(ival); } diff --git a/sklearn/neighbors/dist_metrics.pyx b/sklearn/neighbors/dist_metrics.pyx index fe7d6789e4862..c7d399da1a6db 100644 --- a/sklearn/neighbors/dist_metrics.pyx +++ b/sklearn/neighbors/dist_metrics.pyx @@ -224,6 +224,8 @@ cdef class DistanceMetric: """ get state for pickling """ + if self.__class__.__name__ == "PyFuncDistance": + return (float(self.p), self.vec, self.mat, self.func, self.kwargs) return (float(self.p), self.vec, self.mat) def __setstate__(self, state): @@ -233,6 +235,9 @@ cdef class DistanceMetric: self.p = state[0] self.vec = state[1] self.mat = state[2] + if self.__class__.__name__ == "PyFuncDistance": + self.func = state[3] + self.kwargs = state[4] self.vec_ptr = get_vec_ptr(self.vec) self.mat_ptr = get_mat_ptr(self.mat) self.size = 1 From d3fba99814ee1ccffee68eb22d3f45ce3b706125 Mon Sep 17 00:00:00 2001 From: Raghav R V Date: Mon, 9 Mar 2015 06:15:55 +0530 Subject: [PATCH 2/3] TST Add test to make sure BallTree remains picklable even with callable metric --- sklearn/neighbors/tests/test_ball_tree.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/sklearn/neighbors/tests/test_ball_tree.py b/sklearn/neighbors/tests/test_ball_tree.py index 7a26af1833665..55007331ef783 100644 --- a/sklearn/neighbors/tests/test_ball_tree.py +++ b/sklearn/neighbors/tests/test_ball_tree.py @@ -1,3 +1,4 @@ +import pickle import numpy as np from numpy.testing import assert_array_almost_equal from sklearn.neighbors.ball_tree import (BallTree, NeighborsHeap, @@ -29,6 +30,10 @@ 'sokalsneath'] +def dist_func(x1, x2, p): + return np.sum((x1 - x2) ** p) ** (1. / p) + + def brute_force_neighbors(X, Y, k, metric, **kwargs): D = DistanceMetric.get_metric(metric, **kwargs).pairwise(Y, X) ind = np.argsort(D, axis=1)[:, :k] @@ -216,19 +221,32 @@ def check_two_point(r, dualtree): def test_ball_tree_pickle(): - import pickle np.random.seed(0) X = np.random.random((10, 3)) + bt1 = BallTree(X, leaf_size=1) + # Test if BallTree with callable metric is picklable + bt1_pyfunc = BallTree(X, metric=dist_func, leaf_size=1, p=2) + ind1, dist1 = bt1.query(X) + ind1_pyfunc, dist1_pyfunc = bt1_pyfunc.query(X) def check_pickle_protocol(protocol): s = pickle.dumps(bt1, protocol=protocol) bt2 = pickle.loads(s) + + s_pyfunc = pickle.dumps(bt1_pyfunc, protocol=protocol) + bt2_pyfunc = pickle.loads(s_pyfunc) + ind2, dist2 = bt2.query(X) + ind2_pyfunc, dist2_pyfunc = bt2_pyfunc.query(X) + assert_array_almost_equal(ind1, ind2) assert_array_almost_equal(dist1, dist2) + assert_array_almost_equal(ind1_pyfunc, ind2_pyfunc) + assert_array_almost_equal(dist1_pyfunc, dist2_pyfunc) + for protocol in (0, 1, 2): yield check_pickle_protocol, protocol From a685fe541c5209f04a2afcc46d7f2be082f8bad9 Mon Sep 17 00:00:00 2001 From: Raghav R V Date: Tue, 10 Mar 2015 01:46:21 +0530 Subject: [PATCH 3/3] TST make sure DistMetric is picklable with both predefined as well as custom metric --- sklearn/neighbors/tests/test_dist_metrics.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sklearn/neighbors/tests/test_dist_metrics.py b/sklearn/neighbors/tests/test_dist_metrics.py index d49e8ca31461a..96c4f8d6fb241 100644 --- a/sklearn/neighbors/tests/test_dist_metrics.py +++ b/sklearn/neighbors/tests/test_dist_metrics.py @@ -1,4 +1,5 @@ import itertools +import pickle import numpy as np from numpy.testing import assert_array_almost_equal @@ -9,6 +10,10 @@ from nose import SkipTest +def dist_func(x1, x2, p): + return np.sum((x1 - x2) ** p) ** (1. / p) + + def cmp_version(version1, version2): version1 = tuple(map(int, version1.split('.')[:2])) version2 = tuple(map(int, version2.split('.')[:2])) @@ -122,18 +127,24 @@ def haversine_slow(x1, x2): def test_pyfunc_metric(): - def dist_func(x1, x2, p): - return np.sum((x1 - x2) ** p) ** (1. / p) - X = np.random.random((10, 3)) euclidean = DistanceMetric.get_metric("euclidean") pyfunc = DistanceMetric.get_metric("pyfunc", func=dist_func, p=2) + # Check if both callable metric and predefined metric initialized + # DistanceMetric object is picklable + euclidean_pkl = pickle.loads(pickle.dumps(euclidean)) + pyfunc_pkl = pickle.loads(pickle.dumps(pyfunc)) + D1 = euclidean.pairwise(X) D2 = pyfunc.pairwise(X) + D1_pkl = euclidean_pkl.pairwise(X) + D2_pkl = pyfunc_pkl.pairwise(X) + assert_array_almost_equal(D1, D2) + assert_array_almost_equal(D1_pkl, D2_pkl) if __name__ == '__main__':