diff --git a/Orange/distance/_distance.c b/Orange/distance/_distance.c index 1c1f84b50d6..9660c26e414 100644 --- a/Orange/distance/_distance.c +++ b/Orange/distance/_distance.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.28.3 */ +/* Generated by Cython 0.29.13 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -7,8 +7,9 @@ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_28_3" -#define CYTHON_FUTURE_DIVISION 1 +#define CYTHON_ABI "0_29_13" +#define CYTHON_HEX_VERSION 0x001D0DF0 +#define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -78,6 +79,10 @@ #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 @@ -115,6 +120,10 @@ #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 @@ -168,11 +177,17 @@ #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000) + #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #endif + #ifndef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) @@ -182,6 +197,9 @@ #undef SHIFT #undef BASE #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 @@ -292,8 +310,13 @@ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else #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 #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES @@ -308,6 +331,9 @@ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 @@ -321,7 +347,7 @@ #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif @@ -330,6 +356,11 @@ #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 + #define PyMem_RawMalloc(n) PyMem_Malloc(n) + #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) + #define PyMem_RawFree(p) PyMem_Free(p) +#endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) @@ -352,7 +383,7 @@ typedef int Py_tss_t; static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { *key = PyThread_create_key(); - return 0; // PyThread_create_key reports success always + return 0; } static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); @@ -375,7 +406,7 @@ static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } -#endif // TSS (Thread Specific Storage) API +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -437,8 +468,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else @@ -583,7 +614,8 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc 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_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize @@ -599,6 +631,9 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) @@ -657,6 +692,7 @@ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) @@ -737,7 +773,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { 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)); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); @@ -801,6 +837,13 @@ static const char *__pyx_f[] = { "stringsource", "type.pxd", }; +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* MemviewSliceStruct.proto */ struct __pyx_memoryview_obj; typedef struct { @@ -897,20 +940,13 @@ typedef struct { char is_valid_array; } __Pyx_BufFmt_Context; -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - /* ForceInitThreads.proto */ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":730 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -919,7 +955,7 @@ typedef struct { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":731 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -928,7 +964,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":732 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -937,7 +973,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":733 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -946,7 +982,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":737 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -955,7 +991,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":738 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -964,7 +1000,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":739 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -973,7 +1009,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":740 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -982,7 +1018,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":744 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -991,7 +1027,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":745 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1000,7 +1036,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":754 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -1009,7 +1045,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":755 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -1018,7 +1054,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":756 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -1027,7 +1063,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":758 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -1036,7 +1072,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":759 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -1045,7 +1081,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":760 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -1054,7 +1090,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":762 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1063,7 +1099,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":763 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1072,7 +1108,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":765 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1081,7 +1117,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":766 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1090,7 +1126,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":767 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1129,7 +1165,7 @@ struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":769 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1138,7 +1174,7 @@ struct __pyx_memoryviewslice_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":770 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1147,7 +1183,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":771 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1156,7 +1192,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":773 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1165,7 +1201,7 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "View.MemoryView":104 +/* "View.MemoryView":105 * * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< @@ -1190,7 +1226,7 @@ struct __pyx_array_obj { }; -/* "View.MemoryView":278 +/* "View.MemoryView":279 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< @@ -1203,7 +1239,7 @@ struct __pyx_MemviewEnum_obj { }; -/* "View.MemoryView":329 +/* "View.MemoryView":330 * * @cname('__pyx_memoryview') * cdef class memoryview(object): # <<<<<<<<<<<<<< @@ -1226,7 +1262,7 @@ struct __pyx_memoryview_obj { }; -/* "View.MemoryView":960 +/* "View.MemoryView":965 * * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< @@ -1243,7 +1279,7 @@ struct __pyx_memoryviewslice_obj { -/* "View.MemoryView":104 +/* "View.MemoryView":105 * * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< @@ -1257,7 +1293,7 @@ struct __pyx_vtabstruct_array { static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; -/* "View.MemoryView":329 +/* "View.MemoryView":330 * * @cname('__pyx_memoryview') * cdef class memoryview(object): # <<<<<<<<<<<<<< @@ -1277,7 +1313,7 @@ struct __pyx_vtabstruct_memoryview { static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":960 +/* "View.MemoryView":965 * * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< @@ -1364,8 +1400,65 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ + const char* function_name); + +/* PyObjectCall.proto */ +#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 + +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) + #define __Pyx_PyFrame_GetLocalsplus(frame)\ + (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif + +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* MemviewSliceInit.proto */ #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d @@ -1393,18 +1486,6 @@ 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); -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ @@ -1470,14 +1551,51 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif /* ExtTypeTest.proto */ @@ -1489,32 +1607,6 @@ static void __Pyx_RaiseBufferFallbackError(void); /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); @@ -1535,6 +1627,11 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) @@ -1683,9 +1780,9 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace); +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); #else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\ +#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif @@ -1719,6 +1816,9 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif +/* None.proto */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); + /* WriteUnraisableException.proto */ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, @@ -1750,6 +1850,17 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto +#define __PYX_HAVE_RT_ImportType_proto +enum __Pyx_ImportType_CheckSize { + __Pyx_ImportType_CheckSize_Error = 0, + __Pyx_ImportType_CheckSize_Warn = 1, + __Pyx_ImportType_CheckSize_Ignore = 2 +}; +static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +#endif + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1833,6 +1944,9 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_dou /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + /* MemviewDtypeToObject.proto */ static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp); static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj); @@ -1951,33 +2065,15 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -2033,7 +2129,6 @@ static PyObject *contiguous = 0; static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; -static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ @@ -2156,6 +2251,7 @@ static const char __pyx_k_n_rows1[] = "n_rows1"; static const char __pyx_k_n_rows2[] = "n_rows2"; static const char __pyx_k_nonnans[] = "nonnans"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; +static const char __pyx_k_callback[] = "callback"; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_in1_unk2[] = "in1_unk2"; static const char __pyx_k_itemsize[] = "itemsize"; @@ -2164,6 +2260,7 @@ static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_unk1_in2[] = "unk1_in2"; static const char __pyx_k_TypeError[] = "TypeError"; +static const char __pyx_k_col_start[] = "col_start"; static const char __pyx_k_distances[] = "distances"; static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_nonzeros1[] = "nonzeros1"; @@ -2173,6 +2270,7 @@ static const char __pyx_k_not1_unk2[] = "not1_unk2"; static const char __pyx_k_p_nonzero[] = "p_nonzero"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; +static const char __pyx_k_row_start[] = "row_start"; static const char __pyx_k_unk1_not2[] = "unk1_not2"; static const char __pyx_k_unk1_unk2[] = "unk1_unk2"; static const char __pyx_k_IndexError[] = "IndexError"; @@ -2192,6 +2290,7 @@ static const char __pyx_k_jaccard_rows[] = "jaccard_rows"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_dist_missing2[] = "dist_missing2"; +static const char __pyx_k_next_callback[] = "next_callback"; static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_manhattan_cols[] = "manhattan_cols"; @@ -2206,6 +2305,7 @@ static const char __pyx_k_dist_missing2_cont[] = "dist_missing2_cont"; static const char __pyx_k_fix_euclidean_cols[] = "fix_euclidean_cols"; static const char __pyx_k_fix_euclidean_rows[] = "fix_euclidean_rows"; static const char __pyx_k_fix_manhattan_rows[] = "fix_manhattan_rows"; +static const char __pyx_k_lower_to_symmetric[] = "lower_to_symmetric"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_manhattan_rows_cont[] = "manhattan_rows_cont"; static const char __pyx_k_strided_and_indirect[] = ""; @@ -2280,11 +2380,13 @@ static PyObject *__pyx_n_s_any_nan_row; static PyObject *__pyx_n_s_base; static PyObject *__pyx_n_s_c; static PyObject *__pyx_n_u_c; +static PyObject *__pyx_n_s_callback; static PyObject *__pyx_n_s_class; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_col; static PyObject *__pyx_n_s_col1; static PyObject *__pyx_n_s_col2; +static PyObject *__pyx_n_s_col_start; static PyObject *__pyx_kp_s_contiguous_and_direct; static PyObject *__pyx_kp_s_contiguous_and_indirect; static PyObject *__pyx_n_s_d; @@ -2324,6 +2426,7 @@ static PyObject *__pyx_n_s_ival1; static PyObject *__pyx_n_s_ival2; static PyObject *__pyx_n_s_jaccard_cols; static PyObject *__pyx_n_s_jaccard_rows; +static PyObject *__pyx_n_s_lower_to_symmetric; static PyObject *__pyx_n_s_mads; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_manhattan_cols; @@ -2345,6 +2448,7 @@ 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_next_callback; static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; static PyObject *__pyx_n_s_nonnans; static PyObject *__pyx_n_s_nonzeros; @@ -2354,8 +2458,8 @@ static PyObject *__pyx_n_s_normalize; static PyObject *__pyx_n_s_not1_unk2; static PyObject *__pyx_n_s_np; static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to; -static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor; +static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; +static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; static PyObject *__pyx_n_s_obj; static PyObject *__pyx_n_s_p_nonzero; static PyObject *__pyx_n_s_pack; @@ -2376,6 +2480,7 @@ static PyObject *__pyx_n_s_reduce_ex; static PyObject *__pyx_n_s_row; static PyObject *__pyx_n_s_row1; static PyObject *__pyx_n_s_row2; +static PyObject *__pyx_n_s_row_start; static PyObject *__pyx_n_s_setstate; static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_n_s_shape; @@ -2407,20 +2512,20 @@ static PyObject *__pyx_n_s_x; static PyObject *__pyx_n_s_x1; static PyObject *__pyx_n_s_x2; static PyObject *__pyx_n_s_zeros; -static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, __Pyx_memviewslice __pyx_v_dist_missing, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_means, PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, CYTHON_UNUSED PyArrayObject *__pyx_v_means, CYTHON_UNUSED PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, __Pyx_memviewslice __pyx_v_means, __Pyx_memviewslice __pyx_v_vars); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, PyArrayObject *__pyx_v_dist_missing2_cont, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, __Pyx_memviewslice __pyx_v_dist_missing, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_means, PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, CYTHON_UNUSED PyArrayObject *__pyx_v_means, CYTHON_UNUSED PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, __Pyx_memviewslice __pyx_v_means, __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, PyArrayObject *__pyx_v_dist_missing2_cont, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize, PyObject *__pyx_v_callback); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_nans, PyArrayObject *__pyx_v_ps); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables, PyObject *__pyx_v_callback, PyObject *__pyx_v_next_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_nans, PyArrayObject *__pyx_v_ps, PyObject *__pyx_v_callback); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static int __pyx_array___pyx_pf_15View_dot_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); /* proto */ @@ -2482,9 +2587,7 @@ static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__25; -static PyObject *__pyx_slice__26; -static PyObject *__pyx_slice__27; +static PyObject *__pyx_slice__22; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; @@ -2497,209 +2600,71 @@ 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__28; -static PyObject *__pyx_tuple__29; static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__39; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__47; -static PyObject *__pyx_tuple__49; -static PyObject *__pyx_tuple__51; -static PyObject *__pyx_tuple__53; +static PyObject *__pyx_tuple__32; +static PyObject *__pyx_tuple__34; +static PyObject *__pyx_tuple__36; +static PyObject *__pyx_tuple__38; +static PyObject *__pyx_tuple__40; +static PyObject *__pyx_tuple__42; +static PyObject *__pyx_tuple__44; +static PyObject *__pyx_tuple__46; +static PyObject *__pyx_tuple__48; +static PyObject *__pyx_tuple__50; +static PyObject *__pyx_tuple__52; +static PyObject *__pyx_tuple__54; static PyObject *__pyx_tuple__55; +static PyObject *__pyx_tuple__56; static PyObject *__pyx_tuple__57; static PyObject *__pyx_tuple__58; static PyObject *__pyx_tuple__59; -static PyObject *__pyx_tuple__60; -static PyObject *__pyx_tuple__61; -static PyObject *__pyx_tuple__62; -static PyObject *__pyx_codeobj__32; -static PyObject *__pyx_codeobj__34; -static PyObject *__pyx_codeobj__36; -static PyObject *__pyx_codeobj__38; -static PyObject *__pyx_codeobj__40; -static PyObject *__pyx_codeobj__42; -static PyObject *__pyx_codeobj__44; -static PyObject *__pyx_codeobj__46; -static PyObject *__pyx_codeobj__48; -static PyObject *__pyx_codeobj__50; -static PyObject *__pyx_codeobj__52; -static PyObject *__pyx_codeobj__54; -static PyObject *__pyx_codeobj__56; -static PyObject *__pyx_codeobj__63; +static PyObject *__pyx_codeobj__27; +static PyObject *__pyx_codeobj__29; +static PyObject *__pyx_codeobj__31; +static PyObject *__pyx_codeobj__33; +static PyObject *__pyx_codeobj__35; +static PyObject *__pyx_codeobj__37; +static PyObject *__pyx_codeobj__39; +static PyObject *__pyx_codeobj__41; +static PyObject *__pyx_codeobj__43; +static PyObject *__pyx_codeobj__45; +static PyObject *__pyx_codeobj__47; +static PyObject *__pyx_codeobj__49; +static PyObject *__pyx_codeobj__51; +static PyObject *__pyx_codeobj__53; +static PyObject *__pyx_codeobj__60; /* Late includes */ /* "Orange/distance/_distance.pyx":18 * * - * cpdef void lower_to_symmetric(double [:, :] distances): # <<<<<<<<<<<<<< - * cdef int row1, row2 - * for row1 in range(distances.shape[0]): - */ - -static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_arg_distances); /*proto*/ -static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memviewslice __pyx_v_distances, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_v_row1; - int __pyx_v_row2; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - __Pyx_RefNannySetupContext("lower_to_symmetric", 0); - - /* "Orange/distance/_distance.pyx":20 - * cpdef void lower_to_symmetric(double [:, :] distances): - * cdef int row1, row2 - * for row1 in range(distances.shape[0]): # <<<<<<<<<<<<<< - * for row2 in range(row1): - * distances[row2, row1] = distances[row1, row2] - */ - __pyx_t_1 = (__pyx_v_distances.shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_row1 = __pyx_t_3; - - /* "Orange/distance/_distance.pyx":21 - * cdef int row1, row2 - * for row1 in range(distances.shape[0]): - * for row2 in range(row1): # <<<<<<<<<<<<<< - * distances[row2, row1] = distances[row1, row2] - * - */ - __pyx_t_4 = __pyx_v_row1; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_row2 = __pyx_t_6; - - /* "Orange/distance/_distance.pyx":22 - * for row1 in range(distances.shape[0]): - * for row2 in range(row1): - * distances[row2, row1] = distances[row1, row2] # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_7 = __pyx_v_row1; - __pyx_t_8 = __pyx_v_row2; - __pyx_t_9 = __pyx_v_row2; - __pyx_t_10 = __pyx_v_row1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_9 * __pyx_v_distances.strides[0]) ) + __pyx_t_10 * __pyx_v_distances.strides[1]) )) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_7 * __pyx_v_distances.strides[0]) ) + __pyx_t_8 * __pyx_v_distances.strides[1]) ))); - } - } - - /* "Orange/distance/_distance.pyx":18 - * + * def lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * cdef int row1, row2, step, n_rows1 * - * cpdef void lower_to_symmetric(double [:, :] distances): # <<<<<<<<<<<<<< - * cdef int row1, row2 - * for row1 in range(distances.shape[0]): */ - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - /* Python wrapper */ -static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_arg_distances); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric[] = "lower_to_symmetric(__Pyx_memviewslice distances) -> void"; -static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_arg_distances) { +static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric[] = "lower_to_symmetric(double[:, :] distances, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_1lower_to_symmetric = {"lower_to_symmetric", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric}; +static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lower_to_symmetric (wrapper)", 0); - assert(__pyx_arg_distances); { - __pyx_v_distances = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_arg_distances, PyBUF_WRITABLE); if (unlikely(!__pyx_v_distances.memview)) __PYX_ERR(0, 18, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_self, __pyx_v_distances); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("lower_to_symmetric", 0); - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_distances.memview)) { __Pyx_RaiseUnboundLocalError("distances"); __PYX_ERR(0, 18, __pyx_L1_error) } - __pyx_t_1 = __Pyx_void_to_None(__pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_v_distances, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_distances, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "Orange/distance/_distance.pyx":25 - * - * - * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=2] x1, - * np.ndarray[np.float64_t, ndim=2] x2, - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete[] = "euclidean_rows_discrete(ndarray distances, ndarray x1, ndarray x2, __Pyx_memviewslice dist_missing, ndarray dist_missing2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete = {"euclidean_rows_discrete", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete}; -static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_distances = 0; - PyArrayObject *__pyx_v_x1 = 0; - PyArrayObject *__pyx_v_x2 = 0; - __Pyx_memviewslice __pyx_v_dist_missing = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyArrayObject *__pyx_v_dist_missing2 = 0; - char __pyx_v_two_tables; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("euclidean_rows_discrete (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_dist_missing,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,0}; - PyObject* values[6] = {0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_callback,0}; + PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -2714,39 +2679,398 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete( else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 1); __PYX_ERR(0, 25, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 2); __PYX_ERR(0, 25, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 3); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("lower_to_symmetric", 1, 2, 2, 1); __PYX_ERR(0, 18, __pyx_L3_error) } - CYTHON_FALLTHROUGH; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lower_to_symmetric") < 0)) __PYX_ERR(0, 18, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_distances = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distances.memview)) __PYX_ERR(0, 18, __pyx_L3_error) + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lower_to_symmetric", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_self, __pyx_v_distances, __pyx_v_callback); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances, PyObject *__pyx_v_callback) { + int __pyx_v_row1; + int __pyx_v_row2; + int __pyx_v_step; + int __pyx_v_n_rows1; + long __pyx_v_row_start; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + long __pyx_t_1; + long __pyx_t_2; + long __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + __Pyx_RefNannySetupContext("lower_to_symmetric", 0); + + /* "Orange/distance/_distance.pyx":21 + * cdef int row1, row2, step, n_rows1 + * + * n_rows1 = distances.shape[0] # <<<<<<<<<<<<<< + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + */ + __pyx_v_n_rows1 = (__pyx_v_distances.shape[0]); + + /* "Orange/distance/_distance.pyx":22 + * + * n_rows1 = distances.shape[0] + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + */ + __pyx_t_1 = 0x64; + __pyx_t_2 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_1 > __pyx_t_2) != 0)) { + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_2; + } + __pyx_v_step = __pyx_t_3; + + /* "Orange/distance/_distance.pyx":23 + * n_rows1 = distances.shape[0] + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * with nogil: + */ + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 23, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 23, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 23, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_6); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 23, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_row_start = __pyx_t_3; + + /* "Orange/distance/_distance.pyx":24 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * with nogil: + * for row1 in range(row_start, min(row_start + step, n_rows1)): + */ + __pyx_t_4 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_9 = __pyx_v_callback; __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "Orange/distance/_distance.pyx":25 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * with nogil: # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "Orange/distance/_distance.pyx":26 + * callback(row_start * 100 / n_rows1) + * with nogil: + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * for row2 in range(row1): + * distances[row2, row1] = distances[row1, row2] + */ + __pyx_t_11 = __pyx_v_n_rows1; + __pyx_t_3 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_11 < __pyx_t_3) != 0)) { + __pyx_t_1 = __pyx_t_11; + } else { + __pyx_t_1 = __pyx_t_3; + } + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = __pyx_t_3; + for (__pyx_t_11 = __pyx_v_row_start; __pyx_t_11 < __pyx_t_1; __pyx_t_11+=1) { + __pyx_v_row1 = __pyx_t_11; + + /* "Orange/distance/_distance.pyx":27 + * with nogil: + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): # <<<<<<<<<<<<<< + * distances[row2, row1] = distances[row1, row2] + * + */ + __pyx_t_12 = __pyx_v_row1; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_row2 = __pyx_t_14; + + /* "Orange/distance/_distance.pyx":28 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): + * distances[row2, row1] = distances[row1, row2] # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_15 = __pyx_v_row1; + __pyx_t_16 = __pyx_v_row2; + __pyx_t_17 = __pyx_v_row2; + __pyx_t_18 = __pyx_v_row1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_17 * __pyx_v_distances.strides[0]) ) + __pyx_t_18 * __pyx_v_distances.strides[1]) )) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_15 * __pyx_v_distances.strides[0]) ) + __pyx_t_16 * __pyx_v_distances.strides[1]) ))); + } + } + } + + /* "Orange/distance/_distance.pyx":25 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * with nogil: # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L9; + } + __pyx_L9:; + } + } + + /* "Orange/distance/_distance.pyx":23 + * n_rows1 = distances.shape[0] + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * with nogil: + */ + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "Orange/distance/_distance.pyx":18 + * + * + * def lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * cdef int row1, row2, step, n_rows1 + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XDEC_MEMVIEW(&__pyx_v_distances, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "Orange/distance/_distance.pyx":31 + * + * + * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=2] x1, + * np.ndarray[np.float64_t, ndim=2] x2, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete[] = "euclidean_rows_discrete(ndarray distances, ndarray x1, ndarray x2, double[:, :] dist_missing, ndarray dist_missing2, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete = {"euclidean_rows_discrete", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete}; +static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_distances = 0; + PyArrayObject *__pyx_v_x1 = 0; + PyArrayObject *__pyx_v_x2 = 0; + __Pyx_memviewslice __pyx_v_dist_missing = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyArrayObject *__pyx_v_dist_missing2 = 0; + char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("euclidean_rows_discrete (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_dist_missing,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[7] = {0,0,0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distances)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 1); __PYX_ERR(0, 31, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 2); __PYX_ERR(0, 31, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 3); __PYX_ERR(0, 31, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 4); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 4); __PYX_ERR(0, 31, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 5); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 5); __PYX_ERR(0, 31, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 6); __PYX_ERR(0, 31, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "euclidean_rows_discrete") < 0)) __PYX_ERR(0, 25, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "euclidean_rows_discrete") < 0)) __PYX_ERR(0, 31, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -2755,27 +3079,29 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete( values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); __pyx_v_x2 = ((PyArrayObject *)values[2]); - __pyx_v_dist_missing = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dist_missing.memview)) __PYX_ERR(0, 28, __pyx_L3_error) + __pyx_v_dist_missing = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dist_missing.memview)) __PYX_ERR(0, 34, __pyx_L3_error) __pyx_v_dist_missing2 = ((PyArrayObject *)values[4]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[5]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[5]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + __pyx_v_callback = values[6]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 31, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.euclidean_rows_discrete", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 25, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 26, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 27, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 29, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_dist_missing, __pyx_v_dist_missing2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 31, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 32, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 33, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_dist_missing, __pyx_v_dist_missing2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -2786,18 +3112,20 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete( return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, __Pyx_memviewslice __pyx_v_dist_missing, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, __Pyx_memviewslice __pyx_v_dist_missing, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; int __pyx_v_ival1; int __pyx_v_ival2; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_dist_missing2; __Pyx_Buffer __pyx_pybuffer_dist_missing2; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; @@ -2810,34 +3138,42 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - __pyx_t_5numpy_float64_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; int __pyx_t_18; - Py_ssize_t __pyx_t_19; + int __pyx_t_19; Py_ssize_t __pyx_t_20; Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + __pyx_t_5numpy_float64_t __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - __Pyx_RefNannySetupContext("euclidean_rows_discrete", 0); - __pyx_pybuffer_distances.pybuffer.buf = NULL; - __pyx_pybuffer_distances.refcount = 0; - __pyx_pybuffernd_distances.data = NULL; - __pyx_pybuffernd_distances.rcbuffer = &__pyx_pybuffer_distances; + __pyx_t_5numpy_float64_t __pyx_t_25; + int __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + __Pyx_RefNannySetupContext("euclidean_rows_discrete", 0); + __pyx_pybuffer_distances.pybuffer.buf = NULL; + __pyx_pybuffer_distances.refcount = 0; + __pyx_pybuffernd_distances.data = NULL; + __pyx_pybuffernd_distances.rcbuffer = &__pyx_pybuffer_distances; __pyx_pybuffer_x1.pybuffer.buf = NULL; __pyx_pybuffer_x1.refcount = 0; __pyx_pybuffernd_x1.data = NULL; @@ -2852,295 +3188,425 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_pybuffernd_dist_missing2.rcbuffer = &__pyx_pybuffer_dist_missing2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 31, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 31, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 31, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 31, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2.diminfo[0].strides = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2.diminfo[0].shape = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":36 + /* "Orange/distance/_distance.pyx":43 * int ival1, ival2 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":37 + /* "Orange/distance/_distance.pyx":44 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":38 + /* "Orange/distance/_distance.pyx":45 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":39 + /* "Orange/distance/_distance.pyx":46 * n_rows2 = x2.shape[0] - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 - */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; - - /* "Orange/distance/_distance.pyx":40 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; - - /* "Orange/distance/_distance.pyx":41 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 46, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 46, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 46, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 46, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; + + /* "Orange/distance/_distance.pyx":47 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + */ + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "Orange/distance/_distance.pyx":48 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_v_d = 0.0; + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":42 - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * ival1, ival2 = int(val1), int(val2) + /* "Orange/distance/_distance.pyx":49 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 */ - __pyx_t_9 = __pyx_v_n_cols; - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_col = __pyx_t_11; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":43 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): - */ - __pyx_t_12 = __pyx_v_row1; - __pyx_t_13 = __pyx_v_col; - __pyx_t_14 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_15 = __pyx_v_row2; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_14; - __pyx_v_val2 = __pyx_t_17; - - /* "Orange/distance/_distance.pyx":44 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * ival1, ival2 = int(val1), int(val2) # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): - */ - __pyx_v_ival1 = ((int)__pyx_v_val1); - __pyx_v_ival2 = ((int)__pyx_v_val2); - - /* "Orange/distance/_distance.pyx":45 - * val1, val2 = x1[row1, col], x2[row2, col] - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] - */ - __pyx_t_18 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_18) { - - /* "Orange/distance/_distance.pyx":46 - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":50 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_18 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_18) { + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":47 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += dist_missing2[col] # <<<<<<<<<<<<<< - * else: - * d += dist_missing[col, ival2] + /* "Orange/distance/_distance.pyx":51 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + */ + __pyx_v_d = 0.0; + + /* "Orange/distance/_distance.pyx":52 + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * ival1, ival2 = int(val1), int(val2) */ - __pyx_t_19 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + __pyx_t_17 = __pyx_v_n_cols; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_col = __pyx_t_19; - /* "Orange/distance/_distance.pyx":46 - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":53 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): */ - goto __pyx_L13; - } + __pyx_t_20 = __pyx_v_row1; + __pyx_t_21 = __pyx_v_col; + __pyx_t_22 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_23 = __pyx_v_row2; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_22; + __pyx_v_val2 = __pyx_t_25; - /* "Orange/distance/_distance.pyx":49 - * d += dist_missing2[col] - * else: - * d += dist_missing[col, ival2] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += dist_missing[col, ival1] + /* "Orange/distance/_distance.pyx":54 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * ival1, ival2 = int(val1), int(val2) # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - /*else*/ { - __pyx_t_20 = __pyx_v_col; - __pyx_t_21 = __pyx_v_ival2; - __pyx_v_d = (__pyx_v_d + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dist_missing.data + __pyx_t_20 * __pyx_v_dist_missing.strides[0]) ) + __pyx_t_21 * __pyx_v_dist_missing.strides[1]) )))); + __pyx_v_ival1 = ((int)__pyx_v_val1); + __pyx_v_ival2 = ((int)__pyx_v_val2); + + /* "Orange/distance/_distance.pyx":55 + * val1, val2 = x1[row1, col], x2[row2, col] + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + __pyx_t_26 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_26) { + + /* "Orange/distance/_distance.pyx":56 + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: + */ + __pyx_t_26 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_26) { + + /* "Orange/distance/_distance.pyx":57 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += dist_missing2[col] # <<<<<<<<<<<<<< + * else: + * d += dist_missing[col, ival2] + */ + __pyx_t_27 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + + /* "Orange/distance/_distance.pyx":56 + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":59 + * d += dist_missing2[col] + * else: + * d += dist_missing[col, ival2] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += dist_missing[col, ival1] + */ + /*else*/ { + __pyx_t_28 = __pyx_v_col; + __pyx_t_29 = __pyx_v_ival2; + __pyx_v_d = (__pyx_v_d + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dist_missing.data + __pyx_t_28 * __pyx_v_dist_missing.strides[0]) ) + __pyx_t_29 * __pyx_v_dist_missing.strides[1]) )))); + } + __pyx_L17:; + + /* "Orange/distance/_distance.pyx":55 + * val1, val2 = x1[row1, col], x2[row2, col] + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + goto __pyx_L16; } - __pyx_L13:; - /* "Orange/distance/_distance.pyx":45 - * val1, val2 = x1[row1, col], x2[row2, col] - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":60 + * else: + * d += dist_missing[col, ival2] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing[col, ival1] + * elif ival1 != ival2: + */ + __pyx_t_26 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_26) { + + /* "Orange/distance/_distance.pyx":61 + * d += dist_missing[col, ival2] + * elif npy_isnan(val2): + * d += dist_missing[col, ival1] # <<<<<<<<<<<<<< + * elif ival1 != ival2: + * d += 1 */ - goto __pyx_L12; - } + __pyx_t_30 = __pyx_v_col; + __pyx_t_31 = __pyx_v_ival1; + __pyx_v_d = (__pyx_v_d + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dist_missing.data + __pyx_t_30 * __pyx_v_dist_missing.strides[0]) ) + __pyx_t_31 * __pyx_v_dist_missing.strides[1]) )))); - /* "Orange/distance/_distance.pyx":50 - * else: - * d += dist_missing[col, ival2] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing[col, ival1] - * elif ival1 != ival2: - */ - __pyx_t_18 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_18) { - - /* "Orange/distance/_distance.pyx":51 - * d += dist_missing[col, ival2] - * elif npy_isnan(val2): - * d += dist_missing[col, ival1] # <<<<<<<<<<<<<< - * elif ival1 != ival2: - * d += 1 - */ - __pyx_t_22 = __pyx_v_col; - __pyx_t_23 = __pyx_v_ival1; - __pyx_v_d = (__pyx_v_d + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dist_missing.data + __pyx_t_22 * __pyx_v_dist_missing.strides[0]) ) + __pyx_t_23 * __pyx_v_dist_missing.strides[1]) )))); - - /* "Orange/distance/_distance.pyx":50 - * else: - * d += dist_missing[col, ival2] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing[col, ival1] - * elif ival1 != ival2: + /* "Orange/distance/_distance.pyx":60 + * else: + * d += dist_missing[col, ival2] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing[col, ival1] + * elif ival1 != ival2: */ - goto __pyx_L12; - } + goto __pyx_L16; + } - /* "Orange/distance/_distance.pyx":52 - * elif npy_isnan(val2): - * d += dist_missing[col, ival1] - * elif ival1 != ival2: # <<<<<<<<<<<<<< - * d += 1 - * distances[row1, row2] += d + /* "Orange/distance/_distance.pyx":62 + * elif npy_isnan(val2): + * d += dist_missing[col, ival1] + * elif ival1 != ival2: # <<<<<<<<<<<<<< + * d += 1 + * distances[row1, row2] += d */ - __pyx_t_18 = ((__pyx_v_ival1 != __pyx_v_ival2) != 0); - if (__pyx_t_18) { + __pyx_t_26 = ((__pyx_v_ival1 != __pyx_v_ival2) != 0); + if (__pyx_t_26) { - /* "Orange/distance/_distance.pyx":53 - * d += dist_missing[col, ival1] - * elif ival1 != ival2: - * d += 1 # <<<<<<<<<<<<<< - * distances[row1, row2] += d + /* "Orange/distance/_distance.pyx":63 + * d += dist_missing[col, ival1] + * elif ival1 != ival2: + * d += 1 # <<<<<<<<<<<<<< + * distances[row1, row2] += d * */ - __pyx_v_d = (__pyx_v_d + 1.0); + __pyx_v_d = (__pyx_v_d + 1.0); - /* "Orange/distance/_distance.pyx":52 - * elif npy_isnan(val2): - * d += dist_missing[col, ival1] - * elif ival1 != ival2: # <<<<<<<<<<<<<< - * d += 1 - * distances[row1, row2] += d + /* "Orange/distance/_distance.pyx":62 + * elif npy_isnan(val2): + * d += dist_missing[col, ival1] + * elif ival1 != ival2: # <<<<<<<<<<<<<< + * d += 1 + * distances[row1, row2] += d */ + } + __pyx_L16:; } - __pyx_L12:; - } - /* "Orange/distance/_distance.pyx":54 - * elif ival1 != ival2: - * d += 1 - * distances[row1, row2] += d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":64 + * elif ival1 != ival2: + * d += 1 + * distances[row1, row2] += d # <<<<<<<<<<<<<< * * */ - __pyx_t_24 = __pyx_v_row1; - __pyx_t_25 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_distances.diminfo[1].strides) += __pyx_v_d; + __pyx_t_32 = __pyx_v_row1; + __pyx_t_33 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_distances.diminfo[1].strides) += __pyx_v_d; + } + } + + /* "Orange/distance/_distance.pyx":49 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } - } } + } - /* "Orange/distance/_distance.pyx":38 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] + /* "Orange/distance/_distance.pyx":46 * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":25 + /* "Orange/distance/_distance.pyx":31 * * * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -3152,6 +3618,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -3176,7 +3647,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( return __pyx_r; } -/* "Orange/distance/_distance.pyx":57 +/* "Orange/distance/_distance.pyx":67 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< @@ -3186,8 +3657,8 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_4fix_euclidean_rows[] = "fix_euclidean_rows(ndarray distances, ndarray x1, ndarray x2, ndarray means, ndarray vars, ndarray dist_missing2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows = {"fix_euclidean_rows", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_4fix_euclidean_rows}; +static char __pyx_doc_6Orange_8distance_9_distance_4fix_euclidean_rows[] = "fix_euclidean_rows(ndarray distances, ndarray x1, ndarray x2, ndarray means, ndarray vars, ndarray dist_missing2, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows = {"fix_euclidean_rows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_4fix_euclidean_rows}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; @@ -3196,16 +3667,19 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj PyArrayObject *__pyx_v_vars = 0; PyArrayObject *__pyx_v_dist_missing2 = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_euclidean_rows (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -3232,43 +3706,49 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 1); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 1); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 2); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 2); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 3); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 3); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 4); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 4); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 5); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 5); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 6); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 6); __PYX_ERR(0, 67, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 7); __PYX_ERR(0, 67, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows") < 0)) __PYX_ERR(0, 57, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows") < 0)) __PYX_ERR(0, 67, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -3278,6 +3758,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); @@ -3285,23 +3766,24 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj __pyx_v_means = ((PyArrayObject *)values[3]); __pyx_v_vars = ((PyArrayObject *)values[4]); __pyx_v_dist_missing2 = ((PyArrayObject *)values[5]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) + __pyx_v_callback = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 67, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 58, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 59, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 60, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 61, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 62, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 63, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 68, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 70, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 71, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 72, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -3312,16 +3794,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_means, PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_means, PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_dist_missing2; __Pyx_Buffer __pyx_pybuffer_dist_missing2; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; @@ -3338,33 +3822,41 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; + __pyx_t_5numpy_float64_t __pyx_t_28; Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + Py_ssize_t __pyx_t_37; __Pyx_RefNannySetupContext("fix_euclidean_rows", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -3392,329 +3884,459 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_pybuffernd_dist_missing2.rcbuffer = &__pyx_pybuffer_dist_missing2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_means.diminfo[0].strides = __pyx_pybuffernd_means.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_means.diminfo[0].shape = __pyx_pybuffernd_means.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_vars.diminfo[0].strides = __pyx_pybuffernd_vars.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vars.diminfo[0].shape = __pyx_pybuffernd_vars.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2.diminfo[0].strides = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2.diminfo[0].shape = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":69 + /* "Orange/distance/_distance.pyx":80 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":70 + /* "Orange/distance/_distance.pyx":81 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":71 + /* "Orange/distance/_distance.pyx":82 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":72 + /* "Orange/distance/_distance.pyx":83 * n_rows2 = x2.shape[0] - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; - - /* "Orange/distance/_distance.pyx":73 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[row1, row2]): - * d = 0 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; - - /* "Orange/distance/_distance.pyx":74 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 83, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 83, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; + + /* "Orange/distance/_distance.pyx":84 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - __pyx_t_9 = __pyx_v_row1; - __pyx_t_10 = __pyx_v_row2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":75 - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + /* "Orange/distance/_distance.pyx":85 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_v_d = 0.0; + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":76 - * if npy_isnan(distances[row1, row2]): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":86 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): */ - __pyx_t_12 = __pyx_v_n_cols; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_col = __pyx_t_14; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":77 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":87 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[row1, row2]): + * d = 0 */ - __pyx_t_15 = __pyx_v_row1; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row2; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":78 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":88 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + __pyx_t_17 = __pyx_v_row1; + __pyx_t_18 = __pyx_v_row2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":79 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":89 + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":80 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += dist_missing2[col] # <<<<<<<<<<<<<< - * else: - * d += (val2 - means[col]) ** 2 + vars[col] + /* "Orange/distance/_distance.pyx":90 + * if npy_isnan(distances[row1, row2]): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): */ - __pyx_t_21 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":79 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":91 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - goto __pyx_L14; - } + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":92 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":82 - * d += dist_missing2[col] - * else: - * d += (val2 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += (val1 - means[col]) ** 2 + vars[col] + /* "Orange/distance/_distance.pyx":93 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: */ - /*else*/ { - __pyx_t_22 = __pyx_v_col; - __pyx_t_23 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_means.diminfo[0].strides))), 2.0) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vars.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_vars.diminfo[0].strides)))); - } - __pyx_L14:; + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":78 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":94 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += dist_missing2[col] # <<<<<<<<<<<<<< + * else: + * d += (val2 - means[col]) ** 2 + vars[col] */ - goto __pyx_L13; - } + __pyx_t_29 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + + /* "Orange/distance/_distance.pyx":93 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":96 + * d += dist_missing2[col] + * else: + * d += (val2 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += (val1 - means[col]) ** 2 + vars[col] + */ + /*else*/ { + __pyx_t_30 = __pyx_v_col; + __pyx_t_31 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_means.diminfo[0].strides))), 2.0) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vars.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_vars.diminfo[0].strides)))); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":92 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":83 + /* "Orange/distance/_distance.pyx":97 + * else: + * d += (val2 - means[col]) ** 2 + vars[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += (val1 - means[col]) ** 2 + vars[col] * else: - * d += (val2 - means[col]) ** 2 + vars[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += (val1 - means[col]) ** 2 + vars[col] - * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":84 - * d += (val2 - means[col]) ** 2 + vars[col] - * elif npy_isnan(val2): - * d += (val1 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< - * else: - * d += (val1 - val2) ** 2 + /* "Orange/distance/_distance.pyx":98 + * d += (val2 - means[col]) ** 2 + vars[col] + * elif npy_isnan(val2): + * d += (val1 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< + * else: + * d += (val1 - val2) ** 2 */ - __pyx_t_24 = __pyx_v_col; - __pyx_t_25 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_means.diminfo[0].strides))), 2.0) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vars.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_vars.diminfo[0].strides)))); + __pyx_t_32 = __pyx_v_col; + __pyx_t_33 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_means.diminfo[0].strides))), 2.0) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vars.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_vars.diminfo[0].strides)))); - /* "Orange/distance/_distance.pyx":83 + /* "Orange/distance/_distance.pyx":97 + * else: + * d += (val2 - means[col]) ** 2 + vars[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += (val1 - means[col]) ** 2 + vars[col] * else: - * d += (val2 - means[col]) ** 2 + vars[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += (val1 - means[col]) ** 2 + vars[col] - * else: */ - goto __pyx_L13; - } + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":86 - * d += (val1 - means[col]) ** 2 + vars[col] - * else: - * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< - * distances[row1, row2] = d - * if not two_tables: + /* "Orange/distance/_distance.pyx":100 + * d += (val1 - means[col]) ** 2 + vars[col] + * else: + * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< + * distances[row1, row2] = d + * if not two_tables: */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + /*else*/ { + __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":87 - * else: - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d # <<<<<<<<<<<<<< - * if not two_tables: - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":101 + * else: + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d # <<<<<<<<<<<<<< + * if not two_tables: + * distances[row2, row1] = d */ - __pyx_t_26 = __pyx_v_row1; - __pyx_t_27 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_34 = __pyx_v_row1; + __pyx_t_35 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":88 - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d - * if not two_tables: # <<<<<<<<<<<<<< - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":102 + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d + * if not two_tables: # <<<<<<<<<<<<<< + * distances[row2, row1] = d * */ - __pyx_t_11 = ((!(__pyx_v_two_tables != 0)) != 0); - if (__pyx_t_11) { + __pyx_t_19 = ((!(__pyx_v_two_tables != 0)) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":89 - * distances[row1, row2] = d - * if not two_tables: - * distances[row2, row1] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":103 + * distances[row1, row2] = d + * if not two_tables: + * distances[row2, row1] = d # <<<<<<<<<<<<<< * * */ - __pyx_t_28 = __pyx_v_row2; - __pyx_t_29 = __pyx_v_row1; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_36 = __pyx_v_row2; + __pyx_t_37 = __pyx_v_row1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":88 - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d - * if not two_tables: # <<<<<<<<<<<<<< - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":102 + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d + * if not two_tables: # <<<<<<<<<<<<<< + * distances[row2, row1] = d * */ - } + } - /* "Orange/distance/_distance.pyx":74 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":88 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ + } } } - } + + /* "Orange/distance/_distance.pyx":86 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":71 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] + /* "Orange/distance/_distance.pyx":83 * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":57 + /* "Orange/distance/_distance.pyx":67 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< @@ -3726,6 +4348,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -3753,7 +4380,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO return __pyx_r; } -/* "Orange/distance/_distance.pyx":92 +/* "Orange/distance/_distance.pyx":106 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< @@ -3763,8 +4390,8 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized[] = "fix_euclidean_rows_normalized(ndarray distances, ndarray x1, ndarray x2, ndarray means, ndarray vars, ndarray dist_missing2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized = {"fix_euclidean_rows_normalized", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized}; +static char __pyx_doc_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized[] = "fix_euclidean_rows_normalized(ndarray distances, ndarray x1, ndarray x2, ndarray means, ndarray vars, ndarray dist_missing2, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized = {"fix_euclidean_rows_normalized", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; @@ -3773,16 +4400,19 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma CYTHON_UNUSED PyArrayObject *__pyx_v_vars = 0; PyArrayObject *__pyx_v_dist_missing2 = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_euclidean_rows_normalized (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -3809,43 +4439,49 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 1); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 1); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 2); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 2); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 3); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 3); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 4); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 4); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 5); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 5); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 6); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 6); __PYX_ERR(0, 106, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 7); __PYX_ERR(0, 106, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows_normalized") < 0)) __PYX_ERR(0, 92, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows_normalized") < 0)) __PYX_ERR(0, 106, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -3855,6 +4491,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); @@ -3862,23 +4499,24 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma __pyx_v_means = ((PyArrayObject *)values[3]); __pyx_v_vars = ((PyArrayObject *)values[4]); __pyx_v_dist_missing2 = ((PyArrayObject *)values[5]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) + __pyx_v_callback = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 106, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_rows_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 93, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 94, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 95, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 96, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 97, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 98, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 107, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 109, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 110, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 111, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -3889,16 +4527,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, CYTHON_UNUSED PyArrayObject *__pyx_v_means, CYTHON_UNUSED PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, CYTHON_UNUSED PyArrayObject *__pyx_v_means, CYTHON_UNUSED PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_dist_missing2; __Pyx_Buffer __pyx_pybuffer_dist_missing2; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; @@ -3915,29 +4555,37 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; __Pyx_RefNannySetupContext("fix_euclidean_rows_normalized", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -3965,325 +4613,455 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_pybuffernd_dist_missing2.rcbuffer = &__pyx_pybuffer_dist_missing2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_means.diminfo[0].strides = __pyx_pybuffernd_means.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_means.diminfo[0].shape = __pyx_pybuffernd_means.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_vars.diminfo[0].strides = __pyx_pybuffernd_vars.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vars.diminfo[0].shape = __pyx_pybuffernd_vars.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2.diminfo[0].strides = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2.diminfo[0].shape = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":104 + /* "Orange/distance/_distance.pyx":119 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":105 + /* "Orange/distance/_distance.pyx":120 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":106 + /* "Orange/distance/_distance.pyx":121 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":107 + /* "Orange/distance/_distance.pyx":122 * n_rows2 = x2.shape[0] - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; - - /* "Orange/distance/_distance.pyx":108 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[row1, row2]): - * d = 0 - */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; - - /* "Orange/distance/_distance.pyx":109 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): - */ - __pyx_t_9 = __pyx_v_row1; - __pyx_t_10 = __pyx_v_row2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { - - /* "Orange/distance/_distance.pyx":110 - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_v_d = 0.0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 122, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 122, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 122, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 122, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":111 - * if npy_isnan(distances[row1, row2]): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":123 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - __pyx_t_12 = __pyx_v_n_cols; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_col = __pyx_t_14; + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":112 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":124 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_t_15 = __pyx_v_row1; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row2; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":113 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":125 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "Orange/distance/_distance.pyx":126 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[row1, row2]): + * d = 0 */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":114 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":127 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_17 = __pyx_v_row1; + __pyx_t_18 = __pyx_v_row2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":115 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += dist_missing2[col] # <<<<<<<<<<<<<< - * else: - * d += val2 ** 2 + 0.5 + /* "Orange/distance/_distance.pyx":128 + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_t_21 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":114 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":129 + * if npy_isnan(distances[row1, row2]): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): */ - goto __pyx_L14; - } + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":117 - * d += dist_missing2[col] - * else: - * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += val1 ** 2 + 0.5 + /* "Orange/distance/_distance.pyx":130 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val2, 2.0) + 0.5)); - } - __pyx_L14:; + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":131 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":113 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":132 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: */ - goto __pyx_L13; - } + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":133 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += dist_missing2[col] # <<<<<<<<<<<<<< + * else: + * d += val2 ** 2 + 0.5 + */ + __pyx_t_29 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + + /* "Orange/distance/_distance.pyx":132 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":135 + * d += dist_missing2[col] + * else: + * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += val1 ** 2 + 0.5 + */ + /*else*/ { + __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val2, 2.0) + 0.5)); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":131 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":118 + /* "Orange/distance/_distance.pyx":136 + * else: + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += val1 ** 2 + 0.5 * else: - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += val1 ** 2 + 0.5 - * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":119 - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): - * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< - * else: - * d += (val1 - val2) ** 2 + /* "Orange/distance/_distance.pyx":137 + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): + * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< + * else: + * d += (val1 - val2) ** 2 */ - __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); + __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); - /* "Orange/distance/_distance.pyx":118 + /* "Orange/distance/_distance.pyx":136 + * else: + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += val1 ** 2 + 0.5 * else: - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += val1 ** 2 + 0.5 - * else: */ - goto __pyx_L13; - } + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":121 - * d += val1 ** 2 + 0.5 - * else: - * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< - * distances[row1, row2] = d - * if not two_tables: + /* "Orange/distance/_distance.pyx":139 + * d += val1 ** 2 + 0.5 + * else: + * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< + * distances[row1, row2] = d + * if not two_tables: */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + /*else*/ { + __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":122 - * else: - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d # <<<<<<<<<<<<<< - * if not two_tables: - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":140 + * else: + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d # <<<<<<<<<<<<<< + * if not two_tables: + * distances[row2, row1] = d */ - __pyx_t_22 = __pyx_v_row1; - __pyx_t_23 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_30 = __pyx_v_row1; + __pyx_t_31 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":123 - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d - * if not two_tables: # <<<<<<<<<<<<<< - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":141 + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d + * if not two_tables: # <<<<<<<<<<<<<< + * distances[row2, row1] = d * */ - __pyx_t_11 = ((!(__pyx_v_two_tables != 0)) != 0); - if (__pyx_t_11) { + __pyx_t_19 = ((!(__pyx_v_two_tables != 0)) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":124 - * distances[row1, row2] = d - * if not two_tables: - * distances[row2, row1] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":142 + * distances[row1, row2] = d + * if not two_tables: + * distances[row2, row1] = d # <<<<<<<<<<<<<< * * */ - __pyx_t_24 = __pyx_v_row2; - __pyx_t_25 = __pyx_v_row1; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_32 = __pyx_v_row2; + __pyx_t_33 = __pyx_v_row1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":123 - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d - * if not two_tables: # <<<<<<<<<<<<<< - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":141 + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d + * if not two_tables: # <<<<<<<<<<<<<< + * distances[row2, row1] = d * */ - } + } - /* "Orange/distance/_distance.pyx":109 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":127 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ + } } } - } + + /* "Orange/distance/_distance.pyx":125 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":106 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] + /* "Orange/distance/_distance.pyx":122 * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":92 + /* "Orange/distance/_distance.pyx":106 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< @@ -4295,6 +5073,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -4322,7 +5105,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma return __pyx_r; } -/* "Orange/distance/_distance.pyx":127 +/* "Orange/distance/_distance.pyx":145 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< @@ -4332,23 +5115,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_8fix_euclidean_cols[] = "fix_euclidean_cols(ndarray distances, ndarray x, __Pyx_memviewslice means, __Pyx_memviewslice vars)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols = {"fix_euclidean_cols", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_8fix_euclidean_cols}; +static char __pyx_doc_6Orange_8distance_9_distance_8fix_euclidean_cols[] = "fix_euclidean_cols(ndarray distances, ndarray x, double[:] means, double[:] vars, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols = {"fix_euclidean_cols", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_8fix_euclidean_cols}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x = 0; __Pyx_memviewslice __pyx_v_means = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_vars = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_euclidean_cols (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x,&__pyx_n_s_means,&__pyx_n_s_vars,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -4369,48 +5155,56 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 4, 4, 1); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 1); __PYX_ERR(0, 145, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 4, 4, 2); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 2); __PYX_ERR(0, 145, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 4, 4, 3); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 3); __PYX_ERR(0, 145, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 4); __PYX_ERR(0, 145, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols") < 0)) __PYX_ERR(0, 127, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols") < 0)) __PYX_ERR(0, 145, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x = ((PyArrayObject *)values[1]); - __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 130, __pyx_L3_error) - __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 131, __pyx_L3_error) + __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 148, __pyx_L3_error) + __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 149, __pyx_L3_error) + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 145, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 128, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 129, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 146, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -4421,15 +5215,17 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObj return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, __Pyx_memviewslice __pyx_v_means, __Pyx_memviewslice __pyx_v_vars) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, __Pyx_memviewslice __pyx_v_means, __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback) { int __pyx_v_n_rows; int __pyx_v_n_cols; int __pyx_v_col1; int __pyx_v_col2; int __pyx_v_row; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_col_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; __Pyx_Buffer __pyx_pybuffer_distances; __Pyx_LocalBuf_ND __pyx_pybuffernd_x; @@ -4438,36 +5234,44 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; + __pyx_t_5numpy_float64_t __pyx_t_28; Py_ssize_t __pyx_t_29; Py_ssize_t __pyx_t_30; Py_ssize_t __pyx_t_31; Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + Py_ssize_t __pyx_t_37; + Py_ssize_t __pyx_t_38; + Py_ssize_t __pyx_t_39; + Py_ssize_t __pyx_t_40; __Pyx_RefNannySetupContext("fix_euclidean_cols", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -4479,288 +5283,418 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 127, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 145, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 127, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 145, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":136 + /* "Orange/distance/_distance.pyx":155 * double val1, val2, d * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< - * with nogil: - * for col1 in range(n_cols): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): */ __pyx_t_1 = (__pyx_v_x->dimensions[0]); __pyx_t_2 = (__pyx_v_x->dimensions[1]); __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":137 + /* "Orange/distance/_distance.pyx":156 * * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":138 + /* "Orange/distance/_distance.pyx":157 * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: - * for col1 in range(n_cols): # <<<<<<<<<<<<<< - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): - */ - __pyx_t_3 = __pyx_v_n_cols; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_col1 = __pyx_t_5; - - /* "Orange/distance/_distance.pyx":139 - * with nogil: - * for col1 in range(n_cols): - * for col2 in range(col1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[col1, col2]): - * d = 0 - */ - __pyx_t_6 = __pyx_v_col1; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_col2 = __pyx_t_8; - - /* "Orange/distance/_distance.pyx":140 - * for col1 in range(n_cols): - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): - */ - __pyx_t_9 = __pyx_v_col1; - __pyx_t_10 = __pyx_v_col2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { - - /* "Orange/distance/_distance.pyx":141 - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): - * d = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - */ - __pyx_v_d = 0.0; - - /* "Orange/distance/_distance.pyx":142 - * if npy_isnan(distances[col1, col2]): - * d = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - __pyx_t_12 = __pyx_v_n_rows; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_row = __pyx_t_14; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 157, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 157, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 157, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 157, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_col_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":143 - * d = 0 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":158 + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: */ - __pyx_t_15 = __pyx_v_row; - __pyx_t_16 = __pyx_v_col1; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row; - __pyx_t_19 = __pyx_v_col2; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":144 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ + /* "Orange/distance/_distance.pyx":159 + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< + * with nogil: + * for col2 in range(col1): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + __pyx_t_13 = __pyx_v_n_cols; + __pyx_t_5 = (__pyx_v_col_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_col_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_col1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":145 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += vars[col1] + vars[col2] \ - * + (means[col1] - means[col2]) ** 2 + /* "Orange/distance/_distance.pyx":160 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":146 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< - * + (means[col1] - means[col2]) ** 2 - * else: + /* "Orange/distance/_distance.pyx":161 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * for col2 in range(col1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[col1, col2]): + * d = 0 */ - __pyx_t_21 = __pyx_v_col1; - __pyx_t_22 = __pyx_v_col2; + __pyx_t_14 = __pyx_v_col1; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_col2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":147 - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ - * + (means[col1] - means[col2]) ** 2 # <<<<<<<<<<<<<< - * else: - * d += (val2 - means[col1]) ** 2 + vars[col1] + /* "Orange/distance/_distance.pyx":162 + * with nogil: + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ - __pyx_t_23 = __pyx_v_col1; - __pyx_t_24 = __pyx_v_col2; + __pyx_t_17 = __pyx_v_col1; + __pyx_t_18 = __pyx_v_col2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":146 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< - * + (means[col1] - means[col2]) ** 2 - * else: + /* "Orange/distance/_distance.pyx":163 + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): + * d = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] */ - __pyx_v_d = (__pyx_v_d + (((*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_21 * __pyx_v_vars.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_22 * __pyx_v_vars.strides[0]) )))) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_23 * __pyx_v_means.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_24 * __pyx_v_means.strides[0]) )))), 2.0))); + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":145 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += vars[col1] + vars[col2] \ - * + (means[col1] - means[col2]) ** 2 + /* "Orange/distance/_distance.pyx":164 + * if npy_isnan(distances[col1, col2]): + * d = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): */ - goto __pyx_L14; - } + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; - /* "Orange/distance/_distance.pyx":149 - * + (means[col1] - means[col2]) ** 2 - * else: - * d += (val2 - means[col1]) ** 2 + vars[col1] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += (val1 - means[col2]) ** 2 + vars[col2] + /* "Orange/distance/_distance.pyx":165 + * d = 0 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - /*else*/ { - __pyx_t_25 = __pyx_v_col1; - __pyx_t_26 = __pyx_v_col1; - __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val2 - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_25 * __pyx_v_means.strides[0]) )))), 2.0) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_26 * __pyx_v_vars.strides[0]) ))))); - } - __pyx_L14:; + __pyx_t_23 = __pyx_v_row; + __pyx_t_24 = __pyx_v_col1; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row; + __pyx_t_27 = __pyx_v_col2; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":144 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ + /* "Orange/distance/_distance.pyx":166 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ */ - goto __pyx_L13; - } + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":150 + /* "Orange/distance/_distance.pyx":167 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += vars[col1] + vars[col2] \ + * + (means[col1] - means[col2]) ** 2 + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":168 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< + * + (means[col1] - means[col2]) ** 2 + * else: + */ + __pyx_t_29 = __pyx_v_col1; + __pyx_t_30 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":169 + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ + * + (means[col1] - means[col2]) ** 2 # <<<<<<<<<<<<<< + * else: + * d += (val2 - means[col1]) ** 2 + vars[col1] + */ + __pyx_t_31 = __pyx_v_col1; + __pyx_t_32 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":168 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< + * + (means[col1] - means[col2]) ** 2 + * else: + */ + __pyx_v_d = (__pyx_v_d + (((*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_29 * __pyx_v_vars.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_30 * __pyx_v_vars.strides[0]) )))) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_31 * __pyx_v_means.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_32 * __pyx_v_means.strides[0]) )))), 2.0))); + + /* "Orange/distance/_distance.pyx":167 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += vars[col1] + vars[col2] \ + * + (means[col1] - means[col2]) ** 2 + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":171 + * + (means[col1] - means[col2]) ** 2 + * else: + * d += (val2 - means[col1]) ** 2 + vars[col1] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += (val1 - means[col2]) ** 2 + vars[col2] + */ + /*else*/ { + __pyx_t_33 = __pyx_v_col1; + __pyx_t_34 = __pyx_v_col1; + __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val2 - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_33 * __pyx_v_means.strides[0]) )))), 2.0) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_34 * __pyx_v_vars.strides[0]) ))))); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":166 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":172 + * else: + * d += (val2 - means[col1]) ** 2 + vars[col1] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += (val1 - means[col2]) ** 2 + vars[col2] * else: - * d += (val2 - means[col1]) ** 2 + vars[col1] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += (val1 - means[col2]) ** 2 + vars[col2] - * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":151 - * d += (val2 - means[col1]) ** 2 + vars[col1] - * elif npy_isnan(val2): - * d += (val1 - means[col2]) ** 2 + vars[col2] # <<<<<<<<<<<<<< - * else: - * d += (val1 - val2) ** 2 + /* "Orange/distance/_distance.pyx":173 + * d += (val2 - means[col1]) ** 2 + vars[col1] + * elif npy_isnan(val2): + * d += (val1 - means[col2]) ** 2 + vars[col2] # <<<<<<<<<<<<<< + * else: + * d += (val1 - val2) ** 2 */ - __pyx_t_27 = __pyx_v_col2; - __pyx_t_28 = __pyx_v_col2; - __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_27 * __pyx_v_means.strides[0]) )))), 2.0) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_28 * __pyx_v_vars.strides[0]) ))))); + __pyx_t_35 = __pyx_v_col2; + __pyx_t_36 = __pyx_v_col2; + __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_35 * __pyx_v_means.strides[0]) )))), 2.0) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_36 * __pyx_v_vars.strides[0]) ))))); - /* "Orange/distance/_distance.pyx":150 + /* "Orange/distance/_distance.pyx":172 + * else: + * d += (val2 - means[col1]) ** 2 + vars[col1] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += (val1 - means[col2]) ** 2 + vars[col2] * else: - * d += (val2 - means[col1]) ** 2 + vars[col1] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += (val1 - means[col2]) ** 2 + vars[col2] - * else: */ - goto __pyx_L13; - } + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":153 - * d += (val1 - means[col2]) ** 2 + vars[col2] - * else: - * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = d + /* "Orange/distance/_distance.pyx":175 + * d += (val1 - means[col2]) ** 2 + vars[col2] + * else: + * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = d * */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + /*else*/ { + __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":154 - * else: - * d += (val1 - val2) ** 2 - * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":176 + * else: + * d += (val1 - val2) ** 2 + * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< * * */ - __pyx_t_29 = __pyx_v_col1; - __pyx_t_30 = __pyx_v_col2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - __pyx_t_31 = __pyx_v_col2; - __pyx_t_32 = __pyx_v_col1; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_37 = __pyx_v_col1; + __pyx_t_38 = __pyx_v_col2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_39 = __pyx_v_col2; + __pyx_t_40 = __pyx_v_col1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":140 - * for col1 in range(n_cols): - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): + /* "Orange/distance/_distance.pyx":162 + * with nogil: + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ + } } } - } + + /* "Orange/distance/_distance.pyx":160 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":137 - * + /* "Orange/distance/_distance.pyx":157 * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":127 + /* "Orange/distance/_distance.pyx":145 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< @@ -4772,6 +5706,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -4793,7 +5732,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO return __pyx_r; } -/* "Orange/distance/_distance.pyx":157 +/* "Orange/distance/_distance.pyx":179 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< @@ -4803,23 +5742,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized[] = "fix_euclidean_cols_normalized(ndarray distances, ndarray x, __Pyx_memviewslice means, __Pyx_memviewslice vars)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized = {"fix_euclidean_cols_normalized", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized}; +static char __pyx_doc_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized[] = "fix_euclidean_cols_normalized(ndarray distances, ndarray x, double[:] means, double[:] vars, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized = {"fix_euclidean_cols_normalized", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x = 0; CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means = { 0, 0, { 0 }, { 0 }, { 0 } }; CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_euclidean_cols_normalized (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x,&__pyx_n_s_means,&__pyx_n_s_vars,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -4840,48 +5782,56 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_norm case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 4, 4, 1); __PYX_ERR(0, 157, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 1); __PYX_ERR(0, 179, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 4, 4, 2); __PYX_ERR(0, 157, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 2); __PYX_ERR(0, 179, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 4, 4, 3); __PYX_ERR(0, 157, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 3); __PYX_ERR(0, 179, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 4); __PYX_ERR(0, 179, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols_normalized") < 0)) __PYX_ERR(0, 157, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols_normalized") < 0)) __PYX_ERR(0, 179, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x = ((PyArrayObject *)values[1]); - __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 160, __pyx_L3_error) - __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 161, __pyx_L3_error) + __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 182, __pyx_L3_error) + __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 183, __pyx_L3_error) + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 157, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 179, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_cols_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 158, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 159, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 180, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -4892,15 +5842,17 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_norm return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback) { int __pyx_v_n_rows; int __pyx_v_n_cols; int __pyx_v_col1; int __pyx_v_col2; int __pyx_v_row; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_col_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; __Pyx_Buffer __pyx_pybuffer_distances; __Pyx_LocalBuf_ND __pyx_pybuffernd_x; @@ -4909,28 +5861,36 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; + __pyx_t_5numpy_float64_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; __Pyx_RefNannySetupContext("fix_euclidean_cols_normalized", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -4942,264 +5902,394 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 157, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 179, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 157, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 179, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":166 + /* "Orange/distance/_distance.pyx":189 * double val1, val2, d * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< - * with nogil: - * for col1 in range(n_cols): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): */ __pyx_t_1 = (__pyx_v_x->dimensions[0]); __pyx_t_2 = (__pyx_v_x->dimensions[1]); __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":167 + /* "Orange/distance/_distance.pyx":190 * * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":168 + /* "Orange/distance/_distance.pyx":191 * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: - * for col1 in range(n_cols): # <<<<<<<<<<<<<< - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): - */ - __pyx_t_3 = __pyx_v_n_cols; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_col1 = __pyx_t_5; - - /* "Orange/distance/_distance.pyx":169 - * with nogil: - * for col1 in range(n_cols): - * for col2 in range(col1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[col1, col2]): - * d = 0 - */ - __pyx_t_6 = __pyx_v_col1; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_col2 = __pyx_t_8; - - /* "Orange/distance/_distance.pyx":170 - * for col1 in range(n_cols): - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): - */ - __pyx_t_9 = __pyx_v_col1; - __pyx_t_10 = __pyx_v_col2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { - - /* "Orange/distance/_distance.pyx":171 - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): - * d = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - */ - __pyx_v_d = 0.0; - - /* "Orange/distance/_distance.pyx":172 - * if npy_isnan(distances[col1, col2]): - * d = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - */ - __pyx_t_12 = __pyx_v_n_rows; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_row = __pyx_t_14; - - /* "Orange/distance/_distance.pyx":173 - * d = 0 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): - */ - __pyx_t_15 = __pyx_v_row; - __pyx_t_16 = __pyx_v_col1; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row; - __pyx_t_19 = __pyx_v_col2; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; - - /* "Orange/distance/_distance.pyx":174 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += 1 + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { - - /* "Orange/distance/_distance.pyx":175 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += 1 - * else: + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 191, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 191, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 191, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 191, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_col_start = __pyx_t_5; + + /* "Orange/distance/_distance.pyx":192 + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":176 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += 1 # <<<<<<<<<<<<<< - * else: - * d += val2 ** 2 + 0.5 + /* "Orange/distance/_distance.pyx":193 + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< + * with nogil: + * for col2 in range(col1): */ - __pyx_v_d = (__pyx_v_d + 1.0); + __pyx_t_13 = __pyx_v_n_cols; + __pyx_t_5 = (__pyx_v_col_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_col_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_col1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":175 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += 1 - * else: + /* "Orange/distance/_distance.pyx":194 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): */ - goto __pyx_L14; - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":178 - * d += 1 - * else: - * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += val1 ** 2 + 0.5 + /* "Orange/distance/_distance.pyx":195 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * for col2 in range(col1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[col1, col2]): + * d = 0 */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val2, 2.0) + 0.5)); - } - __pyx_L14:; + __pyx_t_14 = __pyx_v_col1; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_col2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":174 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += 1 + /* "Orange/distance/_distance.pyx":196 + * with nogil: + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ - goto __pyx_L13; - } + __pyx_t_17 = __pyx_v_col1; + __pyx_t_18 = __pyx_v_col2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":197 + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): + * d = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + */ + __pyx_v_d = 0.0; + + /* "Orange/distance/_distance.pyx":198 + * if npy_isnan(distances[col1, col2]): + * d = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + */ + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; + + /* "Orange/distance/_distance.pyx":199 + * d = 0 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): + */ + __pyx_t_23 = __pyx_v_row; + __pyx_t_24 = __pyx_v_col1; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row; + __pyx_t_27 = __pyx_v_col2; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":200 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += 1 + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":201 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += 1 + * else: + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":202 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += 1 # <<<<<<<<<<<<<< + * else: + * d += val2 ** 2 + 0.5 + */ + __pyx_v_d = (__pyx_v_d + 1.0); + + /* "Orange/distance/_distance.pyx":201 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += 1 + * else: + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":204 + * d += 1 + * else: + * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += val1 ** 2 + 0.5 + */ + /*else*/ { + __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val2, 2.0) + 0.5)); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":200 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += 1 + */ + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":179 + /* "Orange/distance/_distance.pyx":205 + * else: + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += val1 ** 2 + 0.5 * else: - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += val1 ** 2 + 0.5 - * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":180 - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): - * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< - * else: - * d += (val1 - val2) ** 2 + /* "Orange/distance/_distance.pyx":206 + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): + * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< + * else: + * d += (val1 - val2) ** 2 */ - __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); + __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); - /* "Orange/distance/_distance.pyx":179 + /* "Orange/distance/_distance.pyx":205 + * else: + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += val1 ** 2 + 0.5 * else: - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += val1 ** 2 + 0.5 - * else: */ - goto __pyx_L13; - } + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":182 - * d += val1 ** 2 + 0.5 - * else: - * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = d + /* "Orange/distance/_distance.pyx":208 + * d += val1 ** 2 + 0.5 + * else: + * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = d * */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + /*else*/ { + __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":183 - * else: - * d += (val1 - val2) ** 2 - * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":209 + * else: + * d += (val1 - val2) ** 2 + * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< * * */ - __pyx_t_21 = __pyx_v_col1; - __pyx_t_22 = __pyx_v_col2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - __pyx_t_23 = __pyx_v_col2; - __pyx_t_24 = __pyx_v_col1; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_29 = __pyx_v_col1; + __pyx_t_30 = __pyx_v_col2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_31 = __pyx_v_col2; + __pyx_t_32 = __pyx_v_col1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":170 - * for col1 in range(n_cols): - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): + /* "Orange/distance/_distance.pyx":196 + * with nogil: + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ + } } } - } + + /* "Orange/distance/_distance.pyx":194 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":167 - * + /* "Orange/distance/_distance.pyx":191 * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":157 + /* "Orange/distance/_distance.pyx":179 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< @@ -5211,6 +6301,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -5232,32 +6327,35 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm return __pyx_r; } -/* "Orange/distance/_distance.pyx":186 +/* "Orange/distance/_distance.pyx":212 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x2, - * char two_tables): + * char two_tables, */ /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont[] = "manhattan_rows_cont(ndarray x1, ndarray x2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont = {"manhattan_rows_cont", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont}; +static char __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont[] = "manhattan_rows_cont(ndarray x1, ndarray x2, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont = {"manhattan_rows_cont", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_x1 = 0; PyArrayObject *__pyx_v_x2 = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("manhattan_rows_cont (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_two_tables,0}; - PyObject* values[3] = {0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -5276,40 +6374,48 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, 1); __PYX_ERR(0, 186, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 4, 4, 1); __PYX_ERR(0, 212, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, 2); __PYX_ERR(0, 186, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 4, 4, 2); __PYX_ERR(0, 212, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 4, 4, 3); __PYX_ERR(0, 212, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_rows_cont") < 0)) __PYX_ERR(0, 186, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_rows_cont") < 0)) __PYX_ERR(0, 212, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_x1 = ((PyArrayObject *)values[0]); __pyx_v_x2 = ((PyArrayObject *)values[1]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[2]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[2]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) + __pyx_v_callback = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 186, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 212, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.manhattan_rows_cont", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 186, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 187, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(__pyx_self, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 212, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(__pyx_self, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -5320,15 +6426,17 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyO return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_d; PyArrayObject *__pyx_v_distances = 0; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; __Pyx_Buffer __pyx_pybuffer_distances; __Pyx_LocalBuf_ND __pyx_pybuffernd_x1; @@ -5348,20 +6456,24 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + Py_ssize_t __pyx_t_15; + PyObject *(*__pyx_t_16)(PyObject *); + PyObject *__pyx_t_17 = NULL; int __pyx_t_18; int __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; Py_ssize_t __pyx_t_24; Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; __Pyx_RefNannySetupContext("manhattan_rows_cont", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -5377,16 +6489,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_pybuffernd_x2.rcbuffer = &__pyx_pybuffer_x2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 186, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 212, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 186, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 212, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":194 + /* "Orange/distance/_distance.pyx":221 * np.ndarray[np.float64_t, ndim=2] distances * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< @@ -5398,32 +6510,32 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":195 + /* "Orange/distance/_distance.pyx":222 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":196 + /* "Orange/distance/_distance.pyx":223 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -5431,20 +6543,20 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __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(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 196, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 223, __pyx_L1_error) __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -5461,126 +6573,256 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_t_9 = __pyx_t_10 = __pyx_t_11 = 0; } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 196, __pyx_L1_error) + if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 223, __pyx_L1_error) } __pyx_t_7 = 0; __pyx_v_distances = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "Orange/distance/_distance.pyx":197 + /* "Orange/distance/_distance.pyx":224 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + */ + __pyx_t_12 = 0x64; + __pyx_t_13 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_12 > __pyx_t_13) != 0)) { + __pyx_t_14 = __pyx_t_12; + } else { + __pyx_t_14 = __pyx_t_13; + } + __pyx_v_step = __pyx_t_14; - /* "Orange/distance/_distance.pyx":198 + /* "Orange/distance/_distance.pyx":225 * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 - */ - __pyx_t_8 = __pyx_v_n_rows1; - __pyx_t_12 = __pyx_t_8; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_row1 = __pyx_t_13; - - /* "Orange/distance/_distance.pyx":199 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): - */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_14 = __pyx_v_n_rows2; - } else { - __pyx_t_14 = __pyx_v_row1; - } - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_row2 = __pyx_t_16; - - /* "Orange/distance/_distance.pyx":200 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * d += fabs(x1[row1, col] - x2[row2, col]) - */ - __pyx_v_d = 0.0; - - /* "Orange/distance/_distance.pyx":201 - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * d += fabs(x1[row1, col] - x2[row2, col]) - * distances[row1, row2] = d + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_17 = __pyx_v_n_cols; - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_col = __pyx_t_19; - - /* "Orange/distance/_distance.pyx":202 - * d = 0 - * for col in range(n_cols): - * d += fabs(x1[row1, col] - x2[row2, col]) # <<<<<<<<<<<<<< - * distances[row1, row2] = d - * return distances - */ - __pyx_t_20 = __pyx_v_row1; - __pyx_t_21 = __pyx_v_col; - __pyx_t_22 = __pyx_v_row2; - __pyx_t_23 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x1.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_x2.diminfo[1].strides))))); - } - - /* "Orange/distance/_distance.pyx":203 - * for col in range(n_cols): - * d += fabs(x1[row1, col] - x2[row2, col]) - * distances[row1, row2] = d # <<<<<<<<<<<<<< - * return distances - * - */ - __pyx_t_24 = __pyx_v_row1; - __pyx_t_25 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - } + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_15 = 0; + __pyx_t_16 = NULL; + } else { + __pyx_t_15 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_16 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 225, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_16)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_15); __Pyx_INCREF(__pyx_t_6); __pyx_t_15++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_15); __Pyx_INCREF(__pyx_t_6); __pyx_t_15++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_16(__pyx_t_5); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 225, __pyx_L1_error) } + break; } + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_row_start = __pyx_t_14; - /* "Orange/distance/_distance.pyx":197 - * n_rows2 = x2.shape[0] - * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + /* "Orange/distance/_distance.pyx":226 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS + __pyx_t_3 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_4 = __pyx_v_callback; __pyx_t_17 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_6 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_17, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "Orange/distance/_distance.pyx":227 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + */ + __pyx_t_8 = __pyx_v_n_rows1; + __pyx_t_14 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_8 < __pyx_t_14) != 0)) { + __pyx_t_12 = __pyx_t_8; + } else { + __pyx_t_12 = __pyx_t_14; + } + __pyx_t_14 = __pyx_t_12; + __pyx_t_12 = __pyx_t_14; + for (__pyx_t_8 = __pyx_v_row_start; __pyx_t_8 < __pyx_t_12; __pyx_t_8+=1) { + __pyx_v_row1 = __pyx_t_8; + + /* "Orange/distance/_distance.pyx":228 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); #endif - goto __pyx_L5; - } - __pyx_L5:; + /*try:*/ { + + /* "Orange/distance/_distance.pyx":229 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): + */ + if ((__pyx_v_two_tables != 0)) { + __pyx_t_18 = __pyx_v_n_rows2; + } else { + __pyx_t_18 = __pyx_v_row1; + } + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { + __pyx_v_row2 = __pyx_t_20; + + /* "Orange/distance/_distance.pyx":230 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * d += fabs(x1[row1, col] - x2[row2, col]) + */ + __pyx_v_d = 0.0; + + /* "Orange/distance/_distance.pyx":231 + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * d += fabs(x1[row1, col] - x2[row2, col]) + * distances[row1, row2] = d + */ + __pyx_t_21 = __pyx_v_n_cols; + __pyx_t_22 = __pyx_t_21; + for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) { + __pyx_v_col = __pyx_t_23; + + /* "Orange/distance/_distance.pyx":232 + * d = 0 + * for col in range(n_cols): + * d += fabs(x1[row1, col] - x2[row2, col]) # <<<<<<<<<<<<<< + * distances[row1, row2] = d + * return distances + */ + __pyx_t_24 = __pyx_v_row1; + __pyx_t_25 = __pyx_v_col; + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_x1.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides))))); + } + + /* "Orange/distance/_distance.pyx":233 + * for col in range(n_cols): + * d += fabs(x1[row1, col] - x2[row2, col]) + * distances[row1, row2] = d # <<<<<<<<<<<<<< + * return distances + * + */ + __pyx_t_28 = __pyx_v_row1; + __pyx_t_29 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + } + } + + /* "Orange/distance/_distance.pyx":228 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } + + /* "Orange/distance/_distance.pyx":225 + * distances = np.zeros((n_rows1, n_rows2), dtype=float) + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + */ } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":204 - * d += fabs(x1[row1, col] - x2[row2, col]) - * distances[row1, row2] = d + /* "Orange/distance/_distance.pyx":234 + * d += fabs(x1[row1, col] - x2[row2, col]) + * distances[row1, row2] = d * return distances # <<<<<<<<<<<<<< * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, @@ -5590,12 +6832,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_r = ((PyObject *)__pyx_v_distances); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":186 + /* "Orange/distance/_distance.pyx":212 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x2, - * char two_tables): + * char two_tables, */ /* function exit code */ @@ -5604,6 +6846,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_17); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -5626,7 +6869,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT return __pyx_r; } -/* "Orange/distance/_distance.pyx":206 +/* "Orange/distance/_distance.pyx":236 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -5636,8 +6879,8 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows[] = "fix_manhattan_rows(ndarray distances, ndarray x1, ndarray x2, ndarray medians, ndarray mads, ndarray dist_missing2_cont, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows = {"fix_manhattan_rows", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows}; +static char __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows[] = "fix_manhattan_rows(ndarray distances, ndarray x1, ndarray x2, ndarray medians, ndarray mads, ndarray dist_missing2_cont, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows = {"fix_manhattan_rows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; @@ -5646,16 +6889,19 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb PyArrayObject *__pyx_v_mads = 0; PyArrayObject *__pyx_v_dist_missing2_cont = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_manhattan_rows (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_medians,&__pyx_n_s_mads,&__pyx_n_s_dist_missing2_cont,&__pyx_n_s_two_tables,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_medians,&__pyx_n_s_mads,&__pyx_n_s_dist_missing2_cont,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -5682,43 +6928,49 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 1); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 1); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 2); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 2); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_medians)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 3); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 3); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 4); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 4); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2_cont)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 5); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 5); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 6); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 6); __PYX_ERR(0, 236, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 7); __PYX_ERR(0, 236, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows") < 0)) __PYX_ERR(0, 206, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows") < 0)) __PYX_ERR(0, 236, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -5728,6 +6980,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); @@ -5735,23 +6988,24 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb __pyx_v_medians = ((PyArrayObject *)values[3]); __pyx_v_mads = ((PyArrayObject *)values[4]); __pyx_v_dist_missing2_cont = ((PyArrayObject *)values[5]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_callback = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 236, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_manhattan_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 206, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 207, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 208, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 209, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 210, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2_cont), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2_cont", 0))) __PYX_ERR(0, 211, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_medians, __pyx_v_mads, __pyx_v_dist_missing2_cont, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 236, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 237, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 238, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 240, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2_cont), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2_cont", 0))) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_medians, __pyx_v_mads, __pyx_v_dist_missing2_cont, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -5762,16 +7016,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, PyArrayObject *__pyx_v_dist_missing2_cont, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, PyArrayObject *__pyx_v_dist_missing2_cont, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_dist_missing2_cont; __Pyx_Buffer __pyx_pybuffer_dist_missing2_cont; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; @@ -5788,31 +7044,39 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; __Pyx_RefNannySetupContext("fix_manhattan_rows", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -5840,53 +7104,53 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_pybuffernd_dist_missing2_cont.rcbuffer = &__pyx_pybuffer_dist_missing2_cont; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_medians.diminfo[0].strides = __pyx_pybuffernd_medians.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_medians.diminfo[0].shape = __pyx_pybuffernd_medians.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_mads.diminfo[0].strides = __pyx_pybuffernd_mads.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mads.diminfo[0].shape = __pyx_pybuffernd_mads.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2_cont, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2_cont, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2_cont.diminfo[0].strides = __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2_cont.diminfo[0].shape = __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":217 + /* "Orange/distance/_distance.pyx":248 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":218 + /* "Orange/distance/_distance.pyx":249 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ if ((__pyx_v_two_tables != 0)) { __pyx_t_2 = (__pyx_v_x2->dimensions[0]); @@ -5895,251 +7159,381 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH } __pyx_v_n_rows2 = __pyx_t_2; - /* "Orange/distance/_distance.pyx":219 + /* "Orange/distance/_distance.pyx":250 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":220 + /* "Orange/distance/_distance.pyx":251 * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; - - /* "Orange/distance/_distance.pyx":221 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[row1, row2]): - * d = 0 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; - - /* "Orange/distance/_distance.pyx":222 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 251, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 251, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 251, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 251, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; + + /* "Orange/distance/_distance.pyx":252 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - __pyx_t_9 = __pyx_v_row1; - __pyx_t_10 = __pyx_v_row2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":223 - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + /* "Orange/distance/_distance.pyx":253 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_v_d = 0.0; + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":224 - * if npy_isnan(distances[row1, row2]): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":254 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): */ - __pyx_t_12 = __pyx_v_n_cols; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_col = __pyx_t_14; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":225 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":255 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[row1, row2]): + * d = 0 */ - __pyx_t_15 = __pyx_v_row1; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row2; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":226 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2_cont[col] + /* "Orange/distance/_distance.pyx":256 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + __pyx_t_17 = __pyx_v_row1; + __pyx_t_18 = __pyx_v_row2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":227 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2_cont[col] - * else: + /* "Orange/distance/_distance.pyx":257 + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":228 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += dist_missing2_cont[col] # <<<<<<<<<<<<<< - * else: - * d += fabs(val2 - medians[col]) + mads[col] + /* "Orange/distance/_distance.pyx":258 + * if npy_isnan(distances[row1, row2]): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): */ - __pyx_t_21 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_dist_missing2_cont.diminfo[0].strides))); + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":227 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2_cont[col] - * else: + /* "Orange/distance/_distance.pyx":259 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - goto __pyx_L14; - } + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":230 - * d += dist_missing2_cont[col] - * else: - * d += fabs(val2 - medians[col]) + mads[col] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += fabs(val1 - medians[col]) + mads[col] + /* "Orange/distance/_distance.pyx":260 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2_cont[col] */ - /*else*/ { - __pyx_t_22 = __pyx_v_col; - __pyx_t_23 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_mads.diminfo[0].strides)))); - } - __pyx_L14:; + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":226 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2_cont[col] + /* "Orange/distance/_distance.pyx":261 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2_cont[col] + * else: */ - goto __pyx_L13; - } + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":231 - * else: - * d += fabs(val2 - medians[col]) + mads[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += fabs(val1 - medians[col]) + mads[col] - * else: + /* "Orange/distance/_distance.pyx":262 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += dist_missing2_cont[col] # <<<<<<<<<<<<<< + * else: + * d += fabs(val2 - medians[col]) + mads[col] */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_29 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dist_missing2_cont.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":232 - * d += fabs(val2 - medians[col]) + mads[col] - * elif npy_isnan(val2): - * d += fabs(val1 - medians[col]) + mads[col] # <<<<<<<<<<<<<< - * else: - * d += fabs(val1 - val2) + /* "Orange/distance/_distance.pyx":261 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2_cont[col] + * else: */ - __pyx_t_24 = __pyx_v_col; - __pyx_t_25 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_mads.diminfo[0].strides)))); + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":231 - * else: - * d += fabs(val2 - medians[col]) + mads[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += fabs(val1 - medians[col]) + mads[col] - * else: + /* "Orange/distance/_distance.pyx":264 + * d += dist_missing2_cont[col] + * else: + * d += fabs(val2 - medians[col]) + mads[col] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += fabs(val1 - medians[col]) + mads[col] */ - goto __pyx_L13; - } + /*else*/ { + __pyx_t_30 = __pyx_v_col; + __pyx_t_31 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_mads.diminfo[0].strides)))); + } + __pyx_L18:; - /* "Orange/distance/_distance.pyx":234 - * d += fabs(val1 - medians[col]) + mads[col] - * else: - * d += fabs(val1 - val2) # <<<<<<<<<<<<<< - * distances[row1, row2] = d + /* "Orange/distance/_distance.pyx":260 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2_cont[col] + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":265 + * else: + * d += fabs(val2 - medians[col]) + mads[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += fabs(val1 - medians[col]) + mads[col] + * else: + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":266 + * d += fabs(val2 - medians[col]) + mads[col] + * elif npy_isnan(val2): + * d += fabs(val1 - medians[col]) + mads[col] # <<<<<<<<<<<<<< + * else: + * d += fabs(val1 - val2) + */ + __pyx_t_32 = __pyx_v_col; + __pyx_t_33 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_mads.diminfo[0].strides)))); + + /* "Orange/distance/_distance.pyx":265 + * else: + * d += fabs(val2 - medians[col]) + mads[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += fabs(val1 - medians[col]) + mads[col] + * else: + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":268 + * d += fabs(val1 - medians[col]) + mads[col] + * else: + * d += fabs(val1 - val2) # <<<<<<<<<<<<<< + * distances[row1, row2] = d * return distances */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); + /*else*/ { + __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":235 - * else: - * d += fabs(val1 - val2) - * distances[row1, row2] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":269 + * else: + * d += fabs(val1 - val2) + * distances[row1, row2] = d # <<<<<<<<<<<<<< * return distances * */ - __pyx_t_26 = __pyx_v_row1; - __pyx_t_27 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_34 = __pyx_v_row1; + __pyx_t_35 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":222 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":256 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ + } } } - } + + /* "Orange/distance/_distance.pyx":254 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":219 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] + /* "Orange/distance/_distance.pyx":251 * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":236 - * d += fabs(val1 - val2) - * distances[row1, row2] = d + /* "Orange/distance/_distance.pyx":270 + * d += fabs(val1 - val2) + * distances[row1, row2] = d * return distances # <<<<<<<<<<<<<< * * @@ -6149,7 +7543,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_r = ((PyObject *)__pyx_v_distances); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":206 + /* "Orange/distance/_distance.pyx":236 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -6159,6 +7553,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -6186,7 +7585,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH return __pyx_r; } -/* "Orange/distance/_distance.pyx":239 +/* "Orange/distance/_distance.pyx":273 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -6196,23 +7595,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized[] = "fix_manhattan_rows_normalized(ndarray distances, ndarray x1, ndarray x2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized = {"fix_manhattan_rows_normalized", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized}; +static char __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized[] = "fix_manhattan_rows_normalized(ndarray distances, ndarray x1, ndarray x2, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized = {"fix_manhattan_rows_normalized", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; PyArrayObject *__pyx_v_x2 = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_manhattan_rows_normalized (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_two_tables,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -6233,49 +7635,57 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_norm case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 1); __PYX_ERR(0, 239, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, 1); __PYX_ERR(0, 273, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 2); __PYX_ERR(0, 239, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, 2); __PYX_ERR(0, 273, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 3); __PYX_ERR(0, 239, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, 3); __PYX_ERR(0, 273, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, 4); __PYX_ERR(0, 273, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows_normalized") < 0)) __PYX_ERR(0, 239, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows_normalized") < 0)) __PYX_ERR(0, 273, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); __pyx_v_x2 = ((PyArrayObject *)values[2]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error) + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 239, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 273, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_manhattan_rows_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 239, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 240, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 273, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 274, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -6286,16 +7696,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_norm return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; __Pyx_Buffer __pyx_pybuffer_distances; __Pyx_LocalBuf_ND __pyx_pybuffernd_x1; @@ -6306,26 +7718,34 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + __pyx_t_5numpy_float64_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; __Pyx_RefNannySetupContext("fix_manhattan_rows_normalized", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -6341,38 +7761,38 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_pybuffernd_x2.rcbuffer = &__pyx_pybuffer_x2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 273, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 273, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 273, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":247 + /* "Orange/distance/_distance.pyx":282 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":248 + /* "Orange/distance/_distance.pyx":283 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ if ((__pyx_v_two_tables != 0)) { __pyx_t_2 = (__pyx_v_x2->dimensions[0]); @@ -6381,246 +7801,376 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm } __pyx_v_n_rows2 = __pyx_t_2; - /* "Orange/distance/_distance.pyx":249 + /* "Orange/distance/_distance.pyx":284 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":250 + /* "Orange/distance/_distance.pyx":285 * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; - - /* "Orange/distance/_distance.pyx":251 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[row1, row2]): - * d = 0 - */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; - - /* "Orange/distance/_distance.pyx":252 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_9 = __pyx_v_row1; - __pyx_t_10 = __pyx_v_row2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 285, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 285, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":253 - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + /* "Orange/distance/_distance.pyx":286 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - __pyx_v_d = 0.0; + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":254 - * if npy_isnan(distances[row1, row2]): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":287 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_t_12 = __pyx_v_n_cols; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_col = __pyx_t_14; + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":255 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":288 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): */ - __pyx_t_15 = __pyx_v_row1; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row2; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":256 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += 1 + /* "Orange/distance/_distance.pyx":289 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[row1, row2]): + * d = 0 */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":257 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += 1 - * else: + /* "Orange/distance/_distance.pyx":290 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_17 = __pyx_v_row1; + __pyx_t_18 = __pyx_v_row2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":258 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += 1 # <<<<<<<<<<<<<< - * else: - * d += fabs(val2) + 0.5 + /* "Orange/distance/_distance.pyx":291 + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_v_d = (__pyx_v_d + 1.0); + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":257 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += 1 - * else: + /* "Orange/distance/_distance.pyx":292 + * if npy_isnan(distances[row1, row2]): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): */ - goto __pyx_L14; - } + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":260 - * d += 1 - * else: - * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += fabs(val1) + 0.5 + /* "Orange/distance/_distance.pyx":293 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val2) + 0.5)); - } - __pyx_L14:; - - /* "Orange/distance/_distance.pyx":256 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += 1 + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":294 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += 1 */ - goto __pyx_L13; - } + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":261 - * else: - * d += fabs(val2) + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += fabs(val1) + 0.5 - * else: + /* "Orange/distance/_distance.pyx":295 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += 1 + * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":262 - * d += fabs(val2) + 0.5 - * elif npy_isnan(val2): - * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< - * else: - * d += fabs(val1 - val2) + /* "Orange/distance/_distance.pyx":296 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += 1 # <<<<<<<<<<<<<< + * else: + * d += fabs(val2) + 0.5 */ - __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); + __pyx_v_d = (__pyx_v_d + 1.0); - /* "Orange/distance/_distance.pyx":261 - * else: - * d += fabs(val2) + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += fabs(val1) + 0.5 - * else: + /* "Orange/distance/_distance.pyx":295 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += 1 + * else: */ - goto __pyx_L13; - } + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":264 - * d += fabs(val1) + 0.5 - * else: - * d += fabs(val1 - val2) # <<<<<<<<<<<<<< - * distances[row1, row2] = d - * return distances + /* "Orange/distance/_distance.pyx":298 + * d += 1 + * else: + * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += fabs(val1) + 0.5 */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); - } - __pyx_L13:; - } + /*else*/ { + __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val2) + 0.5)); + } + __pyx_L18:; - /* "Orange/distance/_distance.pyx":265 - * else: - * d += fabs(val1 - val2) - * distances[row1, row2] = d # <<<<<<<<<<<<<< - * return distances - * + /* "Orange/distance/_distance.pyx":294 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += 1 */ - __pyx_t_21 = __pyx_v_row1; - __pyx_t_22 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":252 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":299 + * else: + * d += fabs(val2) + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += fabs(val1) + 0.5 + * else: + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":300 + * d += fabs(val2) + 0.5 + * elif npy_isnan(val2): + * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< + * else: + * d += fabs(val1 - val2) + */ + __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); + + /* "Orange/distance/_distance.pyx":299 + * else: + * d += fabs(val2) + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += fabs(val1) + 0.5 + * else: + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":302 + * d += fabs(val1) + 0.5 + * else: + * d += fabs(val1 - val2) # <<<<<<<<<<<<<< + * distances[row1, row2] = d + * return distances + */ + /*else*/ { + __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); + } + __pyx_L17:; + } + + /* "Orange/distance/_distance.pyx":303 + * else: + * d += fabs(val1 - val2) + * distances[row1, row2] = d # <<<<<<<<<<<<<< + * return distances + * + */ + __pyx_t_29 = __pyx_v_row1; + __pyx_t_30 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + + /* "Orange/distance/_distance.pyx":290 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ + } } } - } + + /* "Orange/distance/_distance.pyx":288 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":249 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] + /* "Orange/distance/_distance.pyx":285 * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":266 - * d += fabs(val1 - val2) - * distances[row1, row2] = d + /* "Orange/distance/_distance.pyx":304 + * d += fabs(val1 - val2) + * distances[row1, row2] = d * return distances # <<<<<<<<<<<<<< * * @@ -6630,7 +8180,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_r = ((PyObject *)__pyx_v_distances); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":239 + /* "Orange/distance/_distance.pyx":273 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -6640,6 +8190,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -6661,7 +8216,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm return __pyx_r; } -/* "Orange/distance/_distance.pyx":269 +/* "Orange/distance/_distance.pyx":307 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< @@ -6671,23 +8226,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols[] = "manhattan_cols(ndarray x, ndarray medians, ndarray mads, char normalize)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols = {"manhattan_cols", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols}; +static char __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols[] = "manhattan_cols(ndarray x, ndarray medians, ndarray mads, char normalize, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols = {"manhattan_cols", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_x = 0; PyArrayObject *__pyx_v_medians = 0; PyArrayObject *__pyx_v_mads = 0; char __pyx_v_normalize; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("manhattan_cols (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_medians,&__pyx_n_s_mads,&__pyx_n_s_normalize,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_medians,&__pyx_n_s_mads,&__pyx_n_s_normalize,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -6708,49 +8266,57 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_medians)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 1); __PYX_ERR(0, 269, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, 1); __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 2); __PYX_ERR(0, 269, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, 2); __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_normalize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 3); __PYX_ERR(0, 269, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, 3); __PYX_ERR(0, 307, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, 4); __PYX_ERR(0, 307, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_cols") < 0)) __PYX_ERR(0, 269, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_cols") < 0)) __PYX_ERR(0, 307, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_x = ((PyArrayObject *)values[0]); __pyx_v_medians = ((PyArrayObject *)values[1]); __pyx_v_mads = ((PyArrayObject *)values[2]); - __pyx_v_normalize = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_normalize == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L3_error) + __pyx_v_normalize = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_normalize == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 310, __pyx_L3_error) + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 269, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 307, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.manhattan_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 269, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 270, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 271, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(__pyx_self, __pyx_v_x, __pyx_v_medians, __pyx_v_mads, __pyx_v_normalize); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 307, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 308, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 309, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(__pyx_self, __pyx_v_x, __pyx_v_medians, __pyx_v_mads, __pyx_v_normalize, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -6761,16 +8327,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize, PyObject *__pyx_v_callback) { int __pyx_v_n_rows; int __pyx_v_n_cols; int __pyx_v_col1; int __pyx_v_col2; int __pyx_v_row; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_col_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_mads; __Pyx_Buffer __pyx_pybuffer_mads; __Pyx_LocalBuf_ND __pyx_pybuffernd_medians; @@ -6781,31 +8349,31 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; PyObject *__pyx_t_6 = NULL; - __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; int __pyx_t_14; int __pyx_t_15; int __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - __pyx_t_5numpy_float64_t __pyx_t_19; - Py_ssize_t __pyx_t_20; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; Py_ssize_t __pyx_t_21; - __pyx_t_5numpy_float64_t __pyx_t_22; - int __pyx_t_23; + Py_ssize_t __pyx_t_22; + __pyx_t_5numpy_float64_t __pyx_t_23; Py_ssize_t __pyx_t_24; Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_26; + int __pyx_t_27; Py_ssize_t __pyx_t_28; Py_ssize_t __pyx_t_29; Py_ssize_t __pyx_t_30; @@ -6814,6 +8382,10 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U Py_ssize_t __pyx_t_33; Py_ssize_t __pyx_t_34; Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + Py_ssize_t __pyx_t_37; + Py_ssize_t __pyx_t_38; + Py_ssize_t __pyx_t_39; __Pyx_RefNannySetupContext("manhattan_cols", 0); __pyx_pybuffer_x.pybuffer.buf = NULL; __pyx_pybuffer_x.refcount = 0; @@ -6829,428 +8401,558 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_pybuffernd_mads.rcbuffer = &__pyx_pybuffer_mads; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 269, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 307, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 269, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 307, __pyx_L1_error) } __pyx_pybuffernd_medians.diminfo[0].strides = __pyx_pybuffernd_medians.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_medians.diminfo[0].shape = __pyx_pybuffernd_medians.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 269, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 307, __pyx_L1_error) } __pyx_pybuffernd_mads.diminfo[0].strides = __pyx_pybuffernd_mads.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mads.diminfo[0].shape = __pyx_pybuffernd_mads.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":278 + /* "Orange/distance/_distance.pyx":317 * double [:, :] distances * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< + * step = max(n_cols // 100, 100) * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: */ __pyx_t_1 = (__pyx_v_x->dimensions[0]); __pyx_t_2 = (__pyx_v_x->dimensions[1]); __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":279 + /* "Orange/distance/_distance.pyx":318 * * n_rows, n_cols = x.shape[0], x.shape[1] + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * distances = np.zeros((n_cols, n_cols), dtype=float) + * for col_start in range(0, n_cols, step): + */ + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; + + /* "Orange/distance/_distance.pyx":319 + * n_rows, n_cols = x.shape[0], x.shape[1] + * step = max(n_cols // 100, 100) * distances = np.zeros((n_cols, n_cols), dtype=float) # <<<<<<<<<<<<<< - * with nogil: - * for col1 in range(n_cols): + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 319, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 279, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __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(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_distances = __pyx_t_7; - __pyx_t_7.memview = NULL; - __pyx_t_7.data = NULL; + __pyx_v_distances = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "Orange/distance/_distance.pyx":280 - * n_rows, n_cols = x.shape[0], x.shape[1] + /* "Orange/distance/_distance.pyx":320 + * step = max(n_cols // 100, 100) * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9); + __pyx_t_6 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { + __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 320, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_9); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 320, __pyx_L1_error) + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_9); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 320, __pyx_L1_error) + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + } + } else { + __pyx_t_9 = __pyx_t_12(__pyx_t_8); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 320, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_9); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_col_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":281 + /* "Orange/distance/_distance.pyx":321 * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: - * for col1 in range(n_cols): # <<<<<<<<<<<<<< - * for col2 in range(col1): - * d = 0 - */ - __pyx_t_8 = __pyx_v_n_cols; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_col1 = __pyx_t_10; - - /* "Orange/distance/_distance.pyx":282 - * with nogil: - * for col1 in range(n_cols): - * for col2 in range(col1): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): - */ - __pyx_t_11 = __pyx_v_col1; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_col2 = __pyx_t_13; - - /* "Orange/distance/_distance.pyx":283 - * for col1 in range(n_cols): - * for col2 in range(col1): - * d = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - */ - __pyx_v_d = 0.0; - - /* "Orange/distance/_distance.pyx":284 - * for col2 in range(col1): - * d = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - */ - __pyx_t_14 = __pyx_v_n_rows; - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_row = __pyx_t_16; - - /* "Orange/distance/_distance.pyx":285 - * d = 0 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): - */ - __pyx_t_17 = __pyx_v_row; - __pyx_t_18 = __pyx_v_col1; - __pyx_t_19 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_t_20 = __pyx_v_row; - __pyx_t_21 = __pyx_v_col2; - __pyx_t_22 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_19; - __pyx_v_val2 = __pyx_t_22; - - /* "Orange/distance/_distance.pyx":286 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * if normalize: - */ - __pyx_t_23 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_23) { - - /* "Orange/distance/_distance.pyx":287 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if normalize: - * d += 1 - */ - __pyx_t_23 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_23) { - - /* "Orange/distance/_distance.pyx":288 - * if npy_isnan(val1): - * if npy_isnan(val2): - * if normalize: # <<<<<<<<<<<<<< - * d += 1 - * else: + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: */ - __pyx_t_23 = (__pyx_v_normalize != 0); - if (__pyx_t_23) { + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_7 = __pyx_v_callback; __pyx_t_13 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_9 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_13, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "Orange/distance/_distance.pyx":289 - * if npy_isnan(val2): - * if normalize: - * d += 1 # <<<<<<<<<<<<<< - * else: - * d += mads[col1] + mads[col2] \ + /* "Orange/distance/_distance.pyx":322 + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< + * with nogil: + * for col2 in range(col1): */ - __pyx_v_d = (__pyx_v_d + 1.0); + __pyx_t_14 = __pyx_v_n_cols; + __pyx_t_5 = (__pyx_v_col_start + __pyx_v_step); + if (((__pyx_t_14 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_14; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_14 = __pyx_v_col_start; __pyx_t_14 < __pyx_t_3; __pyx_t_14+=1) { + __pyx_v_col1 = __pyx_t_14; - /* "Orange/distance/_distance.pyx":288 - * if npy_isnan(val1): - * if npy_isnan(val2): - * if normalize: # <<<<<<<<<<<<<< - * d += 1 - * else: + /* "Orange/distance/_distance.pyx":323 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * d = 0 */ - goto __pyx_L14; - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":291 - * d += 1 - * else: - * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< - * + fabs(medians[col1] - medians[col2]) - * else: + /* "Orange/distance/_distance.pyx":324 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * for col2 in range(col1): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ - /*else*/ { - __pyx_t_24 = __pyx_v_col1; - __pyx_t_25 = __pyx_v_col2; + __pyx_t_15 = __pyx_v_col1; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_col2 = __pyx_t_17; - /* "Orange/distance/_distance.pyx":292 - * else: - * d += mads[col1] + mads[col2] \ - * + fabs(medians[col1] - medians[col2]) # <<<<<<<<<<<<<< - * else: - * if normalize: + /* "Orange/distance/_distance.pyx":325 + * with nogil: + * for col2 in range(col1): + * d = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] */ - __pyx_t_26 = __pyx_v_col1; - __pyx_t_27 = __pyx_v_col2; + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":291 - * d += 1 - * else: - * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< - * + fabs(medians[col1] - medians[col2]) - * else: + /* "Orange/distance/_distance.pyx":326 + * for col2 in range(col1): + * d = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): */ - __pyx_v_d = (__pyx_v_d + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_mads.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_mads.diminfo[0].strides))) + fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_medians.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_medians.diminfo[0].strides)))))); - } - __pyx_L14:; + __pyx_t_18 = __pyx_v_n_rows; + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { + __pyx_v_row = __pyx_t_20; - /* "Orange/distance/_distance.pyx":287 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if normalize: - * d += 1 + /* "Orange/distance/_distance.pyx":327 + * d = 0 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - goto __pyx_L13; - } + __pyx_t_21 = __pyx_v_row; + __pyx_t_22 = __pyx_v_col1; + __pyx_t_23 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_t_24 = __pyx_v_row; + __pyx_t_25 = __pyx_v_col2; + __pyx_t_26 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_23; + __pyx_v_val2 = __pyx_t_26; - /* "Orange/distance/_distance.pyx":294 - * + fabs(medians[col1] - medians[col2]) - * else: - * if normalize: # <<<<<<<<<<<<<< - * d += fabs(val2) + 0.5 - * else: + /* "Orange/distance/_distance.pyx":328 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * if normalize: */ - /*else*/ { - __pyx_t_23 = (__pyx_v_normalize != 0); - if (__pyx_t_23) { + __pyx_t_27 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_27) { - /* "Orange/distance/_distance.pyx":295 - * else: - * if normalize: - * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< - * else: - * d += fabs(val2 - medians[col1]) + mads[col1] + /* "Orange/distance/_distance.pyx":329 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if normalize: + * d += 1 */ - __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val2) + 0.5)); + __pyx_t_27 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_27) { - /* "Orange/distance/_distance.pyx":294 - * + fabs(medians[col1] - medians[col2]) - * else: - * if normalize: # <<<<<<<<<<<<<< - * d += fabs(val2) + 0.5 - * else: + /* "Orange/distance/_distance.pyx":330 + * if npy_isnan(val1): + * if npy_isnan(val2): + * if normalize: # <<<<<<<<<<<<<< + * d += 1 + * else: */ - goto __pyx_L15; - } + __pyx_t_27 = (__pyx_v_normalize != 0); + if (__pyx_t_27) { - /* "Orange/distance/_distance.pyx":297 - * d += fabs(val2) + 0.5 - * else: - * d += fabs(val2 - medians[col1]) + mads[col1] # <<<<<<<<<<<<<< - * else: - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":331 + * if npy_isnan(val2): + * if normalize: + * d += 1 # <<<<<<<<<<<<<< + * else: + * d += mads[col1] + mads[col2] \ */ - /*else*/ { - __pyx_t_28 = __pyx_v_col1; - __pyx_t_29 = __pyx_v_col1; - __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_mads.diminfo[0].strides)))); - } - __pyx_L15:; - } - __pyx_L13:; + __pyx_v_d = (__pyx_v_d + 1.0); - /* "Orange/distance/_distance.pyx":286 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * if normalize: + /* "Orange/distance/_distance.pyx":330 + * if npy_isnan(val1): + * if npy_isnan(val2): + * if normalize: # <<<<<<<<<<<<<< + * d += 1 + * else: */ - goto __pyx_L12; - } + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":299 - * d += fabs(val2 - medians[col1]) + mads[col1] - * else: - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if normalize: - * d += fabs(val1) + 0.5 + /* "Orange/distance/_distance.pyx":333 + * d += 1 + * else: + * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< + * + fabs(medians[col1] - medians[col2]) + * else: */ - /*else*/ { - __pyx_t_23 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_23) { + /*else*/ { + __pyx_t_28 = __pyx_v_col1; + __pyx_t_29 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":300 - * else: - * if npy_isnan(val2): - * if normalize: # <<<<<<<<<<<<<< - * d += fabs(val1) + 0.5 + /* "Orange/distance/_distance.pyx":334 + * else: + * d += mads[col1] + mads[col2] \ + * + fabs(medians[col1] - medians[col2]) # <<<<<<<<<<<<<< * else: + * if normalize: */ - __pyx_t_23 = (__pyx_v_normalize != 0); - if (__pyx_t_23) { + __pyx_t_30 = __pyx_v_col1; + __pyx_t_31 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":301 - * if npy_isnan(val2): - * if normalize: - * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":333 + * d += 1 + * else: + * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< + * + fabs(medians[col1] - medians[col2]) * else: - * d += fabs(val1 - medians[col2]) + mads[col2] */ - __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); + __pyx_v_d = (__pyx_v_d + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_mads.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_mads.diminfo[0].strides))) + fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_medians.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_medians.diminfo[0].strides)))))); + } + __pyx_L18:; - /* "Orange/distance/_distance.pyx":300 - * else: - * if npy_isnan(val2): - * if normalize: # <<<<<<<<<<<<<< - * d += fabs(val1) + 0.5 - * else: + /* "Orange/distance/_distance.pyx":329 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if normalize: + * d += 1 */ goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":303 - * d += fabs(val1) + 0.5 + /* "Orange/distance/_distance.pyx":336 + * + fabs(medians[col1] - medians[col2]) * else: - * d += fabs(val1 - medians[col2]) + mads[col2] # <<<<<<<<<<<<<< - * else: - * d += fabs(val1 - val2) + * if normalize: # <<<<<<<<<<<<<< + * d += fabs(val2) + 0.5 + * else: */ /*else*/ { - __pyx_t_30 = __pyx_v_col2; - __pyx_t_31 = __pyx_v_col2; - __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_mads.diminfo[0].strides)))); + __pyx_t_27 = (__pyx_v_normalize != 0); + if (__pyx_t_27) { + + /* "Orange/distance/_distance.pyx":337 + * else: + * if normalize: + * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< + * else: + * d += fabs(val2 - medians[col1]) + mads[col1] + */ + __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val2) + 0.5)); + + /* "Orange/distance/_distance.pyx":336 + * + fabs(medians[col1] - medians[col2]) + * else: + * if normalize: # <<<<<<<<<<<<<< + * d += fabs(val2) + 0.5 + * else: + */ + goto __pyx_L19; + } + + /* "Orange/distance/_distance.pyx":339 + * d += fabs(val2) + 0.5 + * else: + * d += fabs(val2 - medians[col1]) + mads[col1] # <<<<<<<<<<<<<< + * else: + * if npy_isnan(val2): + */ + /*else*/ { + __pyx_t_32 = __pyx_v_col1; + __pyx_t_33 = __pyx_v_col1; + __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_mads.diminfo[0].strides)))); + } + __pyx_L19:; } __pyx_L17:; - /* "Orange/distance/_distance.pyx":299 - * d += fabs(val2 - medians[col1]) + mads[col1] - * else: - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if normalize: - * d += fabs(val1) + 0.5 + /* "Orange/distance/_distance.pyx":328 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * if normalize: */ goto __pyx_L16; } - /* "Orange/distance/_distance.pyx":305 - * d += fabs(val1 - medians[col2]) + mads[col2] + /* "Orange/distance/_distance.pyx":341 + * d += fabs(val2 - medians[col1]) + mads[col1] * else: - * d += fabs(val1 - val2) # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = d - * return distances + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if normalize: + * d += fabs(val1) + 0.5 */ /*else*/ { - __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); + __pyx_t_27 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_27) { + + /* "Orange/distance/_distance.pyx":342 + * else: + * if npy_isnan(val2): + * if normalize: # <<<<<<<<<<<<<< + * d += fabs(val1) + 0.5 + * else: + */ + __pyx_t_27 = (__pyx_v_normalize != 0); + if (__pyx_t_27) { + + /* "Orange/distance/_distance.pyx":343 + * if npy_isnan(val2): + * if normalize: + * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< + * else: + * d += fabs(val1 - medians[col2]) + mads[col2] + */ + __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); + + /* "Orange/distance/_distance.pyx":342 + * else: + * if npy_isnan(val2): + * if normalize: # <<<<<<<<<<<<<< + * d += fabs(val1) + 0.5 + * else: + */ + goto __pyx_L21; + } + + /* "Orange/distance/_distance.pyx":345 + * d += fabs(val1) + 0.5 + * else: + * d += fabs(val1 - medians[col2]) + mads[col2] # <<<<<<<<<<<<<< + * else: + * d += fabs(val1 - val2) + */ + /*else*/ { + __pyx_t_34 = __pyx_v_col2; + __pyx_t_35 = __pyx_v_col2; + __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_mads.diminfo[0].strides)))); + } + __pyx_L21:; + + /* "Orange/distance/_distance.pyx":341 + * d += fabs(val2 - medians[col1]) + mads[col1] + * else: + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if normalize: + * d += fabs(val1) + 0.5 + */ + goto __pyx_L20; + } + + /* "Orange/distance/_distance.pyx":347 + * d += fabs(val1 - medians[col2]) + mads[col2] + * else: + * d += fabs(val1 - val2) # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = d + * return distances + */ + /*else*/ { + __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); + } + __pyx_L20:; } __pyx_L16:; } - __pyx_L12:; - } - /* "Orange/distance/_distance.pyx":306 - * else: - * d += fabs(val1 - val2) - * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":348 + * else: + * d += fabs(val1 - val2) + * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< * return distances * */ - __pyx_t_32 = __pyx_v_col1; - __pyx_t_33 = __pyx_v_col2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_32 * __pyx_v_distances.strides[0]) ) + __pyx_t_33 * __pyx_v_distances.strides[1]) )) = __pyx_v_d; - __pyx_t_34 = __pyx_v_col2; - __pyx_t_35 = __pyx_v_col1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_34 * __pyx_v_distances.strides[0]) ) + __pyx_t_35 * __pyx_v_distances.strides[1]) )) = __pyx_v_d; + __pyx_t_36 = __pyx_v_col1; + __pyx_t_37 = __pyx_v_col2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_36 * __pyx_v_distances.strides[0]) ) + __pyx_t_37 * __pyx_v_distances.strides[1]) )) = __pyx_v_d; + __pyx_t_38 = __pyx_v_col2; + __pyx_t_39 = __pyx_v_col1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_38 * __pyx_v_distances.strides[0]) ) + __pyx_t_39 * __pyx_v_distances.strides[1]) )) = __pyx_v_d; + } + } + + /* "Orange/distance/_distance.pyx":323 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * d = 0 + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } - } } + } - /* "Orange/distance/_distance.pyx":280 - * n_rows, n_cols = x.shape[0], x.shape[1] + /* "Orange/distance/_distance.pyx":320 + * step = max(n_cols // 100, 100) * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":307 - * d += fabs(val1 - val2) - * distances[col1, col2] = distances[col2, col1] = d + /* "Orange/distance/_distance.pyx":349 + * d += fabs(val1 - val2) + * distances[col1, col2] = distances[col2, col1] = d * return distances # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 349, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":269 + /* "Orange/distance/_distance.pyx":307 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< @@ -7260,11 +8962,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U /* 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_XDEC_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); + __Pyx_XDECREF(__pyx_t_13); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -7287,7 +8990,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U return __pyx_r; } -/* "Orange/distance/_distance.pyx":310 +/* "Orange/distance/_distance.pyx":352 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< @@ -7303,7 +9006,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_21p_nonzero(PyObject *__p PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("p_nonzero (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 310, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 352, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_20p_nonzero(__pyx_self, ((PyArrayObject *)__pyx_v_x)); /* function exit code */ @@ -7337,11 +9040,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 310, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 352, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":315 + /* "Orange/distance/_distance.pyx":357 * double val * * nonzeros = nonnans = 0 # <<<<<<<<<<<<<< @@ -7351,19 +9054,19 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_v_nonzeros = 0; __pyx_v_nonnans = 0; - /* "Orange/distance/_distance.pyx":316 + /* "Orange/distance/_distance.pyx":358 * * nonzeros = nonnans = 0 * for row in range(len(x)): # <<<<<<<<<<<<<< * val = x[row] * if not npy_isnan(val): */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 316, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 358, __pyx_L1_error) __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_row = __pyx_t_3; - /* "Orange/distance/_distance.pyx":317 + /* "Orange/distance/_distance.pyx":359 * nonzeros = nonnans = 0 * for row in range(len(x)): * val = x[row] # <<<<<<<<<<<<<< @@ -7373,7 +9076,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_t_4 = __pyx_v_row; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_x.diminfo[0].strides)); - /* "Orange/distance/_distance.pyx":318 + /* "Orange/distance/_distance.pyx":360 * for row in range(len(x)): * val = x[row] * if not npy_isnan(val): # <<<<<<<<<<<<<< @@ -7383,7 +9086,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_t_5 = ((!(npy_isnan(__pyx_v_val) != 0)) != 0); if (__pyx_t_5) { - /* "Orange/distance/_distance.pyx":319 + /* "Orange/distance/_distance.pyx":361 * val = x[row] * if not npy_isnan(val): * nonnans += 1 # <<<<<<<<<<<<<< @@ -7392,7 +9095,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED */ __pyx_v_nonnans = (__pyx_v_nonnans + 1); - /* "Orange/distance/_distance.pyx":320 + /* "Orange/distance/_distance.pyx":362 * if not npy_isnan(val): * nonnans += 1 * if val != 0: # <<<<<<<<<<<<<< @@ -7402,7 +9105,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_t_5 = ((__pyx_v_val != 0.0) != 0); if (__pyx_t_5) { - /* "Orange/distance/_distance.pyx":321 + /* "Orange/distance/_distance.pyx":363 * nonnans += 1 * if val != 0: * nonzeros += 1 # <<<<<<<<<<<<<< @@ -7411,7 +9114,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED */ __pyx_v_nonzeros = (__pyx_v_nonzeros + 1); - /* "Orange/distance/_distance.pyx":320 + /* "Orange/distance/_distance.pyx":362 * if not npy_isnan(val): * nonnans += 1 * if val != 0: # <<<<<<<<<<<<<< @@ -7420,7 +9123,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED */ } - /* "Orange/distance/_distance.pyx":318 + /* "Orange/distance/_distance.pyx":360 * for row in range(len(x)): * val = x[row] * if not npy_isnan(val): # <<<<<<<<<<<<<< @@ -7430,21 +9133,21 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED } } - /* "Orange/distance/_distance.pyx":322 + /* "Orange/distance/_distance.pyx":364 * if val != 0: * nonzeros += 1 * return float(nonzeros) / nonnans # <<<<<<<<<<<<<< * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyFloat_FromDouble((((double)__pyx_v_nonzeros) / ((double)__pyx_v_nonnans))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_6 = PyFloat_FromDouble((((double)__pyx_v_nonzeros) / __pyx_v_nonnans)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":310 + /* "Orange/distance/_distance.pyx":352 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< @@ -7472,24 +9175,72 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED return __pyx_r; } -/* "Orange/distance/_distance.pyx":324 +/* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< + * callback): * cdef: - * int row, n_cols, n_rows */ /* Python wrapper */ -static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_22any_nan_row[] = "any_nan_row(ndarray x)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_23any_nan_row = {"any_nan_row", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_23any_nan_row, METH_O, __pyx_doc_6Orange_8distance_9_distance_22any_nan_row}; -static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *__pyx_self, PyObject *__pyx_v_x) { +static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6Orange_8distance_9_distance_22any_nan_row[] = "any_nan_row(ndarray x, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_23any_nan_row = {"any_nan_row", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_23any_nan_row, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_22any_nan_row}; +static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_x = 0; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("any_nan_row (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 324, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_22any_nan_row(__pyx_self, ((PyArrayObject *)__pyx_v_x)); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("any_nan_row", 1, 2, 2, 1); __PYX_ERR(0, 366, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "any_nan_row") < 0)) __PYX_ERR(0, 366, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_x = ((PyArrayObject *)values[0]); + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("any_nan_row", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 366, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("Orange.distance._distance.any_nan_row", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_22any_nan_row(__pyx_self, __pyx_v_x, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -7500,11 +9251,13 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *_ return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyObject *__pyx_v_callback) { int __pyx_v_row; int __pyx_v_n_cols; int __pyx_v_n_rows; + int __pyx_v_step; PyArrayObject *__pyx_v_flags = 0; + long __pyx_v_row_start; int __pyx_v_col; __Pyx_LocalBuf_ND __pyx_pybuffernd_flags; __Pyx_Buffer __pyx_pybuffer_flags; @@ -7524,15 +9277,18 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + Py_ssize_t __pyx_t_16; + PyObject *(*__pyx_t_17)(PyObject *); + int __pyx_t_18; + int __pyx_t_19; int __pyx_t_20; Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + int __pyx_t_23; + Py_ssize_t __pyx_t_24; __Pyx_RefNannySetupContext("any_nan_row", 0); __pyx_pybuffer_flags.pybuffer.buf = NULL; __pyx_pybuffer_flags.refcount = 0; @@ -7544,56 +9300,56 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 324, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 366, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":329 + /* "Orange/distance/_distance.pyx":372 * np.ndarray[np.int8_t, ndim=1] flags * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< * flags = np.zeros(x.shape[0], dtype=np.int8) - * with nogil: + * step = max(n_cols // 100, 100) */ __pyx_t_1 = (__pyx_v_x->dimensions[0]); __pyx_t_2 = (__pyx_v_x->dimensions[1]); __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":330 + /* "Orange/distance/_distance.pyx":373 * * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) # <<<<<<<<<<<<<< - * with nogil: - * for row in range(n_rows): + * step = max(n_cols // 100, 100) + * for row_start in range(0, n_rows, step): */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 330, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __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; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 330, __pyx_L1_error) + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 373, __pyx_L1_error) __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -7610,117 +9366,247 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0; } __pyx_pybuffernd_flags.diminfo[0].strides = __pyx_pybuffernd_flags.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flags.diminfo[0].shape = __pyx_pybuffernd_flags.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 330, __pyx_L1_error) + if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 373, __pyx_L1_error) } __pyx_t_8 = 0; __pyx_v_flags = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":331 + /* "Orange/distance/_distance.pyx":374 * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) - * with nogil: # <<<<<<<<<<<<<< - * for row in range(n_rows): - * for col in range(n_cols): - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows, step): + * callback(row_start * 100 / n_rows) + */ + __pyx_t_13 = 0x64; + __pyx_t_14 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_13 > __pyx_t_14) != 0)) { + __pyx_t_15 = __pyx_t_13; + } else { + __pyx_t_15 = __pyx_t_14; + } + __pyx_v_step = __pyx_t_15; - /* "Orange/distance/_distance.pyx":332 + /* "Orange/distance/_distance.pyx":375 * flags = np.zeros(x.shape[0], dtype=np.int8) - * with nogil: - * for row in range(n_rows): # <<<<<<<<<<<<<< - * for col in range(n_cols): - * if npy_isnan(x[row, col]): - */ - __pyx_t_9 = __pyx_v_n_rows; - __pyx_t_13 = __pyx_t_9; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_row = __pyx_t_14; - - /* "Orange/distance/_distance.pyx":333 - * with nogil: - * for row in range(n_rows): - * for col in range(n_cols): # <<<<<<<<<<<<<< - * if npy_isnan(x[row, col]): - * flags[row] = 1 - */ - __pyx_t_15 = __pyx_v_n_cols; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_col = __pyx_t_17; - - /* "Orange/distance/_distance.pyx":334 - * for row in range(n_rows): - * for col in range(n_cols): - * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< - * flags[row] = 1 - * break + * step = max(n_cols // 100, 100) + * for row_start in range(0, n_rows, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): + */ + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_n_rows); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __pyx_t_7 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_16 = 0; + __pyx_t_17 = NULL; + } else { + __pyx_t_16 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_17 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 375, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_16); __Pyx_INCREF(__pyx_t_3); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 375, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_16); __Pyx_INCREF(__pyx_t_3); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 375, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_17(__pyx_t_5); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 375, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_15 = __Pyx_PyInt_As_long(__pyx_t_3); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_row_start = __pyx_t_15; + + /* "Orange/distance/_distance.pyx":376 + * step = max(n_cols // 100, 100) + * for row_start in range(0, n_rows, step): + * callback(row_start * 100 / n_rows) # <<<<<<<<<<<<<< + * for row in range(row_start, min(row_start + step, n_rows)): + * with nogil: + */ + __pyx_t_7 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_4 = __pyx_v_callback; __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "Orange/distance/_distance.pyx":377 + * for row_start in range(0, n_rows, step): + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): # <<<<<<<<<<<<<< + * with nogil: + * for col in range(n_cols): */ - __pyx_t_18 = __pyx_v_row; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides))) != 0); - if (__pyx_t_20) { + __pyx_t_9 = __pyx_v_n_rows; + __pyx_t_15 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_9 < __pyx_t_15) != 0)) { + __pyx_t_13 = __pyx_t_9; + } else { + __pyx_t_13 = __pyx_t_15; + } + __pyx_t_15 = __pyx_t_13; + __pyx_t_13 = __pyx_t_15; + for (__pyx_t_9 = __pyx_v_row_start; __pyx_t_9 < __pyx_t_13; __pyx_t_9+=1) { + __pyx_v_row = __pyx_t_9; - /* "Orange/distance/_distance.pyx":335 - * for col in range(n_cols): - * if npy_isnan(x[row, col]): - * flags[row] = 1 # <<<<<<<<<<<<<< - * break - * return flags + /* "Orange/distance/_distance.pyx":378 + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): + * with nogil: # <<<<<<<<<<<<<< + * for col in range(n_cols): + * if npy_isnan(x[row, col]): + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "Orange/distance/_distance.pyx":379 + * for row in range(row_start, min(row_start + step, n_rows)): + * with nogil: + * for col in range(n_cols): # <<<<<<<<<<<<<< + * if npy_isnan(x[row, col]): + * flags[row] = 1 + */ + __pyx_t_18 = __pyx_v_n_cols; + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { + __pyx_v_col = __pyx_t_20; + + /* "Orange/distance/_distance.pyx":380 + * with nogil: + * for col in range(n_cols): + * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< + * flags[row] = 1 + * break */ __pyx_t_21 = __pyx_v_row; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_flags.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_flags.diminfo[0].strides) = 1; + __pyx_t_22 = __pyx_v_col; + __pyx_t_23 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[1].strides))) != 0); + if (__pyx_t_23) { - /* "Orange/distance/_distance.pyx":336 - * if npy_isnan(x[row, col]): - * flags[row] = 1 - * break # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":381 + * for col in range(n_cols): + * if npy_isnan(x[row, col]): + * flags[row] = 1 # <<<<<<<<<<<<<< + * break + * return flags + */ + __pyx_t_24 = __pyx_v_row; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_flags.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_flags.diminfo[0].strides) = 1; + + /* "Orange/distance/_distance.pyx":382 + * if npy_isnan(x[row, col]): + * flags[row] = 1 + * break # <<<<<<<<<<<<<< * return flags * */ - goto __pyx_L9_break; + goto __pyx_L13_break; - /* "Orange/distance/_distance.pyx":334 - * for row in range(n_rows): - * for col in range(n_cols): - * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< - * flags[row] = 1 - * break + /* "Orange/distance/_distance.pyx":380 + * with nogil: + * for col in range(n_cols): + * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< + * flags[row] = 1 + * break */ + } } + __pyx_L13_break:; + } + + /* "Orange/distance/_distance.pyx":378 + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): + * with nogil: # <<<<<<<<<<<<<< + * for col in range(n_cols): + * if npy_isnan(x[row, col]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } - __pyx_L9_break:; - } } + } - /* "Orange/distance/_distance.pyx":331 - * n_rows, n_cols = x.shape[0], x.shape[1] + /* "Orange/distance/_distance.pyx":375 * flags = np.zeros(x.shape[0], dtype=np.int8) - * with nogil: # <<<<<<<<<<<<<< - * for row in range(n_rows): - * for col in range(n_cols): + * step = max(n_cols // 100, 100) + * for row_start in range(0, n_rows, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":337 - * flags[row] = 1 - * break + /* "Orange/distance/_distance.pyx":383 + * flags[row] = 1 + * break * return flags # <<<<<<<<<<<<<< * * @@ -7730,12 +9616,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_r = ((PyObject *)__pyx_v_flags); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":324 + /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< + * callback): * cdef: - * int row, n_cols, n_rows */ /* function exit code */ @@ -7765,7 +9651,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS return __pyx_r; } -/* "Orange/distance/_distance.pyx":340 +/* "Orange/distance/_distance.pyx":386 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< @@ -7775,8 +9661,8 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows[] = "jaccard_rows(ndarray nonzeros1, ndarray nonzeros2, ndarray x1, ndarray x2, ndarray nans1, ndarray nans2, ndarray ps, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows = {"jaccard_rows", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows}; +static char __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows[] = "jaccard_rows(ndarray nonzeros1, ndarray nonzeros2, ndarray x1, ndarray x2, ndarray nans1, ndarray nans2, ndarray ps, char two_tables, callback, next_callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows = {"jaccard_rows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_nonzeros1 = 0; PyArrayObject *__pyx_v_nonzeros2 = 0; @@ -7786,16 +9672,22 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * PyArrayObject *__pyx_v_nans2 = 0; PyArrayObject *__pyx_v_ps = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_next_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("jaccard_rows (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nonzeros1,&__pyx_n_s_nonzeros2,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_nans1,&__pyx_n_s_nans2,&__pyx_n_s_ps,&__pyx_n_s_two_tables,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nonzeros1,&__pyx_n_s_nonzeros2,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_nans1,&__pyx_n_s_nans2,&__pyx_n_s_ps,&__pyx_n_s_two_tables,&__pyx_n_s_callback,&__pyx_n_s_next_callback,0}; + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); @@ -7824,49 +9716,61 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nonzeros2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 1); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 1); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 2); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 2); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 3); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 3); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 4); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 4); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 5); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 5); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 6); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 6); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 7); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 7); __PYX_ERR(0, 386, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 8); __PYX_ERR(0, 386, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 9); __PYX_ERR(0, 386, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_rows") < 0)) __PYX_ERR(0, 340, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_rows") < 0)) __PYX_ERR(0, 386, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -7877,6 +9781,8 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + values[9] = PyTuple_GET_ITEM(__pyx_args, 9); } __pyx_v_nonzeros1 = ((PyArrayObject *)values[0]); __pyx_v_nonzeros2 = ((PyArrayObject *)values[1]); @@ -7885,24 +9791,26 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * __pyx_v_nans1 = ((PyArrayObject *)values[4]); __pyx_v_nans2 = ((PyArrayObject *)values[5]); __pyx_v_ps = ((PyArrayObject *)values[6]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[7]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 347, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[7]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 393, __pyx_L3_error) + __pyx_v_callback = values[8]; + __pyx_v_next_callback = values[9]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 386, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.jaccard_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros1), __pyx_ptype_5numpy_ndarray, 1, "nonzeros1", 0))) __PYX_ERR(0, 340, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros2), __pyx_ptype_5numpy_ndarray, 1, "nonzeros2", 0))) __PYX_ERR(0, 341, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 342, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 343, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans1), __pyx_ptype_5numpy_ndarray, 1, "nans1", 0))) __PYX_ERR(0, 344, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans2), __pyx_ptype_5numpy_ndarray, 1, "nans2", 0))) __PYX_ERR(0, 345, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 346, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(__pyx_self, __pyx_v_nonzeros1, __pyx_v_nonzeros2, __pyx_v_x1, __pyx_v_x2, __pyx_v_nans1, __pyx_v_nans2, __pyx_v_ps, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros1), __pyx_ptype_5numpy_ndarray, 1, "nonzeros1", 0))) __PYX_ERR(0, 386, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros2), __pyx_ptype_5numpy_ndarray, 1, "nonzeros2", 0))) __PYX_ERR(0, 387, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 388, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 389, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans1), __pyx_ptype_5numpy_ndarray, 1, "nans1", 0))) __PYX_ERR(0, 390, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans2), __pyx_ptype_5numpy_ndarray, 1, "nans2", 0))) __PYX_ERR(0, 391, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 392, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(__pyx_self, __pyx_v_nonzeros1, __pyx_v_nonzeros2, __pyx_v_x1, __pyx_v_x2, __pyx_v_nans1, __pyx_v_nans2, __pyx_v_ps, __pyx_v_two_tables, __pyx_v_callback, __pyx_v_next_callback); /* function exit code */ goto __pyx_L0; @@ -7913,13 +9821,14 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables, PyObject *__pyx_v_callback, PyObject *__pyx_v_next_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; __pyx_t_5numpy_float64_t __pyx_v_val1; __pyx_t_5numpy_float64_t __pyx_v_val2; __pyx_t_5numpy_float64_t __pyx_v_intersection; @@ -7927,6 +9836,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU int __pyx_v_ival1; int __pyx_v_ival2; __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_nans1; __Pyx_Buffer __pyx_pybuffer_nans1; __Pyx_LocalBuf_ND __pyx_pybuffernd_nans2; @@ -7950,27 +9860,27 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; + long __pyx_t_8; + long __pyx_t_9; + long __pyx_t_10; Py_ssize_t __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; int __pyx_t_14; - int __pyx_t_15; + Py_ssize_t __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - __pyx_t_5numpy_float64_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; - __pyx_t_5numpy_float64_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_24; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; + __pyx_t_5numpy_float64_t __pyx_t_28; Py_ssize_t __pyx_t_29; Py_ssize_t __pyx_t_30; Py_ssize_t __pyx_t_31; @@ -7992,6 +9902,10 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU Py_ssize_t __pyx_t_47; Py_ssize_t __pyx_t_48; Py_ssize_t __pyx_t_49; + Py_ssize_t __pyx_t_50; + Py_ssize_t __pyx_t_51; + Py_ssize_t __pyx_t_52; + Py_ssize_t __pyx_t_53; __Pyx_RefNannySetupContext("jaccard_rows", 0); __pyx_pybuffer_nonzeros1.pybuffer.buf = NULL; __pyx_pybuffer_nonzeros1.refcount = 0; @@ -8023,41 +9937,41 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_pybuffernd_ps.rcbuffer = &__pyx_pybuffer_ps; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_nonzeros1.diminfo[0].strides = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros1.diminfo[0].shape = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros1.diminfo[1].strides = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros1.diminfo[1].shape = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_nonzeros2.diminfo[0].strides = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros2.diminfo[0].shape = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros2.diminfo[1].strides = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros2.diminfo[1].shape = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_nans1.diminfo[0].strides = __pyx_pybuffernd_nans1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans1.diminfo[0].shape = __pyx_pybuffernd_nans1.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_nans2.diminfo[0].strides = __pyx_pybuffernd_nans2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans2.diminfo[0].shape = __pyx_pybuffernd_nans2.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_ps.diminfo[0].strides = __pyx_pybuffernd_ps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ps.diminfo[0].shape = __pyx_pybuffernd_ps.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":354 + /* "Orange/distance/_distance.pyx":402 * double [:, :] distances * * n_rows1, n_cols = x1.shape[0], x2.shape[1] # <<<<<<<<<<<<<< @@ -8069,32 +9983,32 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":355 + /* "Orange/distance/_distance.pyx":403 * * n_rows1, n_cols = x1.shape[0], x2.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":356 + /* "Orange/distance/_distance.pyx":404 * n_rows1, n_cols = x1.shape[0], x2.shape[1] * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -8102,760 +10016,941 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 356, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 404, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __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(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_distances = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "Orange/distance/_distance.pyx":357 + /* "Orange/distance/_distance.pyx":405 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * if nans1[row1]: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + */ + __pyx_t_8 = 0x64; + __pyx_t_9 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_8 > __pyx_t_9) != 0)) { + __pyx_t_10 = __pyx_t_8; + } else { + __pyx_t_10 = __pyx_t_9; + } + __pyx_v_step = __pyx_t_10; - /* "Orange/distance/_distance.pyx":358 + /* "Orange/distance/_distance.pyx":406 * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * if nans1[row1]: - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_8 = __pyx_v_n_rows1; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_row1 = __pyx_t_10; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 406, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 406, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 406, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_12(__pyx_t_5); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 406, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_row_start = __pyx_t_10; - /* "Orange/distance/_distance.pyx":359 - * with nogil: - * for row1 in range(n_rows1): - * if nans1[row1]: # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 + /* "Orange/distance/_distance.pyx":407 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - __pyx_t_11 = __pyx_v_row1; - __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans1.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_nans1.diminfo[0].strides)) != 0); - if (__pyx_t_12) { + __pyx_t_3 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_4 = __pyx_v_callback; __pyx_t_13 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_6 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_13, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "Orange/distance/_distance.pyx":360 - * for row1 in range(n_rows1): - * if nans1[row1]: - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * union = intersection = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":408 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * if nans1[row1]: + */ + __pyx_t_14 = __pyx_v_n_rows1; + __pyx_t_10 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_14 < __pyx_t_10) != 0)) { + __pyx_t_8 = __pyx_t_14; + } else { + __pyx_t_8 = __pyx_t_10; + } + __pyx_t_10 = __pyx_t_8; + __pyx_t_8 = __pyx_t_10; + for (__pyx_t_14 = __pyx_v_row_start; __pyx_t_14 < __pyx_t_8; __pyx_t_14+=1) { + __pyx_v_row1 = __pyx_t_14; + + /* "Orange/distance/_distance.pyx":409 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * if nans1[row1]: + * for row2 in range(n_rows2 if two_tables else row1): */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_13 = __pyx_v_n_rows2; - } else { - __pyx_t_13 = __pyx_v_row1; - } - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_row2 = __pyx_t_15; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "Orange/distance/_distance.pyx":410 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * if nans1[row1]: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 + */ + __pyx_t_15 = __pyx_v_row1; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_nans1.diminfo[0].strides)) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":411 + * with nogil: + * if nans1[row1]: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * union = intersection = 0 + * for col in range(n_cols): + */ + if ((__pyx_v_two_tables != 0)) { + __pyx_t_17 = __pyx_v_n_rows2; + } else { + __pyx_t_17 = __pyx_v_row1; + } + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_row2 = __pyx_t_19; + + /* "Orange/distance/_distance.pyx":412 + * if nans1[row1]: + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + */ + __pyx_v_union = 0.0; + __pyx_v_intersection = 0.0; - /* "Orange/distance/_distance.pyx":361 - * if nans1[row1]: - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + /* "Orange/distance/_distance.pyx":413 + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): */ - __pyx_v_union = 0.0; - __pyx_v_intersection = 0.0; + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":362 - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":414 + * union = intersection = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): + */ + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":415 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * intersection += ps[col] ** 2 */ - __pyx_t_16 = __pyx_v_n_cols; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_col = __pyx_t_18; + __pyx_t_16 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":363 - * union = intersection = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":416 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 */ - __pyx_t_19 = __pyx_v_row1; - __pyx_t_20 = __pyx_v_col; - __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_22 = __pyx_v_row2; - __pyx_t_23 = __pyx_v_col; - __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_21; - __pyx_v_val2 = __pyx_t_24; + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":364 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * intersection += ps[col] ** 2 + /* "Orange/distance/_distance.pyx":417 + * if npy_isnan(val1): + * if npy_isnan(val2): + * intersection += ps[col] ** 2 # <<<<<<<<<<<<<< + * union += 1 - (1 - ps[col]) ** 2 + * elif val2 != 0: */ - __pyx_t_12 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_12) { + __pyx_t_29 = __pyx_v_col; + __pyx_v_intersection = (__pyx_v_intersection + pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)), 2.0)); - /* "Orange/distance/_distance.pyx":365 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 + /* "Orange/distance/_distance.pyx":418 + * if npy_isnan(val2): + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 # <<<<<<<<<<<<<< + * elif val2 != 0: + * intersection += ps[col] */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + __pyx_t_30 = __pyx_v_col; + __pyx_v_union = (__pyx_v_union + (1.0 - pow((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ps.diminfo[0].strides))), 2.0))); - /* "Orange/distance/_distance.pyx":366 - * if npy_isnan(val1): - * if npy_isnan(val2): - * intersection += ps[col] ** 2 # <<<<<<<<<<<<<< - * union += 1 - (1 - ps[col]) ** 2 - * elif val2 != 0: + /* "Orange/distance/_distance.pyx":416 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 */ - __pyx_t_25 = __pyx_v_col; - __pyx_v_intersection = (__pyx_v_intersection + pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_ps.diminfo[0].strides)), 2.0)); + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":367 - * if npy_isnan(val2): - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 # <<<<<<<<<<<<<< - * elif val2 != 0: - * intersection += ps[col] + /* "Orange/distance/_distance.pyx":419 + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 + * elif val2 != 0: # <<<<<<<<<<<<<< + * intersection += ps[col] + * union += 1 */ - __pyx_t_26 = __pyx_v_col; - __pyx_v_union = (__pyx_v_union + (1.0 - pow((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ps.diminfo[0].strides))), 2.0))); + __pyx_t_16 = ((__pyx_v_val2 != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":365 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 + /* "Orange/distance/_distance.pyx":420 + * union += 1 - (1 - ps[col]) ** 2 + * elif val2 != 0: + * intersection += ps[col] # <<<<<<<<<<<<<< + * union += 1 + * else: */ - goto __pyx_L14; - } + __pyx_t_31 = __pyx_v_col; + __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":368 - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 - * elif val2 != 0: # <<<<<<<<<<<<<< - * intersection += ps[col] - * union += 1 - */ - __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":369 - * union += 1 - (1 - ps[col]) ** 2 - * elif val2 != 0: - * intersection += ps[col] # <<<<<<<<<<<<<< - * union += 1 - * else: + /* "Orange/distance/_distance.pyx":421 + * elif val2 != 0: + * intersection += ps[col] + * union += 1 # <<<<<<<<<<<<<< + * else: + * union += ps[col] */ - __pyx_t_27 = __pyx_v_col; - __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_ps.diminfo[0].strides))); + __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":370 - * elif val2 != 0: - * intersection += ps[col] - * union += 1 # <<<<<<<<<<<<<< - * else: - * union += ps[col] + /* "Orange/distance/_distance.pyx":419 + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 + * elif val2 != 0: # <<<<<<<<<<<<<< + * intersection += ps[col] + * union += 1 */ - __pyx_v_union = (__pyx_v_union + 1.0); + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":368 - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 - * elif val2 != 0: # <<<<<<<<<<<<<< - * intersection += ps[col] - * union += 1 + /* "Orange/distance/_distance.pyx":423 + * union += 1 + * else: + * union += ps[col] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * if val1 != 0: */ - goto __pyx_L14; - } + /*else*/ { + __pyx_t_32 = __pyx_v_col; + __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_ps.diminfo[0].strides))); + } + __pyx_L18:; - /* "Orange/distance/_distance.pyx":372 - * union += 1 - * else: - * union += ps[col] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * if val1 != 0: + /* "Orange/distance/_distance.pyx":415 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * intersection += ps[col] ** 2 */ - /*else*/ { - __pyx_t_28 = __pyx_v_col; - __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_ps.diminfo[0].strides))); + goto __pyx_L17; } - __pyx_L14:; - /* "Orange/distance/_distance.pyx":364 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * intersection += ps[col] ** 2 + /* "Orange/distance/_distance.pyx":424 + * else: + * union += ps[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * if val1 != 0: + * intersection += val1 * ps[col] */ - goto __pyx_L13; - } + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":373 - * else: - * union += ps[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * if val1 != 0: - * intersection += val1 * ps[col] + /* "Orange/distance/_distance.pyx":425 + * union += ps[col] + * elif npy_isnan(val2): + * if val1 != 0: # <<<<<<<<<<<<<< + * intersection += val1 * ps[col] + * union += 1 */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + __pyx_t_16 = ((__pyx_v_val1 != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":374 - * union += ps[col] - * elif npy_isnan(val2): - * if val1 != 0: # <<<<<<<<<<<<<< - * intersection += val1 * ps[col] - * union += 1 + /* "Orange/distance/_distance.pyx":426 + * elif npy_isnan(val2): + * if val1 != 0: + * intersection += val1 * ps[col] # <<<<<<<<<<<<<< + * union += 1 + * else: */ - __pyx_t_12 = ((__pyx_v_val1 != 0.0) != 0); - if (__pyx_t_12) { + __pyx_t_33 = __pyx_v_col; + __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_val1 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_ps.diminfo[0].strides)))); - /* "Orange/distance/_distance.pyx":375 - * elif npy_isnan(val2): - * if val1 != 0: - * intersection += val1 * ps[col] # <<<<<<<<<<<<<< - * union += 1 - * else: + /* "Orange/distance/_distance.pyx":427 + * if val1 != 0: + * intersection += val1 * ps[col] + * union += 1 # <<<<<<<<<<<<<< + * else: + * union += ps[col] + */ + __pyx_v_union = (__pyx_v_union + 1.0); + + /* "Orange/distance/_distance.pyx":425 + * union += ps[col] + * elif npy_isnan(val2): + * if val1 != 0: # <<<<<<<<<<<<<< + * intersection += val1 * ps[col] + * union += 1 */ - __pyx_t_29 = __pyx_v_col; - __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_val1 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)))); + goto __pyx_L19; + } - /* "Orange/distance/_distance.pyx":376 - * if val1 != 0: - * intersection += val1 * ps[col] - * union += 1 # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":429 + * union += 1 + * else: + * union += ps[col] # <<<<<<<<<<<<<< * else: - * union += ps[col] + * ival1 = nonzeros1[row1, col] */ - __pyx_v_union = (__pyx_v_union + 1.0); + /*else*/ { + __pyx_t_34 = __pyx_v_col; + __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_ps.diminfo[0].strides))); + } + __pyx_L19:; - /* "Orange/distance/_distance.pyx":374 - * union += ps[col] - * elif npy_isnan(val2): - * if val1 != 0: # <<<<<<<<<<<<<< - * intersection += val1 * ps[col] - * union += 1 + /* "Orange/distance/_distance.pyx":424 + * else: + * union += ps[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * if val1 != 0: + * intersection += val1 * ps[col] */ - goto __pyx_L15; + goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":378 - * union += 1 + /* "Orange/distance/_distance.pyx":431 + * union += ps[col] * else: - * union += ps[col] # <<<<<<<<<<<<<< - * else: - * ival1 = nonzeros1[row1, col] + * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 */ /*else*/ { - __pyx_t_30 = __pyx_v_col; - __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ps.diminfo[0].strides))); - } - __pyx_L15:; + __pyx_t_35 = __pyx_v_row1; + __pyx_t_36 = __pyx_v_col; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":373 + /* "Orange/distance/_distance.pyx":432 * else: - * union += ps[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * if val1 != 0: - * intersection += val1 * ps[col] - */ - goto __pyx_L13; + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< + * union += ival1 | ival2 + * intersection += ival1 & ival2 + */ + __pyx_t_37 = __pyx_v_row2; + __pyx_t_38 = __pyx_v_col; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":433 + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 # <<<<<<<<<<<<<< + * intersection += ival1 & ival2 + * if union != 0: + */ + __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); + + /* "Orange/distance/_distance.pyx":434 + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 + * intersection += ival1 & ival2 # <<<<<<<<<<<<<< + * if union != 0: + * distances[row1, row2] = 1 - intersection / union + */ + __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_ival1 & __pyx_v_ival2)); + } + __pyx_L17:; } - /* "Orange/distance/_distance.pyx":380 - * union += ps[col] - * else: - * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 + /* "Orange/distance/_distance.pyx":435 + * union += ival1 | ival2 + * intersection += ival1 & ival2 + * if union != 0: # <<<<<<<<<<<<<< + * distances[row1, row2] = 1 - intersection / union + * else: */ - /*else*/ { - __pyx_t_31 = __pyx_v_row1; - __pyx_t_32 = __pyx_v_col; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":381 - * else: - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< - * union += ival1 | ival2 - * intersection += ival1 & ival2 - */ - __pyx_t_33 = __pyx_v_row2; - __pyx_t_34 = __pyx_v_col; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":382 - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 # <<<<<<<<<<<<<< - * intersection += ival1 & ival2 - * if union != 0: - */ - __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); - - /* "Orange/distance/_distance.pyx":383 - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 - * intersection += ival1 & ival2 # <<<<<<<<<<<<<< - * if union != 0: - * distances[row1, row2] = 1 - intersection / union - */ - __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_ival1 & __pyx_v_ival2)); - } - __pyx_L13:; - } + __pyx_t_16 = ((__pyx_v_union != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":384 - * union += ival1 | ival2 - * intersection += ival1 & ival2 - * if union != 0: # <<<<<<<<<<<<<< - * distances[row1, row2] = 1 - intersection / union - * else: + /* "Orange/distance/_distance.pyx":436 + * intersection += ival1 & ival2 + * if union != 0: + * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< + * else: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); - if (__pyx_t_12) { + __pyx_t_39 = __pyx_v_row1; + __pyx_t_40 = __pyx_v_row2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_39 * __pyx_v_distances.strides[0]) ) + __pyx_t_40 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":385 - * intersection += ival1 & ival2 - * if union != 0: - * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< - * else: - * for row2 in range(n_rows2 if two_tables else row1): + /* "Orange/distance/_distance.pyx":435 + * union += ival1 | ival2 + * intersection += ival1 & ival2 + * if union != 0: # <<<<<<<<<<<<<< + * distances[row1, row2] = 1 - intersection / union + * else: */ - __pyx_t_35 = __pyx_v_row1; - __pyx_t_36 = __pyx_v_row2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_35 * __pyx_v_distances.strides[0]) ) + __pyx_t_36 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); + } + } - /* "Orange/distance/_distance.pyx":384 - * union += ival1 | ival2 - * intersection += ival1 & ival2 - * if union != 0: # <<<<<<<<<<<<<< - * distances[row1, row2] = 1 - intersection / union - * else: + /* "Orange/distance/_distance.pyx":410 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * if nans1[row1]: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 */ - } + goto __pyx_L12; } - /* "Orange/distance/_distance.pyx":359 - * with nogil: - * for row1 in range(n_rows1): - * if nans1[row1]: # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 - */ - goto __pyx_L8; - } + /* "Orange/distance/_distance.pyx":438 + * distances[row1, row2] = 1 - intersection / union + * else: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * union = intersection = 0 + * # This case is slightly different since val1 can't be nan + */ + /*else*/ { + if ((__pyx_v_two_tables != 0)) { + __pyx_t_17 = __pyx_v_n_rows2; + } else { + __pyx_t_17 = __pyx_v_row1; + } + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_row2 = __pyx_t_19; - /* "Orange/distance/_distance.pyx":387 - * distances[row1, row2] = 1 - intersection / union - * else: - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * union = intersection = 0 - * # This case is slightly different since val1 can't be nan - */ - /*else*/ { - if ((__pyx_v_two_tables != 0)) { - __pyx_t_13 = __pyx_v_n_rows2; - } else { - __pyx_t_13 = __pyx_v_row1; - } - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_row2 = __pyx_t_15; + /* "Orange/distance/_distance.pyx":439 + * else: + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 # <<<<<<<<<<<<<< + * # This case is slightly different since val1 can't be nan + * if nans2[row2]: + */ + __pyx_v_union = 0.0; + __pyx_v_intersection = 0.0; + + /* "Orange/distance/_distance.pyx":441 + * union = intersection = 0 + * # This case is slightly different since val1 can't be nan + * if nans2[row2]: # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val2 = x2[row2, col] + */ + __pyx_t_41 = __pyx_v_row2; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans2.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_nans2.diminfo[0].strides)) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":442 + * # This case is slightly different since val1 can't be nan + * if nans2[row2]: + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val2 = x2[row2, col] + * if nonzeros1[row1, col] != 0: + */ + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; + + /* "Orange/distance/_distance.pyx":443 + * if nans2[row2]: + * for col in range(n_cols): + * val2 = x2[row2, col] # <<<<<<<<<<<<<< + * if nonzeros1[row1, col] != 0: + * union += 1 + */ + __pyx_t_42 = __pyx_v_row2; + __pyx_t_43 = __pyx_v_col; + __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_x2.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":444 + * for col in range(n_cols): + * val2 = x2[row2, col] + * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< + * union += 1 + * if npy_isnan(val2): + */ + __pyx_t_44 = __pyx_v_row1; + __pyx_t_45 = __pyx_v_col; + __pyx_t_16 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)) != 0) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":445 + * val2 = x2[row2, col] + * if nonzeros1[row1, col] != 0: + * union += 1 # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * intersection += ps[col] + */ + __pyx_v_union = (__pyx_v_union + 1.0); + + /* "Orange/distance/_distance.pyx":446 + * if nonzeros1[row1, col] != 0: + * union += 1 + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * intersection += ps[col] + * elif val2 != 0: + */ + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":447 + * union += 1 + * if npy_isnan(val2): + * intersection += ps[col] # <<<<<<<<<<<<<< + * elif val2 != 0: + * intersection += 1 + */ + __pyx_t_46 = __pyx_v_col; + __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_ps.diminfo[0].strides))); + + /* "Orange/distance/_distance.pyx":446 + * if nonzeros1[row1, col] != 0: + * union += 1 + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * intersection += ps[col] + * elif val2 != 0: + */ + goto __pyx_L27; + } + + /* "Orange/distance/_distance.pyx":448 + * if npy_isnan(val2): + * intersection += ps[col] + * elif val2 != 0: # <<<<<<<<<<<<<< + * intersection += 1 + * elif npy_isnan(val2): + */ + __pyx_t_16 = ((__pyx_v_val2 != 0.0) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":449 + * intersection += ps[col] + * elif val2 != 0: + * intersection += 1 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * union += ps[col] + */ + __pyx_v_intersection = (__pyx_v_intersection + 1.0); + + /* "Orange/distance/_distance.pyx":448 + * if npy_isnan(val2): + * intersection += ps[col] + * elif val2 != 0: # <<<<<<<<<<<<<< + * intersection += 1 + * elif npy_isnan(val2): + */ + } + __pyx_L27:; + + /* "Orange/distance/_distance.pyx":444 + * for col in range(n_cols): + * val2 = x2[row2, col] + * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< + * union += 1 + * if npy_isnan(val2): + */ + goto __pyx_L26; + } - /* "Orange/distance/_distance.pyx":388 - * else: - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 # <<<<<<<<<<<<<< - * # This case is slightly different since val1 can't be nan - * if nans2[row2]: + /* "Orange/distance/_distance.pyx":450 + * elif val2 != 0: + * intersection += 1 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * union += ps[col] + * elif val2 != 0: */ - __pyx_v_union = 0.0; - __pyx_v_intersection = 0.0; + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":390 - * union = intersection = 0 - * # This case is slightly different since val1 can't be nan - * if nans2[row2]: # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val2 = x2[row2, col] + /* "Orange/distance/_distance.pyx":451 + * intersection += 1 + * elif npy_isnan(val2): + * union += ps[col] # <<<<<<<<<<<<<< + * elif val2 != 0: + * union += 1 */ - __pyx_t_37 = __pyx_v_row2; - __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans2.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_nans2.diminfo[0].strides)) != 0); - if (__pyx_t_12) { + __pyx_t_47 = __pyx_v_col; + __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":391 - * # This case is slightly different since val1 can't be nan - * if nans2[row2]: - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val2 = x2[row2, col] - * if nonzeros1[row1, col] != 0: + /* "Orange/distance/_distance.pyx":450 + * elif val2 != 0: + * intersection += 1 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * union += ps[col] + * elif val2 != 0: */ - __pyx_t_16 = __pyx_v_n_cols; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_col = __pyx_t_18; + goto __pyx_L26; + } - /* "Orange/distance/_distance.pyx":392 - * if nans2[row2]: - * for col in range(n_cols): - * val2 = x2[row2, col] # <<<<<<<<<<<<<< - * if nonzeros1[row1, col] != 0: - * union += 1 + /* "Orange/distance/_distance.pyx":452 + * elif npy_isnan(val2): + * union += ps[col] + * elif val2 != 0: # <<<<<<<<<<<<<< + * union += 1 + * else: */ - __pyx_t_38 = __pyx_v_row2; - __pyx_t_39 = __pyx_v_col; - __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_t_16 = ((__pyx_v_val2 != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":393 - * for col in range(n_cols): - * val2 = x2[row2, col] - * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< - * union += 1 - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":453 + * union += ps[col] + * elif val2 != 0: + * union += 1 # <<<<<<<<<<<<<< + * else: + * for col in range(n_cols): */ - __pyx_t_40 = __pyx_v_row1; - __pyx_t_41 = __pyx_v_col; - __pyx_t_12 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)) != 0) != 0); - if (__pyx_t_12) { + __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":394 - * val2 = x2[row2, col] - * if nonzeros1[row1, col] != 0: - * union += 1 # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * intersection += ps[col] + /* "Orange/distance/_distance.pyx":452 + * elif npy_isnan(val2): + * union += ps[col] + * elif val2 != 0: # <<<<<<<<<<<<<< + * union += 1 + * else: */ - __pyx_v_union = (__pyx_v_union + 1.0); + } + __pyx_L26:; + } - /* "Orange/distance/_distance.pyx":395 - * if nonzeros1[row1, col] != 0: - * union += 1 - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * intersection += ps[col] - * elif val2 != 0: + /* "Orange/distance/_distance.pyx":441 + * union = intersection = 0 + * # This case is slightly different since val1 can't be nan + * if nans2[row2]: # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val2 = x2[row2, col] */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + goto __pyx_L23; + } - /* "Orange/distance/_distance.pyx":396 - * union += 1 - * if npy_isnan(val2): - * intersection += ps[col] # <<<<<<<<<<<<<< - * elif val2 != 0: - * intersection += 1 - */ - __pyx_t_42 = __pyx_v_col; - __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_ps.diminfo[0].strides))); - - /* "Orange/distance/_distance.pyx":395 - * if nonzeros1[row1, col] != 0: - * union += 1 - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * intersection += ps[col] - * elif val2 != 0: - */ - goto __pyx_L23; - } - - /* "Orange/distance/_distance.pyx":397 - * if npy_isnan(val2): - * intersection += ps[col] - * elif val2 != 0: # <<<<<<<<<<<<<< - * intersection += 1 - * elif npy_isnan(val2): - */ - __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":398 - * intersection += ps[col] - * elif val2 != 0: - * intersection += 1 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * union += ps[col] - */ - __pyx_v_intersection = (__pyx_v_intersection + 1.0); - - /* "Orange/distance/_distance.pyx":397 - * if npy_isnan(val2): - * intersection += ps[col] - * elif val2 != 0: # <<<<<<<<<<<<<< - * intersection += 1 - * elif npy_isnan(val2): - */ - } - __pyx_L23:; - - /* "Orange/distance/_distance.pyx":393 - * for col in range(n_cols): - * val2 = x2[row2, col] - * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< - * union += 1 - * if npy_isnan(val2): - */ - goto __pyx_L22; - } - - /* "Orange/distance/_distance.pyx":399 - * elif val2 != 0: - * intersection += 1 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * union += ps[col] - * elif val2 != 0: - */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":400 - * intersection += 1 - * elif npy_isnan(val2): - * union += ps[col] # <<<<<<<<<<<<<< - * elif val2 != 0: - * union += 1 - */ - __pyx_t_43 = __pyx_v_col; - __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_ps.diminfo[0].strides))); - - /* "Orange/distance/_distance.pyx":399 - * elif val2 != 0: - * intersection += 1 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * union += ps[col] - * elif val2 != 0: - */ - goto __pyx_L22; - } - - /* "Orange/distance/_distance.pyx":401 - * elif npy_isnan(val2): - * union += ps[col] - * elif val2 != 0: # <<<<<<<<<<<<<< - * union += 1 - * else: - */ - __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":402 - * union += ps[col] - * elif val2 != 0: - * union += 1 # <<<<<<<<<<<<<< - * else: - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":455 + * union += 1 + * else: + * for col in range(n_cols): # <<<<<<<<<<<<<< + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] */ - __pyx_v_union = (__pyx_v_union + 1.0); + /*else*/ { + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":401 - * elif npy_isnan(val2): - * union += ps[col] - * elif val2 != 0: # <<<<<<<<<<<<<< - * union += 1 - * else: - */ + /* "Orange/distance/_distance.pyx":456 + * else: + * for col in range(n_cols): + * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 + */ + __pyx_t_48 = __pyx_v_row1; + __pyx_t_49 = __pyx_v_col; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":457 + * for col in range(n_cols): + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< + * union += ival1 | ival2 + * intersection += ival1 & ival2 + */ + __pyx_t_50 = __pyx_v_row2; + __pyx_t_51 = __pyx_v_col; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":458 + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 # <<<<<<<<<<<<<< + * intersection += ival1 & ival2 + * if union != 0: + */ + __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); + + /* "Orange/distance/_distance.pyx":459 + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 + * intersection += ival1 & ival2 # <<<<<<<<<<<<<< + * if union != 0: + * distances[row1, row2] = 1 - intersection / union + */ + __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_ival1 & __pyx_v_ival2)); } - __pyx_L22:; - } - - /* "Orange/distance/_distance.pyx":390 - * union = intersection = 0 - * # This case is slightly different since val1 can't be nan - * if nans2[row2]: # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val2 = x2[row2, col] - */ - goto __pyx_L19; - } - - /* "Orange/distance/_distance.pyx":404 - * union += 1 - * else: - * for col in range(n_cols): # <<<<<<<<<<<<<< - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] - */ - /*else*/ { - __pyx_t_16 = __pyx_v_n_cols; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_col = __pyx_t_18; - - /* "Orange/distance/_distance.pyx":405 - * else: - * for col in range(n_cols): - * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 - */ - __pyx_t_44 = __pyx_v_row1; - __pyx_t_45 = __pyx_v_col; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":406 - * for col in range(n_cols): - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< - * union += ival1 | ival2 - * intersection += ival1 & ival2 - */ - __pyx_t_46 = __pyx_v_row2; - __pyx_t_47 = __pyx_v_col; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":407 - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 # <<<<<<<<<<<<<< - * intersection += ival1 & ival2 - * if union != 0: - */ - __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); - - /* "Orange/distance/_distance.pyx":408 - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 - * intersection += ival1 & ival2 # <<<<<<<<<<<<<< - * if union != 0: - * distances[row1, row2] = 1 - intersection / union - */ - __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_ival1 & __pyx_v_ival2)); } - } - __pyx_L19:; + __pyx_L23:; - /* "Orange/distance/_distance.pyx":409 - * union += ival1 | ival2 - * intersection += ival1 & ival2 - * if union != 0: # <<<<<<<<<<<<<< - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":460 + * union += ival1 | ival2 + * intersection += ival1 & ival2 + * if union != 0: # <<<<<<<<<<<<<< + * distances[row1, row2] = 1 - intersection / union * if not two_tables: */ - __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); - if (__pyx_t_12) { + __pyx_t_16 = ((__pyx_v_union != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":410 - * intersection += ival1 & ival2 - * if union != 0: - * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":461 + * intersection += ival1 & ival2 + * if union != 0: + * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< * if not two_tables: - * lower_to_symmetric(distances) + * lower_to_symmetric(distances, next_callback) */ - __pyx_t_48 = __pyx_v_row1; - __pyx_t_49 = __pyx_v_row2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_48 * __pyx_v_distances.strides[0]) ) + __pyx_t_49 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); + __pyx_t_52 = __pyx_v_row1; + __pyx_t_53 = __pyx_v_row2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_52 * __pyx_v_distances.strides[0]) ) + __pyx_t_53 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":409 - * union += ival1 | ival2 - * intersection += ival1 & ival2 - * if union != 0: # <<<<<<<<<<<<<< - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":460 + * union += ival1 | ival2 + * intersection += ival1 & ival2 + * if union != 0: # <<<<<<<<<<<<<< + * distances[row1, row2] = 1 - intersection / union * if not two_tables: */ + } } } + __pyx_L12:; + } + + /* "Orange/distance/_distance.pyx":409 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * if nans1[row1]: + * for row2 in range(n_rows2 if two_tables else row1): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } - __pyx_L8:; - } } + } - /* "Orange/distance/_distance.pyx":357 - * n_rows2 = x2.shape[0] + /* "Orange/distance/_distance.pyx":406 * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * if nans1[row1]: + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":411 - * if union != 0: - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":462 + * if union != 0: + * distances[row1, row2] = 1 - intersection / union * if not two_tables: # <<<<<<<<<<<<<< - * lower_to_symmetric(distances) + * lower_to_symmetric(distances, next_callback) * return distances */ - __pyx_t_12 = ((!(__pyx_v_two_tables != 0)) != 0); - if (__pyx_t_12) { + __pyx_t_16 = ((!(__pyx_v_two_tables != 0)) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":412 - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":463 + * distances[row1, row2] = 1 - intersection / union * if not two_tables: - * lower_to_symmetric(distances) # <<<<<<<<<<<<<< + * lower_to_symmetric(distances, next_callback) # <<<<<<<<<<<<<< * return distances * */ - __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_v_distances, 0); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_lower_to_symmetric); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = NULL; + __pyx_t_14 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_14 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_v_next_callback}; + __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_v_next_callback}; + __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_13 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_3); __pyx_t_3 = NULL; + } + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_14, __pyx_t_4); + __Pyx_INCREF(__pyx_v_next_callback); + __Pyx_GIVEREF(__pyx_v_next_callback); + PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_14, __pyx_v_next_callback); + __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":411 - * if union != 0: - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":462 + * if union != 0: + * distances[row1, row2] = 1 - intersection / union * if not two_tables: # <<<<<<<<<<<<<< - * lower_to_symmetric(distances) + * lower_to_symmetric(distances, next_callback) * return distances */ } - /* "Orange/distance/_distance.pyx":413 + /* "Orange/distance/_distance.pyx":464 * if not two_tables: - * lower_to_symmetric(distances) + * lower_to_symmetric(distances, next_callback) * return distances # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":340 + /* "Orange/distance/_distance.pyx":386 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< @@ -8870,6 +10965,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_13); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -8900,7 +10996,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU return __pyx_r; } -/* "Orange/distance/_distance.pyx":416 +/* "Orange/distance/_distance.pyx":467 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< @@ -8910,23 +11006,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols[] = "jaccard_cols(ndarray nonzeros, ndarray x, ndarray nans, ndarray ps)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols = {"jaccard_cols", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols}; +static char __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols[] = "jaccard_cols(ndarray nonzeros, ndarray x, ndarray nans, ndarray ps, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols = {"jaccard_cols", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_nonzeros = 0; PyArrayObject *__pyx_v_x = 0; PyArrayObject *__pyx_v_nans = 0; PyArrayObject *__pyx_v_ps = 0; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("jaccard_cols (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nonzeros,&__pyx_n_s_x,&__pyx_n_s_nans,&__pyx_n_s_ps,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nonzeros,&__pyx_n_s_x,&__pyx_n_s_nans,&__pyx_n_s_ps,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -8947,50 +11046,58 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 1); __PYX_ERR(0, 416, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, 1); __PYX_ERR(0, 467, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 2); __PYX_ERR(0, 416, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, 2); __PYX_ERR(0, 467, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 3); __PYX_ERR(0, 416, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, 3); __PYX_ERR(0, 467, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, 4); __PYX_ERR(0, 467, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_cols") < 0)) __PYX_ERR(0, 416, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_cols") < 0)) __PYX_ERR(0, 467, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_nonzeros = ((PyArrayObject *)values[0]); __pyx_v_x = ((PyArrayObject *)values[1]); __pyx_v_nans = ((PyArrayObject *)values[2]); __pyx_v_ps = ((PyArrayObject *)values[3]); + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 416, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 467, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.jaccard_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros), __pyx_ptype_5numpy_ndarray, 1, "nonzeros", 0))) __PYX_ERR(0, 416, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 417, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans), __pyx_ptype_5numpy_ndarray, 1, "nans", 0))) __PYX_ERR(0, 418, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 419, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(__pyx_self, __pyx_v_nonzeros, __pyx_v_x, __pyx_v_nans, __pyx_v_ps); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros), __pyx_ptype_5numpy_ndarray, 1, "nonzeros", 0))) __PYX_ERR(0, 467, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 468, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans), __pyx_ptype_5numpy_ndarray, 1, "nans", 0))) __PYX_ERR(0, 469, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(__pyx_self, __pyx_v_nonzeros, __pyx_v_x, __pyx_v_nans, __pyx_v_ps, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -9001,12 +11108,13 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject * return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_nans, PyArrayObject *__pyx_v_ps) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_nans, PyArrayObject *__pyx_v_ps, PyObject *__pyx_v_callback) { int __pyx_v_n_rows; int __pyx_v_n_cols; int __pyx_v_col1; int __pyx_v_col2; int __pyx_v_row; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_intersection; @@ -9021,6 +11129,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU int __pyx_v_unk1_not2; int __pyx_v_not1_unk2; __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_col_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_nans; __Pyx_Buffer __pyx_pybuffer_nans; __Pyx_LocalBuf_ND __pyx_pybuffernd_nonzeros; @@ -9038,27 +11147,27 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; + long __pyx_t_8; + long __pyx_t_9; + long __pyx_t_10; Py_ssize_t __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; int __pyx_t_14; - int __pyx_t_15; + Py_ssize_t __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - __pyx_t_5numpy_float64_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; - __pyx_t_5numpy_float64_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_24; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; + __pyx_t_5numpy_float64_t __pyx_t_28; Py_ssize_t __pyx_t_29; Py_ssize_t __pyx_t_30; Py_ssize_t __pyx_t_31; @@ -9067,11 +11176,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU Py_ssize_t __pyx_t_34; Py_ssize_t __pyx_t_35; Py_ssize_t __pyx_t_36; - double __pyx_t_37; + Py_ssize_t __pyx_t_37; Py_ssize_t __pyx_t_38; Py_ssize_t __pyx_t_39; Py_ssize_t __pyx_t_40; - Py_ssize_t __pyx_t_41; + double __pyx_t_41; Py_ssize_t __pyx_t_42; Py_ssize_t __pyx_t_43; Py_ssize_t __pyx_t_44; @@ -9099,6 +11208,10 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU Py_ssize_t __pyx_t_66; Py_ssize_t __pyx_t_67; Py_ssize_t __pyx_t_68; + Py_ssize_t __pyx_t_69; + Py_ssize_t __pyx_t_70; + Py_ssize_t __pyx_t_71; + Py_ssize_t __pyx_t_72; __Pyx_RefNannySetupContext("jaccard_cols", 0); __pyx_pybuffer_nonzeros.pybuffer.buf = NULL; __pyx_pybuffer_nonzeros.refcount = 0; @@ -9118,54 +11231,54 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_pybuffernd_ps.rcbuffer = &__pyx_pybuffer_ps; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 416, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 467, __pyx_L1_error) } __pyx_pybuffernd_nonzeros.diminfo[0].strides = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros.diminfo[0].shape = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros.diminfo[1].strides = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros.diminfo[1].shape = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 416, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 467, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 416, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 467, __pyx_L1_error) } __pyx_pybuffernd_nans.diminfo[0].strides = __pyx_pybuffernd_nans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans.diminfo[0].shape = __pyx_pybuffernd_nans.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 416, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 467, __pyx_L1_error) } __pyx_pybuffernd_ps.diminfo[0].strides = __pyx_pybuffernd_ps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ps.diminfo[0].shape = __pyx_pybuffernd_ps.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":427 + /* "Orange/distance/_distance.pyx":479 * double [:, :] distances * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: + * step = max(n_cols // 100, 100) */ __pyx_t_1 = (__pyx_v_x->dimensions[0]); __pyx_t_2 = (__pyx_v_x->dimensions[1]); __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":428 + /* "Orange/distance/_distance.pyx":480 * * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) # <<<<<<<<<<<<<< - * with nogil: - * for col1 in range(n_cols): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -9173,849 +11286,979 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 428, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 480, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __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(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_distances = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "Orange/distance/_distance.pyx":429 + /* "Orange/distance/_distance.pyx":481 * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * if nans[col1]: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + */ + __pyx_t_8 = 0x64; + __pyx_t_9 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_8 > __pyx_t_9) != 0)) { + __pyx_t_10 = __pyx_t_8; + } else { + __pyx_t_10 = __pyx_t_9; + } + __pyx_v_step = __pyx_t_10; - /* "Orange/distance/_distance.pyx":430 + /* "Orange/distance/_distance.pyx":482 * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: - * for col1 in range(n_cols): # <<<<<<<<<<<<<< - * if nans[col1]: - * for col2 in range(col1): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - __pyx_t_8 = __pyx_v_n_cols; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_col1 = __pyx_t_10; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 482, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_12(__pyx_t_5); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 482, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_col_start = __pyx_t_10; - /* "Orange/distance/_distance.pyx":431 - * with nogil: - * for col1 in range(n_cols): - * if nans[col1]: # <<<<<<<<<<<<<< - * for col2 in range(col1): - * in_both = in_any = 0 + /* "Orange/distance/_distance.pyx":483 + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: */ - __pyx_t_11 = __pyx_v_col1; - __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); - if (__pyx_t_12) { + __pyx_t_3 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_4 = __pyx_v_callback; __pyx_t_13 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_6 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_13, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "Orange/distance/_distance.pyx":432 - * for col1 in range(n_cols): - * if nans[col1]: - * for col2 in range(col1): # <<<<<<<<<<<<<< - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + /* "Orange/distance/_distance.pyx":484 + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< + * with nogil: + * if nans[col1]: + */ + __pyx_t_14 = __pyx_v_n_cols; + __pyx_t_10 = (__pyx_v_col_start + __pyx_v_step); + if (((__pyx_t_14 < __pyx_t_10) != 0)) { + __pyx_t_8 = __pyx_t_14; + } else { + __pyx_t_8 = __pyx_t_10; + } + __pyx_t_10 = __pyx_t_8; + __pyx_t_8 = __pyx_t_10; + for (__pyx_t_14 = __pyx_v_col_start; __pyx_t_14 < __pyx_t_8; __pyx_t_14+=1) { + __pyx_v_col1 = __pyx_t_14; + + /* "Orange/distance/_distance.pyx":485 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * if nans[col1]: + * for col2 in range(col1): */ - __pyx_t_13 = __pyx_v_col1; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_col2 = __pyx_t_15; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":433 - * if nans[col1]: - * for col2 in range(col1): - * in_both = in_any = 0 # <<<<<<<<<<<<<< - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - * for row in range(n_rows): + /* "Orange/distance/_distance.pyx":486 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * if nans[col1]: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * in_both = in_any = 0 */ - __pyx_v_in_both = 0; - __pyx_v_in_any = 0; + __pyx_t_15 = __pyx_v_col1; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":434 - * for col2 in range(col1): - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] + /* "Orange/distance/_distance.pyx":487 + * with nogil: + * if nans[col1]: + * for col2 in range(col1): # <<<<<<<<<<<<<< + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 */ - __pyx_v_in1_unk2 = 0; - __pyx_v_unk1_in2 = 0; - __pyx_v_unk1_unk2 = 0; - __pyx_v_unk1_not2 = 0; - __pyx_v_not1_unk2 = 0; + __pyx_t_17 = __pyx_v_col1; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_col2 = __pyx_t_19; - /* "Orange/distance/_distance.pyx":435 - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":488 + * if nans[col1]: + * for col2 in range(col1): + * in_both = in_any = 0 # <<<<<<<<<<<<<< + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * for row in range(n_rows): */ - __pyx_t_16 = __pyx_v_n_rows; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_row = __pyx_t_18; + __pyx_v_in_both = 0; + __pyx_v_in_any = 0; - /* "Orange/distance/_distance.pyx":436 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":489 + * for col2 in range(col1): + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] */ - __pyx_t_19 = __pyx_v_row; - __pyx_t_20 = __pyx_v_col1; - __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_t_22 = __pyx_v_row; - __pyx_t_23 = __pyx_v_col2; - __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_21; - __pyx_v_val2 = __pyx_t_24; + __pyx_v_in1_unk2 = 0; + __pyx_v_unk1_in2 = 0; + __pyx_v_unk1_unk2 = 0; + __pyx_v_unk1_not2 = 0; + __pyx_v_not1_unk2 = 0; - /* "Orange/distance/_distance.pyx":437 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * unk1_unk2 += 1 + /* "Orange/distance/_distance.pyx":490 + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): */ - __pyx_t_12 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_12) { + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; - /* "Orange/distance/_distance.pyx":438 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * unk1_unk2 += 1 - * elif val2 != 0: + /* "Orange/distance/_distance.pyx":491 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + __pyx_t_23 = __pyx_v_row; + __pyx_t_24 = __pyx_v_col1; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row; + __pyx_t_27 = __pyx_v_col2; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":439 - * if npy_isnan(val1): - * if npy_isnan(val2): - * unk1_unk2 += 1 # <<<<<<<<<<<<<< - * elif val2 != 0: - * unk1_in2 += 1 + /* "Orange/distance/_distance.pyx":492 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * unk1_unk2 += 1 */ - __pyx_v_unk1_unk2 = (__pyx_v_unk1_unk2 + 1); + __pyx_t_16 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":438 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * unk1_unk2 += 1 - * elif val2 != 0: + /* "Orange/distance/_distance.pyx":493 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * unk1_unk2 += 1 + * elif val2 != 0: */ - goto __pyx_L14; - } + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":440 - * if npy_isnan(val2): - * unk1_unk2 += 1 - * elif val2 != 0: # <<<<<<<<<<<<<< - * unk1_in2 += 1 - * else: + /* "Orange/distance/_distance.pyx":494 + * if npy_isnan(val1): + * if npy_isnan(val2): + * unk1_unk2 += 1 # <<<<<<<<<<<<<< + * elif val2 != 0: + * unk1_in2 += 1 */ - __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); - if (__pyx_t_12) { + __pyx_v_unk1_unk2 = (__pyx_v_unk1_unk2 + 1); - /* "Orange/distance/_distance.pyx":441 - * unk1_unk2 += 1 - * elif val2 != 0: - * unk1_in2 += 1 # <<<<<<<<<<<<<< - * else: - * unk1_not2 += 1 + /* "Orange/distance/_distance.pyx":493 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * unk1_unk2 += 1 + * elif val2 != 0: */ - __pyx_v_unk1_in2 = (__pyx_v_unk1_in2 + 1); + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":440 - * if npy_isnan(val2): - * unk1_unk2 += 1 - * elif val2 != 0: # <<<<<<<<<<<<<< - * unk1_in2 += 1 - * else: + /* "Orange/distance/_distance.pyx":495 + * if npy_isnan(val2): + * unk1_unk2 += 1 + * elif val2 != 0: # <<<<<<<<<<<<<< + * unk1_in2 += 1 + * else: */ - goto __pyx_L14; - } + __pyx_t_16 = ((__pyx_v_val2 != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":443 - * unk1_in2 += 1 - * else: - * unk1_not2 += 1 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * if val1 != 0: + /* "Orange/distance/_distance.pyx":496 + * unk1_unk2 += 1 + * elif val2 != 0: + * unk1_in2 += 1 # <<<<<<<<<<<<<< + * else: + * unk1_not2 += 1 */ - /*else*/ { - __pyx_v_unk1_not2 = (__pyx_v_unk1_not2 + 1); + __pyx_v_unk1_in2 = (__pyx_v_unk1_in2 + 1); + + /* "Orange/distance/_distance.pyx":495 + * if npy_isnan(val2): + * unk1_unk2 += 1 + * elif val2 != 0: # <<<<<<<<<<<<<< + * unk1_in2 += 1 + * else: + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":498 + * unk1_in2 += 1 + * else: + * unk1_not2 += 1 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * if val1 != 0: + */ + /*else*/ { + __pyx_v_unk1_not2 = (__pyx_v_unk1_not2 + 1); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":492 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * unk1_unk2 += 1 + */ + goto __pyx_L17; } - __pyx_L14:; - /* "Orange/distance/_distance.pyx":437 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * unk1_unk2 += 1 + /* "Orange/distance/_distance.pyx":499 + * else: + * unk1_not2 += 1 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * if val1 != 0: + * in1_unk2 += 1 */ - goto __pyx_L13; - } + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":444 - * else: - * unk1_not2 += 1 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * if val1 != 0: - * in1_unk2 += 1 + /* "Orange/distance/_distance.pyx":500 + * unk1_not2 += 1 + * elif npy_isnan(val2): + * if val1 != 0: # <<<<<<<<<<<<<< + * in1_unk2 += 1 + * else: */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + __pyx_t_16 = ((__pyx_v_val1 != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":445 - * unk1_not2 += 1 - * elif npy_isnan(val2): - * if val1 != 0: # <<<<<<<<<<<<<< - * in1_unk2 += 1 - * else: + /* "Orange/distance/_distance.pyx":501 + * elif npy_isnan(val2): + * if val1 != 0: + * in1_unk2 += 1 # <<<<<<<<<<<<<< + * else: + * not1_unk2 += 1 */ - __pyx_t_12 = ((__pyx_v_val1 != 0.0) != 0); - if (__pyx_t_12) { + __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); - /* "Orange/distance/_distance.pyx":446 - * elif npy_isnan(val2): - * if val1 != 0: - * in1_unk2 += 1 # <<<<<<<<<<<<<< - * else: - * not1_unk2 += 1 + /* "Orange/distance/_distance.pyx":500 + * unk1_not2 += 1 + * elif npy_isnan(val2): + * if val1 != 0: # <<<<<<<<<<<<<< + * in1_unk2 += 1 + * else: */ - __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); + goto __pyx_L19; + } - /* "Orange/distance/_distance.pyx":445 - * unk1_not2 += 1 - * elif npy_isnan(val2): - * if val1 != 0: # <<<<<<<<<<<<<< - * in1_unk2 += 1 + /* "Orange/distance/_distance.pyx":503 + * in1_unk2 += 1 + * else: + * not1_unk2 += 1 # <<<<<<<<<<<<<< * else: + * ival1 = nonzeros[row, col1] + */ + /*else*/ { + __pyx_v_not1_unk2 = (__pyx_v_not1_unk2 + 1); + } + __pyx_L19:; + + /* "Orange/distance/_distance.pyx":499 + * else: + * unk1_not2 += 1 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * if val1 != 0: + * in1_unk2 += 1 */ - goto __pyx_L15; + goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":448 - * in1_unk2 += 1 + /* "Orange/distance/_distance.pyx":505 + * not1_unk2 += 1 * else: - * not1_unk2 += 1 # <<<<<<<<<<<<<< - * else: - * ival1 = nonzeros[row, col1] + * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 */ /*else*/ { - __pyx_v_not1_unk2 = (__pyx_v_not1_unk2 + 1); - } - __pyx_L15:; + __pyx_t_29 = __pyx_v_row; + __pyx_t_30 = __pyx_v_col1; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":444 + /* "Orange/distance/_distance.pyx":506 * else: - * unk1_not2 += 1 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * if val1 != 0: - * in1_unk2 += 1 + * ival1 = nonzeros[row, col1] + * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 */ - goto __pyx_L13; - } + __pyx_t_31 = __pyx_v_row; + __pyx_t_32 = __pyx_v_col2; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":450 - * not1_unk2 += 1 - * else: - * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 + /* "Orange/distance/_distance.pyx":507 + * ival1 = nonzeros[row, col1] + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 # <<<<<<<<<<<<<< + * in_any += ival1 | ival2 + * union = (in_any + unk1_in2 + in1_unk2 */ - /*else*/ { - __pyx_t_25 = __pyx_v_row; - __pyx_t_26 = __pyx_v_col1; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":451 - * else: - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 - */ - __pyx_t_27 = __pyx_v_row; - __pyx_t_28 = __pyx_v_col2; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":452 - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 # <<<<<<<<<<<<<< - * in_any += ival1 | ival2 - * union = (in_any + unk1_in2 + in1_unk2 - */ - __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - - /* "Orange/distance/_distance.pyx":453 - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 # <<<<<<<<<<<<<< - * union = (in_any + unk1_in2 + in1_unk2 - * + ps[col1] * unk1_not2 - */ - __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); + /* "Orange/distance/_distance.pyx":508 + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 # <<<<<<<<<<<<<< + * union = (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 + */ + __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); + } + __pyx_L17:; } - __pyx_L13:; - } - - /* "Orange/distance/_distance.pyx":455 - * in_any += ival1 | ival2 - * union = (in_any + unk1_in2 + in1_unk2 - * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - */ - __pyx_t_29 = __pyx_v_col1; - - /* "Orange/distance/_distance.pyx":456 - * union = (in_any + unk1_in2 + in1_unk2 - * + ps[col1] * unk1_not2 - * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * if union != 0: - */ - __pyx_t_30 = __pyx_v_col2; - - /* "Orange/distance/_distance.pyx":457 - * + ps[col1] * unk1_not2 - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< - * if union != 0: - * intersection = (in_both - */ - __pyx_t_31 = __pyx_v_col1; - __pyx_t_32 = __pyx_v_col2; - __pyx_v_union = (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)); - - /* "Orange/distance/_distance.pyx":458 - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * if union != 0: # <<<<<<<<<<<<<< - * intersection = (in_both - * + ps[col1] * unk1_in2 + - */ - __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); - if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":460 - * if union != 0: - * intersection = (in_both - * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) + /* "Orange/distance/_distance.pyx":510 + * in_any += ival1 | ival2 + * union = (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) */ __pyx_t_33 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":461 - * intersection = (in_both - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< - * + ps[col1] * ps[col2] * unk1_unk2) - * distances[col1, col2] = distances[col2, col1] = \ + /* "Orange/distance/_distance.pyx":511 + * union = (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 + * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * if union != 0: */ __pyx_t_34 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":462 - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - intersection / union + /* "Orange/distance/_distance.pyx":512 + * + ps[col1] * unk1_not2 + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< + * if union != 0: + * intersection = (in_both */ __pyx_t_35 = __pyx_v_col1; __pyx_t_36 = __pyx_v_col2; + __pyx_v_union = (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)); + + /* "Orange/distance/_distance.pyx":513 + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * if union != 0: # <<<<<<<<<<<<<< + * intersection = (in_both + * + ps[col1] * unk1_in2 + + */ + __pyx_t_16 = ((__pyx_v_union != 0.0) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":515 + * if union != 0: + * intersection = (in_both + * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) + */ + __pyx_t_37 = __pyx_v_col1; + + /* "Orange/distance/_distance.pyx":516 + * intersection = (in_both + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< + * + ps[col1] * ps[col2] * unk1_unk2) + * distances[col1, col2] = distances[col2, col1] = \ + */ + __pyx_t_38 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":461 - * intersection = (in_both - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< - * + ps[col1] * ps[col2] * unk1_unk2) - * distances[col1, col2] = distances[col2, col1] = \ + /* "Orange/distance/_distance.pyx":517 + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - intersection / union */ - __pyx_v_intersection = (((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2)); + __pyx_t_39 = __pyx_v_col1; + __pyx_t_40 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":464 - * + ps[col1] * ps[col2] * unk1_unk2) - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - intersection / union # <<<<<<<<<<<<<< - * else: - * for col2 in range(col1): + /* "Orange/distance/_distance.pyx":516 + * intersection = (in_both + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< + * + ps[col1] * ps[col2] * unk1_unk2) + * distances[col1, col2] = distances[col2, col1] = \ */ - __pyx_t_37 = (1.0 - (__pyx_v_intersection / __pyx_v_union)); + __pyx_v_intersection = (((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2)); - /* "Orange/distance/_distance.pyx":463 - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) - * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< - * 1 - intersection / union - * else: + /* "Orange/distance/_distance.pyx":519 + * + ps[col1] * ps[col2] * unk1_unk2) + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - intersection / union # <<<<<<<<<<<<<< + * else: + * for col2 in range(col1): */ - __pyx_t_38 = __pyx_v_col1; - __pyx_t_39 = __pyx_v_col2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_38 * __pyx_v_distances.strides[0]) ) + __pyx_t_39 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - __pyx_t_40 = __pyx_v_col2; - __pyx_t_41 = __pyx_v_col1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_40 * __pyx_v_distances.strides[0]) ) + __pyx_t_41 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - - /* "Orange/distance/_distance.pyx":458 - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * if union != 0: # <<<<<<<<<<<<<< - * intersection = (in_both - * + ps[col1] * unk1_in2 + + __pyx_t_41 = (1.0 - (__pyx_v_intersection / __pyx_v_union)); + + /* "Orange/distance/_distance.pyx":518 + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) + * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< + * 1 - intersection / union + * else: */ - } - } + __pyx_t_42 = __pyx_v_col1; + __pyx_t_43 = __pyx_v_col2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_42 * __pyx_v_distances.strides[0]) ) + __pyx_t_43 * __pyx_v_distances.strides[1]) )) = __pyx_t_41; + __pyx_t_44 = __pyx_v_col2; + __pyx_t_45 = __pyx_v_col1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_44 * __pyx_v_distances.strides[0]) ) + __pyx_t_45 * __pyx_v_distances.strides[1]) )) = __pyx_t_41; - /* "Orange/distance/_distance.pyx":431 - * with nogil: - * for col1 in range(n_cols): - * if nans[col1]: # <<<<<<<<<<<<<< - * for col2 in range(col1): - * in_both = in_any = 0 + /* "Orange/distance/_distance.pyx":513 + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * if union != 0: # <<<<<<<<<<<<<< + * intersection = (in_both + * + ps[col1] * unk1_in2 + */ - goto __pyx_L8; - } + } + } - /* "Orange/distance/_distance.pyx":466 - * 1 - intersection / union - * else: - * for col2 in range(col1): # <<<<<<<<<<<<<< - * if nans[col2]: + /* "Orange/distance/_distance.pyx":486 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * if nans[col1]: # <<<<<<<<<<<<<< + * for col2 in range(col1): * in_both = in_any = 0 */ - /*else*/ { - __pyx_t_13 = __pyx_v_col1; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_col2 = __pyx_t_15; + goto __pyx_L12; + } - /* "Orange/distance/_distance.pyx":467 - * else: - * for col2 in range(col1): - * if nans[col2]: # <<<<<<<<<<<<<< - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + /* "Orange/distance/_distance.pyx":521 + * 1 - intersection / union + * else: + * for col2 in range(col1): # <<<<<<<<<<<<<< + * if nans[col2]: + * in_both = in_any = 0 */ - __pyx_t_42 = __pyx_v_col2; - __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); - if (__pyx_t_12) { + /*else*/ { + __pyx_t_17 = __pyx_v_col1; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_col2 = __pyx_t_19; - /* "Orange/distance/_distance.pyx":468 - * for col2 in range(col1): - * if nans[col2]: - * in_both = in_any = 0 # <<<<<<<<<<<<<< - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - * for row in range(n_rows): + /* "Orange/distance/_distance.pyx":522 + * else: + * for col2 in range(col1): + * if nans[col2]: # <<<<<<<<<<<<<< + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + */ + __pyx_t_46 = __pyx_v_col2; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":523 + * for col2 in range(col1): + * if nans[col2]: + * in_both = in_any = 0 # <<<<<<<<<<<<<< + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * for row in range(n_rows): + */ + __pyx_v_in_both = 0; + __pyx_v_in_any = 0; + + /* "Orange/distance/_distance.pyx":524 + * if nans[col2]: + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] + */ + __pyx_v_in1_unk2 = 0; + __pyx_v_unk1_in2 = 0; + __pyx_v_unk1_unk2 = 0; + __pyx_v_unk1_not2 = 0; + __pyx_v_not1_unk2 = 0; + + /* "Orange/distance/_distance.pyx":525 + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * ival1 = nonzeros[row, col1] + * val2 = x[row, col2] + */ + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; + + /* "Orange/distance/_distance.pyx":526 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< + * val2 = x[row, col2] + * if npy_isnan(val2): */ - __pyx_v_in_both = 0; - __pyx_v_in_any = 0; + __pyx_t_47 = __pyx_v_row; + __pyx_t_48 = __pyx_v_col1; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":469 - * if nans[col2]: - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * ival1 = nonzeros[row, col1] + /* "Orange/distance/_distance.pyx":527 + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] + * val2 = x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * if ival1: */ - __pyx_v_in1_unk2 = 0; - __pyx_v_unk1_in2 = 0; - __pyx_v_unk1_unk2 = 0; - __pyx_v_unk1_not2 = 0; - __pyx_v_not1_unk2 = 0; + __pyx_t_49 = __pyx_v_row; + __pyx_t_50 = __pyx_v_col2; + __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_x.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":470 - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * ival1 = nonzeros[row, col1] - * val2 = x[row, col2] + /* "Orange/distance/_distance.pyx":528 + * ival1 = nonzeros[row, col1] + * val2 = x[row, col2] + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if ival1: + * in1_unk2 += 1 */ - __pyx_t_16 = __pyx_v_n_rows; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_row = __pyx_t_18; + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":471 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - * for row in range(n_rows): - * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< - * val2 = x[row, col2] - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":529 + * val2 = x[row, col2] + * if npy_isnan(val2): + * if ival1: # <<<<<<<<<<<<<< + * in1_unk2 += 1 + * else: */ - __pyx_t_43 = __pyx_v_row; - __pyx_t_44 = __pyx_v_col1; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + __pyx_t_16 = (__pyx_v_ival1 != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":472 - * for row in range(n_rows): - * ival1 = nonzeros[row, col1] - * val2 = x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * if ival1: + /* "Orange/distance/_distance.pyx":530 + * if npy_isnan(val2): + * if ival1: + * in1_unk2 += 1 # <<<<<<<<<<<<<< + * else: + * not1_unk2 += 1 */ - __pyx_t_45 = __pyx_v_row; - __pyx_t_46 = __pyx_v_col2; - __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); - /* "Orange/distance/_distance.pyx":473 - * ival1 = nonzeros[row, col1] - * val2 = x[row, col2] - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if ival1: - * in1_unk2 += 1 + /* "Orange/distance/_distance.pyx":529 + * val2 = x[row, col2] + * if npy_isnan(val2): + * if ival1: # <<<<<<<<<<<<<< + * in1_unk2 += 1 + * else: */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + goto __pyx_L27; + } - /* "Orange/distance/_distance.pyx":474 - * val2 = x[row, col2] - * if npy_isnan(val2): - * if ival1: # <<<<<<<<<<<<<< - * in1_unk2 += 1 + /* "Orange/distance/_distance.pyx":532 + * in1_unk2 += 1 + * else: + * not1_unk2 += 1 # <<<<<<<<<<<<<< * else: + * ival2 = nonzeros[row, col2] */ - __pyx_t_12 = (__pyx_v_ival1 != 0); - if (__pyx_t_12) { + /*else*/ { + __pyx_v_not1_unk2 = (__pyx_v_not1_unk2 + 1); + } + __pyx_L27:; - /* "Orange/distance/_distance.pyx":475 - * if npy_isnan(val2): - * if ival1: - * in1_unk2 += 1 # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":528 + * ival1 = nonzeros[row, col1] + * val2 = x[row, col2] + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if ival1: + * in1_unk2 += 1 + */ + goto __pyx_L26; + } + + /* "Orange/distance/_distance.pyx":534 + * not1_unk2 += 1 * else: - * not1_unk2 += 1 + * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 */ - __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); + /*else*/ { + __pyx_t_51 = __pyx_v_row; + __pyx_t_52 = __pyx_v_col2; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":474 - * val2 = x[row, col2] - * if npy_isnan(val2): - * if ival1: # <<<<<<<<<<<<<< - * in1_unk2 += 1 + /* "Orange/distance/_distance.pyx":535 * else: + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 # <<<<<<<<<<<<<< + * in_any += ival1 | ival2 + * distances[col1, col2] = distances[col2, col1] = \ + */ + __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); + + /* "Orange/distance/_distance.pyx":536 + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both */ - goto __pyx_L23; + __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); } + __pyx_L26:; + } - /* "Orange/distance/_distance.pyx":477 - * in1_unk2 += 1 - * else: - * not1_unk2 += 1 # <<<<<<<<<<<<<< - * else: + /* "Orange/distance/_distance.pyx":539 + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both + * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) / \ + */ + __pyx_t_53 = __pyx_v_col1; + + /* "Orange/distance/_distance.pyx":540 + * 1 - float(in_both + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< + * + ps[col1] * ps[col2] * unk1_unk2) / \ + * (in_any + unk1_in2 + in1_unk2 + + */ + __pyx_t_54 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":541 + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) / \ # <<<<<<<<<<<<<< + * (in_any + unk1_in2 + in1_unk2 + + * + ps[col1] * unk1_not2 + */ + __pyx_t_55 = __pyx_v_col1; + __pyx_t_56 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":543 + * + ps[col1] * ps[col2] * unk1_unk2) / \ + * (in_any + unk1_in2 + in1_unk2 + + * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + */ + __pyx_t_57 = __pyx_v_col1; + + /* "Orange/distance/_distance.pyx":544 + * (in_any + unk1_in2 + in1_unk2 + + * + ps[col1] * unk1_not2 + * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * else: + */ + __pyx_t_58 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":545 + * + ps[col1] * unk1_not2 + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< + * else: + * in_both = in_any = 0 + */ + __pyx_t_59 = __pyx_v_col1; + __pyx_t_60 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":538 + * in_any += ival1 | ival2 + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both # <<<<<<<<<<<<<< + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + + */ + __pyx_t_28 = (1.0 - (((double)(((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2))) / (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)))); + + /* "Orange/distance/_distance.pyx":537 + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 + * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< + * 1 - float(in_both + * + ps[col1] * unk1_in2 + + */ + __pyx_t_61 = __pyx_v_col1; + __pyx_t_62 = __pyx_v_col2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_61 * __pyx_v_distances.strides[0]) ) + __pyx_t_62 * __pyx_v_distances.strides[1]) )) = __pyx_t_28; + __pyx_t_63 = __pyx_v_col2; + __pyx_t_64 = __pyx_v_col1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_63 * __pyx_v_distances.strides[0]) ) + __pyx_t_64 * __pyx_v_distances.strides[1]) )) = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":522 + * else: + * for col2 in range(col1): + * if nans[col2]: # <<<<<<<<<<<<<< + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + */ + goto __pyx_L23; + } + + /* "Orange/distance/_distance.pyx":547 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * else: + * in_both = in_any = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] + */ + /*else*/ { + __pyx_v_in_both = 0; + __pyx_v_in_any = 0; + + /* "Orange/distance/_distance.pyx":548 + * else: + * in_both = in_any = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] */ - /*else*/ { - __pyx_v_not1_unk2 = (__pyx_v_not1_unk2 + 1); - } - __pyx_L23:; + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; - /* "Orange/distance/_distance.pyx":473 - * ival1 = nonzeros[row, col1] - * val2 = x[row, col2] - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if ival1: - * in1_unk2 += 1 + /* "Orange/distance/_distance.pyx":549 + * in_both = in_any = 0 + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 */ - goto __pyx_L22; - } + __pyx_t_65 = __pyx_v_row; + __pyx_t_66 = __pyx_v_col1; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_65, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_66, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":479 - * not1_unk2 += 1 - * else: + /* "Orange/distance/_distance.pyx":550 + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< * in_both += ival1 & ival2 * in_any += ival1 | ival2 */ - /*else*/ { - __pyx_t_47 = __pyx_v_row; - __pyx_t_48 = __pyx_v_col2; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + __pyx_t_67 = __pyx_v_row; + __pyx_t_68 = __pyx_v_col2; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":480 - * else: + /* "Orange/distance/_distance.pyx":551 + * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 # <<<<<<<<<<<<<< * in_any += ival1 | ival2 - * distances[col1, col2] = distances[col2, col1] = \ + * if in_any != 0: */ __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":481 + /* "Orange/distance/_distance.pyx":552 * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 * in_any += ival1 | ival2 # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both + * if in_any != 0: + * distances[col1, col2] = distances[col2, col1] = \ */ __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); } - __pyx_L22:; - } - - /* "Orange/distance/_distance.pyx":484 - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both - * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) / \ - */ - __pyx_t_49 = __pyx_v_col1; - - /* "Orange/distance/_distance.pyx":485 - * 1 - float(in_both - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< - * + ps[col1] * ps[col2] * unk1_unk2) / \ - * (in_any + unk1_in2 + in1_unk2 + - */ - __pyx_t_50 = __pyx_v_col2; - - /* "Orange/distance/_distance.pyx":486 - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) / \ # <<<<<<<<<<<<<< - * (in_any + unk1_in2 + in1_unk2 + - * + ps[col1] * unk1_not2 - */ - __pyx_t_51 = __pyx_v_col1; - __pyx_t_52 = __pyx_v_col2; - - /* "Orange/distance/_distance.pyx":488 - * + ps[col1] * ps[col2] * unk1_unk2) / \ - * (in_any + unk1_in2 + in1_unk2 + - * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - */ - __pyx_t_53 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":489 - * (in_any + unk1_in2 + in1_unk2 + - * + ps[col1] * unk1_not2 - * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * else: + /* "Orange/distance/_distance.pyx":553 + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 + * if in_any != 0: # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both) / in_any */ - __pyx_t_54 = __pyx_v_col2; + __pyx_t_16 = ((__pyx_v_in_any != 0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":490 - * + ps[col1] * unk1_not2 - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< - * else: - * in_both = in_any = 0 + /* "Orange/distance/_distance.pyx":555 + * if in_any != 0: + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both) / in_any # <<<<<<<<<<<<<< + * + * return distances */ - __pyx_t_55 = __pyx_v_col1; - __pyx_t_56 = __pyx_v_col2; + __pyx_t_41 = (1.0 - (((double)__pyx_v_in_both) / __pyx_v_in_any)); - /* "Orange/distance/_distance.pyx":483 + /* "Orange/distance/_distance.pyx":554 * in_any += ival1 | ival2 - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both # <<<<<<<<<<<<<< - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + + * if in_any != 0: + * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< + * 1 - float(in_both) / in_any + * */ - __pyx_t_24 = (1.0 - (((__pyx_t_5numpy_float64_t)((double)(((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2)))) / (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)))); + __pyx_t_69 = __pyx_v_col1; + __pyx_t_70 = __pyx_v_col2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_69 * __pyx_v_distances.strides[0]) ) + __pyx_t_70 * __pyx_v_distances.strides[1]) )) = __pyx_t_41; + __pyx_t_71 = __pyx_v_col2; + __pyx_t_72 = __pyx_v_col1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_71 * __pyx_v_distances.strides[0]) ) + __pyx_t_72 * __pyx_v_distances.strides[1]) )) = __pyx_t_41; - /* "Orange/distance/_distance.pyx":482 + /* "Orange/distance/_distance.pyx":553 * in_both += ival1 & ival2 * in_any += ival1 | ival2 - * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< - * 1 - float(in_both - * + ps[col1] * unk1_in2 + - */ - __pyx_t_57 = __pyx_v_col1; - __pyx_t_58 = __pyx_v_col2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_57 * __pyx_v_distances.strides[0]) ) + __pyx_t_58 * __pyx_v_distances.strides[1]) )) = __pyx_t_24; - __pyx_t_59 = __pyx_v_col2; - __pyx_t_60 = __pyx_v_col1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_59 * __pyx_v_distances.strides[0]) ) + __pyx_t_60 * __pyx_v_distances.strides[1]) )) = __pyx_t_24; - - /* "Orange/distance/_distance.pyx":467 - * else: - * for col2 in range(col1): - * if nans[col2]: # <<<<<<<<<<<<<< - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * if in_any != 0: # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both) / in_any */ - goto __pyx_L19; + } + } + __pyx_L23:; } + } + __pyx_L12:; + } - /* "Orange/distance/_distance.pyx":492 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * else: - * in_both = in_any = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * ival1 = nonzeros[row, col1] - */ - /*else*/ { - __pyx_v_in_both = 0; - __pyx_v_in_any = 0; - - /* "Orange/distance/_distance.pyx":493 - * else: - * in_both = in_any = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] - */ - __pyx_t_16 = __pyx_v_n_rows; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_row = __pyx_t_18; - - /* "Orange/distance/_distance.pyx":494 - * in_both = in_any = 0 - * for row in range(n_rows): - * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 - */ - __pyx_t_61 = __pyx_v_row; - __pyx_t_62 = __pyx_v_col1; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":495 - * for row in range(n_rows): - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 - */ - __pyx_t_63 = __pyx_v_row; - __pyx_t_64 = __pyx_v_col2; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":496 - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 # <<<<<<<<<<<<<< - * in_any += ival1 | ival2 - * if in_any != 0: - */ - __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - - /* "Orange/distance/_distance.pyx":497 - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 # <<<<<<<<<<<<<< - * if in_any != 0: - * distances[col1, col2] = distances[col2, col1] = \ - */ - __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); - } - - /* "Orange/distance/_distance.pyx":498 - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 - * if in_any != 0: # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both) / in_any - */ - __pyx_t_12 = ((__pyx_v_in_any != 0) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":500 - * if in_any != 0: - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both) / in_any # <<<<<<<<<<<<<< - * - * return distances - */ - __pyx_t_37 = (1.0 - (((double)__pyx_v_in_both) / ((double)__pyx_v_in_any))); - - /* "Orange/distance/_distance.pyx":499 - * in_any += ival1 | ival2 - * if in_any != 0: - * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< - * 1 - float(in_both) / in_any - * - */ - __pyx_t_65 = __pyx_v_col1; - __pyx_t_66 = __pyx_v_col2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_65 * __pyx_v_distances.strides[0]) ) + __pyx_t_66 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - __pyx_t_67 = __pyx_v_col2; - __pyx_t_68 = __pyx_v_col1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_67 * __pyx_v_distances.strides[0]) ) + __pyx_t_68 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - - /* "Orange/distance/_distance.pyx":498 - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 - * if in_any != 0: # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both) / in_any - */ - } - } - __pyx_L19:; + /* "Orange/distance/_distance.pyx":485 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * if nans[col1]: + * for col2 in range(col1): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; } + __pyx_L11:; } - __pyx_L8:; - } } + } - /* "Orange/distance/_distance.pyx":429 - * n_rows, n_cols = x.shape[0], x.shape[1] + /* "Orange/distance/_distance.pyx":482 * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * if nans[col1]: + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":502 - * 1 - float(in_both) / in_any + /* "Orange/distance/_distance.pyx":557 + * 1 - float(in_both) / in_any * * return distances # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":416 + /* "Orange/distance/_distance.pyx":467 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< @@ -10030,6 +12273,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_13); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -10054,7 +12298,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":215 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -10092,8 +12336,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - char *__pyx_t_8; + PyArray_Descr *__pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; @@ -10102,7 +12347,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":222 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265 * * cdef int i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -10111,7 +12356,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":223 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266 * cdef int i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -10120,7 +12365,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":225 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -10129,11 +12374,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":227 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270 * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); @@ -10143,53 +12388,53 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L4_bool_binop_done; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":228 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_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_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":227 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270 * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ if (unlikely(__pyx_t_1)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":229 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __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_ERR(1, 229, __pyx_L1_error) + __PYX_ERR(1, 272, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":227 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270 * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":231 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274 * 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)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); @@ -10199,49 +12444,49 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L7_bool_binop_done; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":232 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L7_bool_binop_done:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":231 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274 * 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)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ if (unlikely(__pyx_t_1)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":233 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 233, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __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_ERR(1, 233, __pyx_L1_error) + __PYX_ERR(1, 276, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":231 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274 * 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)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":235 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -10250,7 +12495,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":236 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -10259,7 +12504,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":237 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -10269,7 +12514,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) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":240 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) # <<<<<<<<<<<<<< @@ -10278,7 +12523,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim)))); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":241 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284 * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -10287,7 +12532,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":242 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285 * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -10299,7 +12544,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":243 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -10308,7 +12553,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]); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":244 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -10318,7 +12563,7 @@ 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]); } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":237 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -10328,7 +12573,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L9; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":246 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -10338,7 +12583,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P /*else*/ { __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":247 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -10349,7 +12594,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L9:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":248 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -10358,7 +12603,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":249 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -10367,7 +12612,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":250 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -10376,28 +12621,29 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":253 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr + * cdef dtype descr = PyArray_DESCR(self) * cdef int offset */ __pyx_v_f = NULL; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":254 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297 * cdef int t * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef dtype descr = PyArray_DESCR(self) # <<<<<<<<<<<<<< * cdef int offset * */ - __pyx_t_3 = ((PyObject *)__pyx_v_self->descr); + __pyx_t_7 = PyArray_DESCR(__pyx_v_self); + __pyx_t_3 = ((PyObject *)__pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300 * cdef int offset * * info.obj = self # <<<<<<<<<<<<<< @@ -10410,7 +12656,7 @@ 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); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302 * info.obj = self * * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< @@ -10420,7 +12666,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0); if (__pyx_t_1) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":260 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303 * * if not PyDataType_HASFIELDS(descr): * t = descr.type_num # <<<<<<<<<<<<<< @@ -10430,7 +12676,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_4 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_4; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":261 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304 * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -10450,7 +12696,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L15_next_or:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":262 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -10467,7 +12713,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = __pyx_t_2; __pyx_L14_bool_binop_done:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":261 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304 * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -10476,20 +12722,20 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ if (unlikely(__pyx_t_1)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":263 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306 * 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 263, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __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_ERR(1, 263, __pyx_L1_error) + __PYX_ERR(1, 306, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":261 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304 * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -10498,7 +12744,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":264 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -10509,206 +12755,206 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P case NPY_BYTE: __pyx_v_f = ((char *)"b"); break; + case NPY_UBYTE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":265 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ - case NPY_UBYTE: __pyx_v_f = ((char *)"B"); break; + case NPY_SHORT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":266 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ - case NPY_SHORT: __pyx_v_f = ((char *)"h"); break; + case NPY_USHORT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":267 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ - case NPY_USHORT: __pyx_v_f = ((char *)"H"); break; + case NPY_INT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":268 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ - case NPY_INT: __pyx_v_f = ((char *)"i"); break; + case NPY_UINT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":269 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ - case NPY_UINT: __pyx_v_f = ((char *)"I"); break; + case NPY_LONG: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":270 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ - case NPY_LONG: __pyx_v_f = ((char *)"l"); break; + case NPY_ULONG: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":271 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ - case NPY_ULONG: __pyx_v_f = ((char *)"L"); break; + case NPY_LONGLONG: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":272 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ - case NPY_LONGLONG: __pyx_v_f = ((char *)"q"); break; + case NPY_ULONGLONG: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":273 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ - case NPY_ULONGLONG: __pyx_v_f = ((char *)"Q"); break; + case NPY_FLOAT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":274 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ - case NPY_FLOAT: __pyx_v_f = ((char *)"f"); break; + case NPY_DOUBLE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":275 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ - case NPY_DOUBLE: __pyx_v_f = ((char *)"d"); break; + case NPY_LONGDOUBLE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":276 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ - case NPY_LONGDOUBLE: __pyx_v_f = ((char *)"g"); break; + case NPY_CFLOAT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":277 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ - case NPY_CFLOAT: __pyx_v_f = ((char *)"Zf"); break; + case NPY_CDOUBLE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":278 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ - case NPY_CDOUBLE: __pyx_v_f = ((char *)"Zd"); break; + case NPY_CLONGDOUBLE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":279 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ - case NPY_CLONGDOUBLE: __pyx_v_f = ((char *)"Zg"); break; + case NPY_OBJECT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":280 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - case NPY_OBJECT: __pyx_v_f = ((char *)"O"); break; default: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":282 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 282, __pyx_L1_error) + __PYX_ERR(1, 325, __pyx_L1_error) break; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":283 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -10717,7 +12963,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":284 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -10727,7 +12973,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_r = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302 * info.obj = self * * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< @@ -10736,7 +12982,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":286 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329 * return * else: * info.format = PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -10746,7 +12992,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P /*else*/ { __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF)); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":287 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330 * else: * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -10755,7 +13001,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->format[0]) = '^'; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":288 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331 * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -10764,17 +13010,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_offset = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":289 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332 * 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) */ - __pyx_t_8 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_8 == ((char *)NULL))) __PYX_ERR(1, 289, __pyx_L1_error) - __pyx_v_f = __pyx_t_8; + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error) + __pyx_v_f = __pyx_t_9; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":292 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< @@ -10784,7 +13030,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P (__pyx_v_f[0]) = '\x00'; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":215 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -10797,7 +13043,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info->obj != NULL) { @@ -10816,7 +13062,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":294 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -10840,7 +13086,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":295 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -10850,7 +13096,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) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":296 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) # <<<<<<<<<<<<<< @@ -10859,7 +13105,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ PyObject_Free(__pyx_v_info->format); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":295 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -10868,7 +13114,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":297 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340 * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -10878,7 +13124,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) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":298 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341 * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * PyObject_Free(info.strides) # <<<<<<<<<<<<<< @@ -10887,7 +13133,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ PyObject_Free(__pyx_v_info->strides); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":297 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340 * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -10896,7 +13142,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":294 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -10908,7 +13154,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __Pyx_RefNannyFinishContext(); } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":775 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -10922,7 +13168,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":776 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -10930,13 +13176,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 776, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":775 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -10955,7 +13201,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":778 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -10969,7 +13215,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":779 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -10977,13 +13223,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 779, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":778 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -11002,7 +13248,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":781 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -11016,7 +13262,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":782 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -11024,13 +13270,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 782, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":781 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -11049,7 +13295,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":784 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -11063,7 +13309,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":785 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -11071,13 +13317,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":784 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -11096,7 +13342,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":787 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -11110,7 +13356,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":788 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -11118,13 +13364,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline tuple PyDataType_SHAPE(dtype d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 788, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":787 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -11143,7 +13389,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":790 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -11157,7 +13403,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ int __pyx_t_1; __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":791 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -11167,7 +13413,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); if (__pyx_t_1) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":792 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838 * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): * return d.subarray.shape # <<<<<<<<<<<<<< @@ -11179,7 +13425,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":791 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -11188,7 +13434,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":794 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840 * return d.subarray.shape * else: * return () # <<<<<<<<<<<<<< @@ -11202,7 +13448,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ goto __pyx_L0; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":790 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -11217,7 +13463,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":796 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842 * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -11246,7 +13492,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx char *__pyx_t_9; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847 * * cdef dtype child * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -11255,7 +13501,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":802 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848 * cdef dtype child * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -11264,7 +13510,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":805 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -11273,21 +13519,21 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_v_descr->names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 805, __pyx_L1_error) + __PYX_ERR(1, 851, __pyx_L1_error) } __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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 805, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 805, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":806 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< @@ -11296,15 +13542,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_v_descr->fields == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 806, __pyx_L1_error) + __PYX_ERR(1, 852, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 806, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __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 %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 806, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":807 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -11317,7 +13563,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 807, __pyx_L1_error) + __PYX_ERR(1, 853, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); @@ -11325,51 +13571,51 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 807, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 807, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 807, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error) } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 807, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":809 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 809, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 809, __pyx_L1_error) + __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 809, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); if (unlikely(__pyx_t_6)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":810 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856 * * 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_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 810, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __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_ERR(1, 810, __pyx_L1_error) + __PYX_ERR(1, 856, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":809 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< @@ -11378,7 +13624,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":812 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -11398,7 +13644,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __pyx_L8_next_or:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":813 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -11415,7 +13661,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = __pyx_t_7; __pyx_L7_bool_binop_done:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":812 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -11424,20 +13670,20 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_t_6)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":814 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860 * 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_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __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_ERR(1, 814, __pyx_L1_error) + __PYX_ERR(1, 860, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":812 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -11446,7 +13692,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":824 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -11454,15 +13700,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 824, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __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_ERR(1, 824, __pyx_L1_error) + __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_ERR(1, 870, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 824, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) break; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":825 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -11471,7 +13717,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 0x78; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":826 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -11480,7 +13726,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":827 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -11491,7 +13737,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":829 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -11501,7 +13747,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_8 = 0; (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":831 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -11511,19 +13757,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_6) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":832 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); __pyx_t_4 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":833 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -11533,20 +13779,20 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (unlikely(__pyx_t_6)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":834 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880 * 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_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __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_ERR(1, 834, __pyx_L1_error) + __PYX_ERR(1, 880, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":833 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -11555,252 +13801,252 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":837 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883 * * # 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_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __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_ERR(1, 837, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __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_ERR(1, 837, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":838 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884 * # 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_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __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_ERR(1, 838, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":839 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885 * 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_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __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_ERR(1, 839, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __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_ERR(1, 839, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x68; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":840 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886 * 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_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __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_ERR(1, 840, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":841 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887 * 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_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __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_ERR(1, 841, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __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_ERR(1, 841, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x69; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":842 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888 * 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_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __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_ERR(1, 842, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":843 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889 * 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_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 843, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __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_ERR(1, 843, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __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_ERR(1, 843, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x6C; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":844 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890 * 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_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __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_ERR(1, 844, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 844, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":845 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891 * 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_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 845, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __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_ERR(1, 845, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __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_ERR(1, 845, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x71; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":846 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892 * 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_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 846, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __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_ERR(1, 846, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 846, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":847 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893 * 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_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 847, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __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_ERR(1, 847, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __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_ERR(1, 847, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x66; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":848 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894 * 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_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 848, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __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_ERR(1, 848, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 848, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x64; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":849 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895 * 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_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 849, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __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_ERR(1, 849, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __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_ERR(1, 849, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x67; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":850 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896 * 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_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 850, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __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_ERR(1, 850, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 850, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -11809,18 +14055,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":851 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897 * 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_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 851, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __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_ERR(1, 851, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __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_ERR(1, 851, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -11829,18 +14075,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":852 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898 * 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_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __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_ERR(1, 852, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 852, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -11849,25 +14095,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":853 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899 * 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_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __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_ERR(1, 853, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __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_ERR(1, 853, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_6)) { (__pyx_v_f[0]) = 79; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":855 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -11875,18 +14121,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * else: */ /*else*/ { - __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __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_ERR(1, 855, __pyx_L1_error) + __PYX_ERR(1, 901, __pyx_L1_error) } __pyx_L15:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":856 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -11895,7 +14141,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":831 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -11905,7 +14151,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L13; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":860 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< @@ -11913,12 +14159,12 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * */ /*else*/ { - __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 == ((char *)NULL))) __PYX_ERR(1, 860, __pyx_L1_error) + __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 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error) __pyx_v_f = __pyx_t_9; } __pyx_L13:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":805 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -11928,7 +14174,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":861 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -11938,7 +14184,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = __pyx_v_f; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":796 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842 * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -11963,166 +14209,120 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022 + * int _import_umath() except -1 * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":979 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":980 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":979 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023 + * * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - goto __pyx_L3; - } - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":982 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - /*else*/ { - Py_INCREF(__pyx_v_base); - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":983 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":984 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) * */ - Py_XDECREF(__pyx_v_arr->base); + Py_INCREF(__pyx_v_base); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":985 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024 + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ - __pyx_v_arr->base = __pyx_v_baseptr; + (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022 + * int _import_umath() except -1 * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":987 - * arr.base = baseptr +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026 + * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None + * base = PyArray_BASE(arr) + * if base is NULL: */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":988 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027 * * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: * return None - * else: */ - __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); - if (__pyx_t_1) { + __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":989 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028 * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base + */ + __pyx_t_1 = ((__pyx_v_base == NULL) != 0); + if (__pyx_t_1) { + + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029 + * base = PyArray_BASE(arr) + * if base is NULL: * return None # <<<<<<<<<<<<<< - * else: - * return arr.base + * return base + * */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":988 - * + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028 * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< * return None - * else: + * return base */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":991 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030 + * if base is NULL: * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - * + * return base # <<<<<<<<<<<<<< * + * # Versions of the import_* functions which are more suitable for */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":987 - * arr.base = baseptr + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026 + * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None + * base = PyArray_BASE(arr) + * if base is NULL: */ /* function exit code */ @@ -12132,7 +14332,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":996 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -12153,7 +14353,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_array", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":997 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -12169,16 +14369,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":998 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036 * cdef inline int import_array() except -1: * try: * _import_array() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.multiarray failed to import") */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 998, __pyx_L3_error) + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":997 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -12192,7 +14392,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":999 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037 * try: * _import_array() * except Exception: # <<<<<<<<<<<<<< @@ -12202,28 +14402,28 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 999, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1000 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1000, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __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_ERR(1, 1000, __pyx_L5_except_error) + __PYX_ERR(1, 1038, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":997 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -12238,7 +14438,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_L8_try_end:; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":996 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -12261,7 +14461,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1002 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -12282,7 +14482,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_umath", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1003 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -12298,16 +14498,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1004 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042 * cdef inline int import_umath() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1004, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1003 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -12321,7 +14521,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1005 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -12331,28 +14531,28 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1005, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1006 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1006, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __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_ERR(1, 1006, __pyx_L5_except_error) + __PYX_ERR(1, 1044, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1003 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -12367,7 +14567,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_L8_try_end:; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1002 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -12390,7 +14590,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1008 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -12411,7 +14611,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_ufunc", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1009 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -12427,16 +14627,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1010 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048 * cdef inline int import_ufunc() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1010, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1009 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -12450,7 +14650,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1011 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -12459,26 +14659,26 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1011, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1012 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1012, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __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_ERR(1, 1012, __pyx_L5_except_error) + __PYX_ERR(1, 1050, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1009 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -12493,7 +14693,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_L8_try_end:; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1008 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -12516,7 +14716,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { return __pyx_r; } -/* "View.MemoryView":121 +/* "View.MemoryView":122 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< @@ -12565,13 +14765,13 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 121, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 121, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -12587,7 +14787,7 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 121, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -12603,14 +14803,14 @@ 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_ERR(2, 121, __pyx_L3_error) + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __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_ERR(2, 122, __pyx_L3_error) + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) } else { - /* "View.MemoryView":122 + /* "View.MemoryView":123 * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< @@ -12622,19 +14822,19 @@ 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_ERR(2, 121, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __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_ERR(2, 121, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error) if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 121, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error) } __pyx_r = __pyx_array___pyx_pf_15View_dot_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":121 + /* "View.MemoryView":122 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< @@ -12664,16 +14864,16 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - char *__pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_6 = NULL; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; PyObject *__pyx_t_10 = NULL; Py_ssize_t __pyx_t_11; __Pyx_RefNannySetupContext("__cinit__", 0); __Pyx_INCREF(__pyx_v_format); - /* "View.MemoryView":128 + /* "View.MemoryView":129 * cdef PyObject **p * * self.ndim = len(shape) # <<<<<<<<<<<<<< @@ -12682,12 +14882,12 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ if (unlikely(__pyx_v_shape == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 128, __pyx_L1_error) + __PYX_ERR(2, 129, __pyx_L1_error) } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 128, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error) __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "View.MemoryView":129 + /* "View.MemoryView":130 * * self.ndim = len(shape) * self.itemsize = itemsize # <<<<<<<<<<<<<< @@ -12696,7 +14896,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "View.MemoryView":131 + /* "View.MemoryView":132 * self.itemsize = itemsize * * if not self.ndim: # <<<<<<<<<<<<<< @@ -12706,20 +14906,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":132 + /* "View.MemoryView":133 * * if not self.ndim: * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< * * if itemsize <= 0: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 132, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __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_ERR(2, 132, __pyx_L1_error) + __PYX_ERR(2, 133, __pyx_L1_error) - /* "View.MemoryView":131 + /* "View.MemoryView":132 * self.itemsize = itemsize * * if not self.ndim: # <<<<<<<<<<<<<< @@ -12728,7 +14928,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":134 + /* "View.MemoryView":135 * raise ValueError("Empty shape tuple for cython.array") * * if itemsize <= 0: # <<<<<<<<<<<<<< @@ -12738,20 +14938,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":135 + /* "View.MemoryView":136 * * if itemsize <= 0: * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * * if not isinstance(format, bytes): */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 135, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __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_ERR(2, 135, __pyx_L1_error) + __PYX_ERR(2, 136, __pyx_L1_error) - /* "View.MemoryView":134 + /* "View.MemoryView":135 * raise ValueError("Empty shape tuple for cython.array") * * if itemsize <= 0: # <<<<<<<<<<<<<< @@ -12760,7 +14960,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":137 + /* "View.MemoryView":138 * raise ValueError("itemsize <= 0 for cython.array") * * if not isinstance(format, bytes): # <<<<<<<<<<<<<< @@ -12771,22 +14971,34 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_4) { - /* "View.MemoryView":138 + /* "View.MemoryView":139 * * if not isinstance(format, bytes): * format = format.encode('ASCII') # <<<<<<<<<<<<<< * self._format = format # keep a reference to the byte string * self.format = self._format */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 138, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":137 + /* "View.MemoryView":138 * raise ValueError("itemsize <= 0 for cython.array") * * if not isinstance(format, bytes): # <<<<<<<<<<<<<< @@ -12795,23 +15007,23 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":139 + /* "View.MemoryView":140 * if not isinstance(format, bytes): * 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 %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 139, __pyx_L1_error) - __pyx_t_5 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); + 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_ERR(2, 140, __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(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_v_self->_format = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":140 + /* "View.MemoryView":141 * format = format.encode('ASCII') * self._format = format # keep a reference to the byte string * self.format = self._format # <<<<<<<<<<<<<< @@ -12820,12 +15032,12 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ if (unlikely(__pyx_v_self->_format == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(2, 140, __pyx_L1_error) + __PYX_ERR(2, 141, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(2, 140, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_6; + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; - /* "View.MemoryView":143 + /* "View.MemoryView":144 * * * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< @@ -12834,7 +15046,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "View.MemoryView":144 + /* "View.MemoryView":145 * * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< @@ -12843,7 +15055,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - /* "View.MemoryView":146 + /* "View.MemoryView":147 * self._strides = self._shape + self.ndim * * if not self._shape: # <<<<<<<<<<<<<< @@ -12853,20 +15065,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":147 + /* "View.MemoryView":148 * * if not self._shape: * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 147, __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_ERR(2, 147, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __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_ERR(2, 148, __pyx_L1_error) - /* "View.MemoryView":146 + /* "View.MemoryView":147 * self._strides = self._shape + self.ndim * * if not self._shape: # <<<<<<<<<<<<<< @@ -12875,30 +15087,30 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":150 + /* "View.MemoryView":151 * * * 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_5 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0; + __pyx_t_8 = 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_5)) break; + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 150, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); #endif - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 150, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_dim = __pyx_t_8; - __pyx_v_idx = __pyx_t_7; - __pyx_t_7 = (__pyx_t_7 + 1); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); - /* "View.MemoryView":151 + /* "View.MemoryView":152 * * for idx, dim in enumerate(shape): * if dim <= 0: # <<<<<<<<<<<<<< @@ -12908,36 +15120,36 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":152 + /* "View.MemoryView":153 * 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_3 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 152, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); - __pyx_t_3 = 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_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 152, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 152, __pyx_L1_error) + __PYX_ERR(2, 153, __pyx_L1_error) - /* "View.MemoryView":151 + /* "View.MemoryView":152 * * for idx, dim in enumerate(shape): * if dim <= 0: # <<<<<<<<<<<<<< @@ -12946,7 +15158,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":153 + /* "View.MemoryView":154 * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) * self._shape[idx] = dim # <<<<<<<<<<<<<< @@ -12955,7 +15167,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - /* "View.MemoryView":150 + /* "View.MemoryView":151 * * * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< @@ -12963,19 +15175,19 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":156 + /* "View.MemoryView":157 * * cdef char order * if mode == 'fortran': # <<<<<<<<<<<<<< * order = b'F' * self.mode = u'fortran' */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 156, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error) if (__pyx_t_4) { - /* "View.MemoryView":157 + /* "View.MemoryView":158 * cdef char order * if mode == 'fortran': * order = b'F' # <<<<<<<<<<<<<< @@ -12984,7 +15196,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_order = 'F'; - /* "View.MemoryView":158 + /* "View.MemoryView":159 * if mode == 'fortran': * order = b'F' * self.mode = u'fortran' # <<<<<<<<<<<<<< @@ -12997,7 +15209,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __Pyx_DECREF(__pyx_v_self->mode); __pyx_v_self->mode = __pyx_n_u_fortran; - /* "View.MemoryView":156 + /* "View.MemoryView":157 * * cdef char order * if mode == 'fortran': # <<<<<<<<<<<<<< @@ -13007,17 +15219,17 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ goto __pyx_L10; } - /* "View.MemoryView":159 + /* "View.MemoryView":160 * 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_ERR(2, 159, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error) if (likely(__pyx_t_4)) { - /* "View.MemoryView":160 + /* "View.MemoryView":161 * self.mode = u'fortran' * elif mode == 'c': * order = b'C' # <<<<<<<<<<<<<< @@ -13026,7 +15238,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_order = 'C'; - /* "View.MemoryView":161 + /* "View.MemoryView":162 * elif mode == 'c': * order = b'C' * self.mode = u'c' # <<<<<<<<<<<<<< @@ -13039,7 +15251,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __Pyx_DECREF(__pyx_v_self->mode); __pyx_v_self->mode = __pyx_n_u_c; - /* "View.MemoryView":159 + /* "View.MemoryView":160 * order = b'F' * self.mode = u'fortran' * elif mode == 'c': # <<<<<<<<<<<<<< @@ -13049,7 +15261,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ goto __pyx_L10; } - /* "View.MemoryView":163 + /* "View.MemoryView":164 * self.mode = u'c' * else: * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< @@ -13057,18 +15269,18 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * self.len = fill_contig_strides_array(self._shape, self._strides, */ /*else*/ { - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 163, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 163, __pyx_L1_error) + __PYX_ERR(2, 164, __pyx_L1_error) } __pyx_L10:; - /* "View.MemoryView":165 + /* "View.MemoryView":166 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) * * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< @@ -13077,7 +15289,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __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":168 + /* "View.MemoryView":169 * itemsize, self.ndim, order) * * self.free_data = allocate_buffer # <<<<<<<<<<<<<< @@ -13086,19 +15298,19 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->free_data = __pyx_v_allocate_buffer; - /* "View.MemoryView":169 + /* "View.MemoryView":170 * * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< * if allocate_buffer: * */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 169, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 169, __pyx_L1_error) + __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_v_self->dtype_is_object = __pyx_t_4; - /* "View.MemoryView":170 + /* "View.MemoryView":171 * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' * if allocate_buffer: # <<<<<<<<<<<<<< @@ -13108,7 +15320,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = (__pyx_v_allocate_buffer != 0); if (__pyx_t_4) { - /* "View.MemoryView":173 + /* "View.MemoryView":174 * * * self.data = malloc(self.len) # <<<<<<<<<<<<<< @@ -13117,7 +15329,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - /* "View.MemoryView":174 + /* "View.MemoryView":175 * * self.data = malloc(self.len) * if not self.data: # <<<<<<<<<<<<<< @@ -13127,20 +15339,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":175 + /* "View.MemoryView":176 * self.data = malloc(self.len) * if not self.data: * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< * * if self.dtype_is_object: */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 175, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 175, __pyx_L1_error) + __PYX_ERR(2, 176, __pyx_L1_error) - /* "View.MemoryView":174 + /* "View.MemoryView":175 * * self.data = malloc(self.len) * if not self.data: # <<<<<<<<<<<<<< @@ -13149,7 +15361,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":177 + /* "View.MemoryView":178 * raise MemoryError("unable to allocate array data.") * * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -13159,7 +15371,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_4) { - /* "View.MemoryView":178 + /* "View.MemoryView":179 * * if self.dtype_is_object: * p = self.data # <<<<<<<<<<<<<< @@ -13168,7 +15380,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "View.MemoryView":179 + /* "View.MemoryView":180 * if self.dtype_is_object: * p = self.data * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< @@ -13177,18 +15389,18 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ if (unlikely(__pyx_v_itemsize == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 179, __pyx_L1_error) + __PYX_ERR(2, 180, __pyx_L1_error) } else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 179, __pyx_L1_error) + __PYX_ERR(2, 180, __pyx_L1_error) } __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize); - __pyx_t_8 = __pyx_t_1; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_8; __pyx_t_11+=1) { + __pyx_t_9 = __pyx_t_1; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "View.MemoryView":180 + /* "View.MemoryView":181 * p = self.data * for i in range(self.len / itemsize): * p[i] = Py_None # <<<<<<<<<<<<<< @@ -13197,7 +15409,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ (__pyx_v_p[__pyx_v_i]) = Py_None; - /* "View.MemoryView":181 + /* "View.MemoryView":182 * for i in range(self.len / itemsize): * p[i] = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -13207,7 +15419,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ Py_INCREF(Py_None); } - /* "View.MemoryView":177 + /* "View.MemoryView":178 * raise MemoryError("unable to allocate array data.") * * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -13216,7 +15428,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":170 + /* "View.MemoryView":171 * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' * if allocate_buffer: # <<<<<<<<<<<<<< @@ -13225,7 +15437,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":121 + /* "View.MemoryView":122 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< @@ -13239,7 +15451,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; @@ -13249,7 +15461,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ return __pyx_r; } -/* "View.MemoryView":184 +/* "View.MemoryView":185 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< @@ -13289,7 +15501,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "View.MemoryView":185 + /* "View.MemoryView":186 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 # <<<<<<<<<<<<<< @@ -13298,18 +15510,18 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_bufmode = -1; - /* "View.MemoryView":186 + /* "View.MemoryView":187 * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 * if self.mode == u"c": # <<<<<<<<<<<<<< * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 186, __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_ERR(2, 187, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":187 + /* "View.MemoryView":188 * cdef int bufmode = -1 * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< @@ -13318,7 +15530,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "View.MemoryView":186 + /* "View.MemoryView":187 * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 * if self.mode == u"c": # <<<<<<<<<<<<<< @@ -13328,18 +15540,18 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru goto __pyx_L3; } - /* "View.MemoryView":188 + /* "View.MemoryView":189 * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": # <<<<<<<<<<<<<< * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 188, __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_ERR(2, 189, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":189 + /* "View.MemoryView":190 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< @@ -13348,7 +15560,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "View.MemoryView":188 + /* "View.MemoryView":189 * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": # <<<<<<<<<<<<<< @@ -13358,7 +15570,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru } __pyx_L3:; - /* "View.MemoryView":190 + /* "View.MemoryView":191 * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): # <<<<<<<<<<<<<< @@ -13368,20 +15580,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":191 + /* "View.MemoryView":192 * 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 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 191, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __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_ERR(2, 191, __pyx_L1_error) + __PYX_ERR(2, 192, __pyx_L1_error) - /* "View.MemoryView":190 + /* "View.MemoryView":191 * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): # <<<<<<<<<<<<<< @@ -13390,7 +15602,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ } - /* "View.MemoryView":192 + /* "View.MemoryView":193 * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data # <<<<<<<<<<<<<< @@ -13400,7 +15612,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_4 = __pyx_v_self->data; __pyx_v_info->buf = __pyx_t_4; - /* "View.MemoryView":193 + /* "View.MemoryView":194 * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data * info.len = self.len # <<<<<<<<<<<<<< @@ -13410,7 +15622,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_5 = __pyx_v_self->len; __pyx_v_info->len = __pyx_t_5; - /* "View.MemoryView":194 + /* "View.MemoryView":195 * info.buf = self.data * info.len = self.len * info.ndim = self.ndim # <<<<<<<<<<<<<< @@ -13420,7 +15632,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_6 = __pyx_v_self->ndim; __pyx_v_info->ndim = __pyx_t_6; - /* "View.MemoryView":195 + /* "View.MemoryView":196 * info.len = self.len * info.ndim = self.ndim * info.shape = self._shape # <<<<<<<<<<<<<< @@ -13430,7 +15642,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_7 = __pyx_v_self->_shape; __pyx_v_info->shape = __pyx_t_7; - /* "View.MemoryView":196 + /* "View.MemoryView":197 * info.ndim = self.ndim * info.shape = self._shape * info.strides = self._strides # <<<<<<<<<<<<<< @@ -13440,7 +15652,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_7 = __pyx_v_self->_strides; __pyx_v_info->strides = __pyx_t_7; - /* "View.MemoryView":197 + /* "View.MemoryView":198 * info.shape = self._shape * info.strides = self._strides * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -13449,7 +15661,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_info->suboffsets = NULL; - /* "View.MemoryView":198 + /* "View.MemoryView":199 * info.strides = self._strides * info.suboffsets = NULL * info.itemsize = self.itemsize # <<<<<<<<<<<<<< @@ -13459,7 +15671,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_5 = __pyx_v_self->itemsize; __pyx_v_info->itemsize = __pyx_t_5; - /* "View.MemoryView":199 + /* "View.MemoryView":200 * info.suboffsets = NULL * info.itemsize = self.itemsize * info.readonly = 0 # <<<<<<<<<<<<<< @@ -13468,7 +15680,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_info->readonly = 0; - /* "View.MemoryView":201 + /* "View.MemoryView":202 * info.readonly = 0 * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -13478,7 +15690,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":202 + /* "View.MemoryView":203 * * if flags & PyBUF_FORMAT: * info.format = self.format # <<<<<<<<<<<<<< @@ -13488,7 +15700,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_4 = __pyx_v_self->format; __pyx_v_info->format = __pyx_t_4; - /* "View.MemoryView":201 + /* "View.MemoryView":202 * info.readonly = 0 * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -13498,7 +15710,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru goto __pyx_L5; } - /* "View.MemoryView":204 + /* "View.MemoryView":205 * info.format = self.format * else: * info.format = NULL # <<<<<<<<<<<<<< @@ -13510,7 +15722,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru } __pyx_L5:; - /* "View.MemoryView":206 + /* "View.MemoryView":207 * info.format = NULL * * info.obj = self # <<<<<<<<<<<<<< @@ -13523,7 +15735,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "View.MemoryView":184 + /* "View.MemoryView":185 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< @@ -13553,7 +15765,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru return __pyx_r; } -/* "View.MemoryView":210 +/* "View.MemoryView":211 * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") * * def __dealloc__(array self): # <<<<<<<<<<<<<< @@ -13577,7 +15789,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":211 + /* "View.MemoryView":212 * * def __dealloc__(array self): * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< @@ -13587,7 +15799,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":212 + /* "View.MemoryView":213 * def __dealloc__(array self): * if self.callback_free_data != NULL: * self.callback_free_data(self.data) # <<<<<<<<<<<<<< @@ -13596,7 +15808,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ __pyx_v_self->callback_free_data(__pyx_v_self->data); - /* "View.MemoryView":211 + /* "View.MemoryView":212 * * def __dealloc__(array self): * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< @@ -13606,7 +15818,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc goto __pyx_L3; } - /* "View.MemoryView":213 + /* "View.MemoryView":214 * if self.callback_free_data != NULL: * self.callback_free_data(self.data) * elif self.free_data: # <<<<<<<<<<<<<< @@ -13616,7 +15828,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc __pyx_t_1 = (__pyx_v_self->free_data != 0); if (__pyx_t_1) { - /* "View.MemoryView":214 + /* "View.MemoryView":215 * self.callback_free_data(self.data) * elif self.free_data: * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -13626,7 +15838,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":215 + /* "View.MemoryView":216 * elif self.free_data: * if self.dtype_is_object: * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< @@ -13635,7 +15847,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - /* "View.MemoryView":214 + /* "View.MemoryView":215 * self.callback_free_data(self.data) * elif self.free_data: * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -13644,7 +15856,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ } - /* "View.MemoryView":217 + /* "View.MemoryView":218 * refcount_objects_in_slice(self.data, self._shape, * self._strides, self.ndim, False) * free(self.data) # <<<<<<<<<<<<<< @@ -13653,7 +15865,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ free(__pyx_v_self->data); - /* "View.MemoryView":213 + /* "View.MemoryView":214 * if self.callback_free_data != NULL: * self.callback_free_data(self.data) * elif self.free_data: # <<<<<<<<<<<<<< @@ -13663,7 +15875,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc } __pyx_L3:; - /* "View.MemoryView":218 + /* "View.MemoryView":219 * self._strides, self.ndim, False) * free(self.data) * PyObject_Free(self._shape) # <<<<<<<<<<<<<< @@ -13672,7 +15884,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ PyObject_Free(__pyx_v_self->_shape); - /* "View.MemoryView":210 + /* "View.MemoryView":211 * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") * * def __dealloc__(array self): # <<<<<<<<<<<<<< @@ -13684,7 +15896,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":221 +/* "View.MemoryView":222 * * @property * def memview(self): # <<<<<<<<<<<<<< @@ -13711,7 +15923,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":222 + /* "View.MemoryView":223 * @property * def memview(self): * return self.get_memview() # <<<<<<<<<<<<<< @@ -13719,13 +15931,13 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ * @cname('get_memview') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 222, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":221 + /* "View.MemoryView":222 * * @property * def memview(self): # <<<<<<<<<<<<<< @@ -13744,7 +15956,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ return __pyx_r; } -/* "View.MemoryView":225 +/* "View.MemoryView":226 * * @cname('get_memview') * cdef get_memview(self): # <<<<<<<<<<<<<< @@ -13761,7 +15973,7 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("get_memview", 0); - /* "View.MemoryView":226 + /* "View.MemoryView":227 * @cname('get_memview') * cdef get_memview(self): * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< @@ -13770,7 +15982,7 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { */ __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - /* "View.MemoryView":227 + /* "View.MemoryView":228 * cdef get_memview(self): * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< @@ -13778,11 +15990,11 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { * def __len__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 227, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __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_ERR(2, 227, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 227, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); @@ -13793,14 +16005,14 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 227, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":225 + /* "View.MemoryView":226 * * @cname('get_memview') * cdef get_memview(self): # <<<<<<<<<<<<<< @@ -13821,7 +16033,7 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { return __pyx_r; } -/* "View.MemoryView":229 +/* "View.MemoryView":230 * return memoryview(self, flags, self.dtype_is_object) * * def __len__(self): # <<<<<<<<<<<<<< @@ -13847,7 +16059,7 @@ static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(str __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "View.MemoryView":230 + /* "View.MemoryView":231 * * def __len__(self): * return self._shape[0] # <<<<<<<<<<<<<< @@ -13857,7 +16069,7 @@ static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(str __pyx_r = (__pyx_v_self->_shape[0]); goto __pyx_L0; - /* "View.MemoryView":229 + /* "View.MemoryView":230 * return memoryview(self, flags, self.dtype_is_object) * * def __len__(self): # <<<<<<<<<<<<<< @@ -13871,7 +16083,7 @@ static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(str return __pyx_r; } -/* "View.MemoryView":232 +/* "View.MemoryView":233 * return self._shape[0] * * def __getattr__(self, attr): # <<<<<<<<<<<<<< @@ -13899,7 +16111,7 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__getattr__", 0); - /* "View.MemoryView":233 + /* "View.MemoryView":234 * * def __getattr__(self, attr): * return getattr(self.memview, attr) # <<<<<<<<<<<<<< @@ -13907,16 +16119,16 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( * 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_ERR(2, 233, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __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_ERR(2, 233, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __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; - /* "View.MemoryView":232 + /* "View.MemoryView":233 * return self._shape[0] * * def __getattr__(self, attr): # <<<<<<<<<<<<<< @@ -13936,7 +16148,7 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( return __pyx_r; } -/* "View.MemoryView":235 +/* "View.MemoryView":236 * return getattr(self.memview, attr) * * def __getitem__(self, item): # <<<<<<<<<<<<<< @@ -13964,7 +16176,7 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "View.MemoryView":236 + /* "View.MemoryView":237 * * def __getitem__(self, item): * return self.memview[item] # <<<<<<<<<<<<<< @@ -13972,16 +16184,16 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ * 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_ERR(2, 236, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 236, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __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; - /* "View.MemoryView":235 + /* "View.MemoryView":236 * return getattr(self.memview, attr) * * def __getitem__(self, item): # <<<<<<<<<<<<<< @@ -14001,7 +16213,7 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ return __pyx_r; } -/* "View.MemoryView":238 +/* "View.MemoryView":239 * return self.memview[item] * * def __setitem__(self, item, value): # <<<<<<<<<<<<<< @@ -14028,19 +16240,19 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struc PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "View.MemoryView":239 + /* "View.MemoryView":240 * * 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_ERR(2, 239, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 239, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":238 + /* "View.MemoryView":239 * return self.memview[item] * * def __setitem__(self, item, value): # <<<<<<<<<<<<<< @@ -14091,7 +16303,7 @@ static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __p * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __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; @@ -14144,7 +16356,7 @@ static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __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; @@ -14167,7 +16379,7 @@ static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct return __pyx_r; } -/* "View.MemoryView":243 +/* "View.MemoryView":244 * * @cname("__pyx_array_new") * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< @@ -14186,7 +16398,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("array_cwrapper", 0); - /* "View.MemoryView":247 + /* "View.MemoryView":248 * cdef array result * * if buf == NULL: # <<<<<<<<<<<<<< @@ -14196,20 +16408,20 @@ 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":248 + /* "View.MemoryView":249 * * 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_ERR(2, 248, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 248, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __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_ERR(2, 248, __pyx_L1_error) + __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_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 248, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_shape); __Pyx_GIVEREF(__pyx_v_shape); @@ -14223,13 +16435,13 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 248, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":247 + /* "View.MemoryView":248 * cdef array result * * if buf == NULL: # <<<<<<<<<<<<<< @@ -14239,7 +16451,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize goto __pyx_L3; } - /* "View.MemoryView":250 + /* "View.MemoryView":251 * result = array(shape, itemsize, format, mode.decode('ASCII')) * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< @@ -14247,13 +16459,13 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize * result.data = buf */ /*else*/ { - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __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_ERR(2, 250, __pyx_L1_error) + __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_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_shape); __Pyx_GIVEREF(__pyx_v_shape); @@ -14268,32 +16480,32 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_t_5 = 0; __pyx_t_3 = 0; - /* "View.MemoryView":251 + /* "View.MemoryView":252 * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), * allocate_buffer=False) # <<<<<<<<<<<<<< * result.data = buf * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 251, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error) - /* "View.MemoryView":250 + /* "View.MemoryView":251 * 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 *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __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":252 + /* "View.MemoryView":253 * result = array(shape, itemsize, format, mode.decode('ASCII'), * allocate_buffer=False) * result.data = buf # <<<<<<<<<<<<<< @@ -14304,7 +16516,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize } __pyx_L3:; - /* "View.MemoryView":254 + /* "View.MemoryView":255 * result.data = buf * * return result # <<<<<<<<<<<<<< @@ -14316,7 +16528,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "View.MemoryView":243 + /* "View.MemoryView":244 * * @cname("__pyx_array_new") * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< @@ -14339,7 +16551,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize return __pyx_r; } -/* "View.MemoryView":280 +/* "View.MemoryView":281 * cdef class Enum(object): * cdef object name * def __init__(self, name): # <<<<<<<<<<<<<< @@ -14373,7 +16585,7 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar 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_ERR(2, 280, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -14384,7 +16596,7 @@ 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_ERR(2, 280, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -14402,7 +16614,7 @@ static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "View.MemoryView":281 + /* "View.MemoryView":282 * cdef object name * def __init__(self, name): * self.name = name # <<<<<<<<<<<<<< @@ -14415,7 +16627,7 @@ static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struc __Pyx_DECREF(__pyx_v_self->name); __pyx_v_self->name = __pyx_v_name; - /* "View.MemoryView":280 + /* "View.MemoryView":281 * cdef class Enum(object): * cdef object name * def __init__(self, name): # <<<<<<<<<<<<<< @@ -14429,7 +16641,7 @@ static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struc return __pyx_r; } -/* "View.MemoryView":282 +/* "View.MemoryView":283 * def __init__(self, name): * self.name = name * def __repr__(self): # <<<<<<<<<<<<<< @@ -14455,7 +16667,7 @@ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); - /* "View.MemoryView":283 + /* "View.MemoryView":284 * self.name = name * def __repr__(self): * return self.name # <<<<<<<<<<<<<< @@ -14467,7 +16679,7 @@ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr_ __pyx_r = __pyx_v_self->name; goto __pyx_L0; - /* "View.MemoryView":282 + /* "View.MemoryView":283 * def __init__(self, name): * self.name = name * def __repr__(self): # <<<<<<<<<<<<<< @@ -14484,8 +16696,8 @@ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr_ /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef bint use_setstate - * state = (self.name,) + * cdef tuple state + * cdef object _dict */ /* Python wrapper */ @@ -14502,9 +16714,9 @@ static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v } static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; int __pyx_v_use_setstate; - PyObject *__pyx_v_state = NULL; - PyObject *__pyx_v__dict = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -14514,14 +16726,14 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "(tree fragment)":3 - * def __reduce_cython__(self): + /* "(tree fragment)":5 + * cdef object _dict * cdef bint use_setstate * state = (self.name,) # <<<<<<<<<<<<<< * _dict = getattr(self, '__dict__', None) * if _dict is not None: */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_self->name); __Pyx_GIVEREF(__pyx_v_self->name); @@ -14529,19 +16741,19 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __pyx_v_state = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":4 + /* "(tree fragment)":6 * cdef bint use_setstate * state = (self.name,) * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< * if _dict is not None: * state += (_dict,) */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v__dict = __pyx_t_1; __pyx_t_1 = 0; - /* "(tree fragment)":5 + /* "(tree fragment)":7 * state = (self.name,) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< @@ -14552,25 +16764,25 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "(tree fragment)":6 + /* "(tree fragment)":8 * _dict = getattr(self, '__dict__', None) * if _dict is not None: * state += (_dict,) # <<<<<<<<<<<<<< * use_setstate = True * else: */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v__dict); __Pyx_GIVEREF(__pyx_v__dict); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "(tree fragment)":7 + /* "(tree fragment)":9 * if _dict is not None: * state += (_dict,) * use_setstate = True # <<<<<<<<<<<<<< @@ -14579,7 +16791,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi */ __pyx_v_use_setstate = 1; - /* "(tree fragment)":5 + /* "(tree fragment)":7 * state = (self.name,) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< @@ -14589,7 +16801,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi goto __pyx_L3; } - /* "(tree fragment)":9 + /* "(tree fragment)":11 * use_setstate = True * else: * use_setstate = self.name is not None # <<<<<<<<<<<<<< @@ -14602,7 +16814,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi } __pyx_L3:; - /* "(tree fragment)":10 + /* "(tree fragment)":12 * else: * use_setstate = self.name is not None * if use_setstate: # <<<<<<<<<<<<<< @@ -14612,7 +16824,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __pyx_t_3 = (__pyx_v_use_setstate != 0); if (__pyx_t_3) { - /* "(tree fragment)":11 + /* "(tree fragment)":13 * use_setstate = self.name is not None * if use_setstate: * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< @@ -14620,9 +16832,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 11, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); @@ -14633,7 +16845,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); @@ -14648,7 +16860,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __pyx_t_5 = 0; goto __pyx_L0; - /* "(tree fragment)":10 + /* "(tree fragment)":12 * else: * use_setstate = self.name is not None * if use_setstate: # <<<<<<<<<<<<<< @@ -14657,7 +16869,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi */ } - /* "(tree fragment)":13 + /* "(tree fragment)":15 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< @@ -14666,9 +16878,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); @@ -14679,7 +16891,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); @@ -14694,8 +16906,8 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef bint use_setstate - * state = (self.name,) + * cdef tuple state + * cdef object _dict */ /* function exit code */ @@ -14713,7 +16925,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi return __pyx_r; } -/* "(tree fragment)":14 +/* "(tree fragment)":16 * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< @@ -14739,17 +16951,17 @@ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_Me PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "(tree fragment)":15 + /* "(tree fragment)":17 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 15, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":14 + /* "(tree fragment)":16 * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< @@ -14769,7 +16981,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_Me return __pyx_r; } -/* "View.MemoryView":297 +/* "View.MemoryView":298 * * @cname('__pyx_align_pointer') * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< @@ -14783,7 +16995,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) void *__pyx_r; int __pyx_t_1; - /* "View.MemoryView":299 + /* "View.MemoryView":300 * cdef void *align_pointer(void *memory, size_t alignment) nogil: * "Align pointer memory on a given boundary" * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< @@ -14792,7 +17004,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":303 + /* "View.MemoryView":304 * * with cython.cdivision(True): * offset = aligned_p % alignment # <<<<<<<<<<<<<< @@ -14801,7 +17013,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":305 + /* "View.MemoryView":306 * offset = aligned_p % alignment * * if offset > 0: # <<<<<<<<<<<<<< @@ -14811,7 +17023,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":306 + /* "View.MemoryView":307 * * if offset > 0: * aligned_p += alignment - offset # <<<<<<<<<<<<<< @@ -14820,7 +17032,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) */ __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); - /* "View.MemoryView":305 + /* "View.MemoryView":306 * offset = aligned_p % alignment * * if offset > 0: # <<<<<<<<<<<<<< @@ -14829,7 +17041,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) */ } - /* "View.MemoryView":308 + /* "View.MemoryView":309 * aligned_p += alignment - offset * * return aligned_p # <<<<<<<<<<<<<< @@ -14839,7 +17051,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) __pyx_r = ((void *)__pyx_v_aligned_p); goto __pyx_L0; - /* "View.MemoryView":297 + /* "View.MemoryView":298 * * @cname('__pyx_align_pointer') * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< @@ -14852,7 +17064,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) return __pyx_r; } -/* "View.MemoryView":344 +/* "View.MemoryView":345 * cdef __Pyx_TypeInfo *typeinfo * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< @@ -14894,7 +17106,7 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 344, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -14904,7 +17116,7 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 344, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -14917,16 +17129,16 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar } } __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 344, __pyx_L3_error) + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __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_ERR(2, 344, __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_ERR(2, 345, __pyx_L3_error) } else { __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_ERR(2, 344, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -14948,7 +17160,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ int __pyx_t_4; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "View.MemoryView":345 + /* "View.MemoryView":346 * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): * self.obj = obj # <<<<<<<<<<<<<< @@ -14961,7 +17173,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __Pyx_DECREF(__pyx_v_self->obj); __pyx_v_self->obj = __pyx_v_obj; - /* "View.MemoryView":346 + /* "View.MemoryView":347 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): * self.obj = obj * self.flags = flags # <<<<<<<<<<<<<< @@ -14970,7 +17182,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_v_self->flags = __pyx_v_flags; - /* "View.MemoryView":347 + /* "View.MemoryView":348 * self.obj = obj * self.flags = flags * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< @@ -14990,16 +17202,16 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "View.MemoryView":348 + /* "View.MemoryView":349 * 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 == ((int)-1))) __PYX_ERR(2, 348, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error) - /* "View.MemoryView":349 + /* "View.MemoryView":350 * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: # <<<<<<<<<<<<<< @@ -15009,7 +17221,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":350 + /* "View.MemoryView":351 * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< @@ -15018,7 +17230,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "View.MemoryView":351 + /* "View.MemoryView":352 * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -15027,7 +17239,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ Py_INCREF(Py_None); - /* "View.MemoryView":349 + /* "View.MemoryView":350 * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: # <<<<<<<<<<<<<< @@ -15036,7 +17248,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":347 + /* "View.MemoryView":348 * self.obj = obj * self.flags = flags * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< @@ -15045,7 +17257,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":354 + /* "View.MemoryView":355 * * global __pyx_memoryview_thread_locks_used * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< @@ -15055,7 +17267,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); if (__pyx_t_1) { - /* "View.MemoryView":355 + /* "View.MemoryView":356 * global __pyx_memoryview_thread_locks_used * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< @@ -15064,7 +17276,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - /* "View.MemoryView":356 + /* "View.MemoryView":357 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< @@ -15073,7 +17285,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - /* "View.MemoryView":354 + /* "View.MemoryView":355 * * global __pyx_memoryview_thread_locks_used * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< @@ -15082,7 +17294,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":357 + /* "View.MemoryView":358 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: # <<<<<<<<<<<<<< @@ -15092,7 +17304,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":358 + /* "View.MemoryView":359 * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< @@ -15101,7 +17313,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_v_self->lock = PyThread_allocate_lock(); - /* "View.MemoryView":359 + /* "View.MemoryView":360 * if self.lock is NULL: * self.lock = PyThread_allocate_lock() * if self.lock is NULL: # <<<<<<<<<<<<<< @@ -15111,16 +17323,16 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":360 + /* "View.MemoryView":361 * self.lock = PyThread_allocate_lock() * if self.lock is NULL: * raise MemoryError # <<<<<<<<<<<<<< * * if flags & PyBUF_FORMAT: */ - PyErr_NoMemory(); __PYX_ERR(2, 360, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error) - /* "View.MemoryView":359 + /* "View.MemoryView":360 * if self.lock is NULL: * self.lock = PyThread_allocate_lock() * if self.lock is NULL: # <<<<<<<<<<<<<< @@ -15129,7 +17341,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":357 + /* "View.MemoryView":358 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: # <<<<<<<<<<<<<< @@ -15138,7 +17350,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":362 + /* "View.MemoryView":363 * raise MemoryError * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -15148,7 +17360,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":363 + /* "View.MemoryView":364 * * if flags & PyBUF_FORMAT: * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< @@ -15166,7 +17378,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_L11_bool_binop_done:; __pyx_v_self->dtype_is_object = __pyx_t_1; - /* "View.MemoryView":362 + /* "View.MemoryView":363 * raise MemoryError * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -15176,7 +17388,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ goto __pyx_L10; } - /* "View.MemoryView":365 + /* "View.MemoryView":366 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') * else: * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< @@ -15188,7 +17400,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ } __pyx_L10:; - /* "View.MemoryView":367 + /* "View.MemoryView":368 * self.dtype_is_object = dtype_is_object * * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< @@ -15197,7 +17409,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __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":369 + /* "View.MemoryView":370 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) * self.typeinfo = NULL # <<<<<<<<<<<<<< @@ -15206,7 +17418,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_v_self->typeinfo = NULL; - /* "View.MemoryView":344 + /* "View.MemoryView":345 * cdef __Pyx_TypeInfo *typeinfo * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< @@ -15225,7 +17437,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ return __pyx_r; } -/* "View.MemoryView":371 +/* "View.MemoryView":372 * self.typeinfo = NULL * * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< @@ -15256,36 +17468,75 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal PyThread_type_lock __pyx_t_7; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":372 + /* "View.MemoryView":373 * * def __dealloc__(memoryview self): * if self.obj is not None: # <<<<<<<<<<<<<< * __Pyx_ReleaseBuffer(&self.view) - * + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ __pyx_t_1 = (__pyx_v_self->obj != Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":373 + /* "View.MemoryView":374 * def __dealloc__(memoryview self): * if self.obj is not None: * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: * - * cdef int i */ __Pyx_ReleaseBuffer((&__pyx_v_self->view)); - /* "View.MemoryView":372 + /* "View.MemoryView":373 * * def __dealloc__(memoryview self): * if self.obj is not None: # <<<<<<<<<<<<<< * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + */ + goto __pyx_L3; + } + + /* "View.MemoryView":375 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL + */ + __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":377 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * + */ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":378 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i + */ + Py_DECREF(Py_None); + + /* "View.MemoryView":375 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * + * (<__pyx_buffer *> &self.view).obj = NULL */ } + __pyx_L3:; - /* "View.MemoryView":377 + /* "View.MemoryView":382 * cdef int i * global __pyx_memoryview_thread_locks_used * if self.lock != NULL: # <<<<<<<<<<<<<< @@ -15295,7 +17546,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); if (__pyx_t_2) { - /* "View.MemoryView":378 + /* "View.MemoryView":383 * global __pyx_memoryview_thread_locks_used * if self.lock != NULL: * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< @@ -15307,7 +17558,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":379 + /* "View.MemoryView":384 * if self.lock != NULL: * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< @@ -15317,7 +17568,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); if (__pyx_t_2) { - /* "View.MemoryView":380 + /* "View.MemoryView":385 * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< @@ -15326,7 +17577,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal */ __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - /* "View.MemoryView":381 + /* "View.MemoryView":386 * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< @@ -15336,7 +17587,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0); if (__pyx_t_2) { - /* "View.MemoryView":383 + /* "View.MemoryView":388 * if i != __pyx_memoryview_thread_locks_used: * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< @@ -15346,7 +17597,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - /* "View.MemoryView":382 + /* "View.MemoryView":387 * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< @@ -15356,7 +17607,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6; (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7; - /* "View.MemoryView":381 + /* "View.MemoryView":386 * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< @@ -15365,7 +17616,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal */ } - /* "View.MemoryView":384 + /* "View.MemoryView":389 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) * break # <<<<<<<<<<<<<< @@ -15374,7 +17625,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal */ goto __pyx_L6_break; - /* "View.MemoryView":379 + /* "View.MemoryView":384 * if self.lock != NULL: * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< @@ -15385,7 +17636,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal } /*else*/ { - /* "View.MemoryView":386 + /* "View.MemoryView":391 * break * else: * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< @@ -15396,7 +17647,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal } __pyx_L6_break:; - /* "View.MemoryView":377 + /* "View.MemoryView":382 * cdef int i * global __pyx_memoryview_thread_locks_used * if self.lock != NULL: # <<<<<<<<<<<<<< @@ -15405,7 +17656,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal */ } - /* "View.MemoryView":371 + /* "View.MemoryView":372 * self.typeinfo = NULL * * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< @@ -15417,7 +17668,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":388 +/* "View.MemoryView":393 * PyThread_free_lock(self.lock) * * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< @@ -15440,7 +17691,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py char *__pyx_t_7; __Pyx_RefNannySetupContext("get_item_pointer", 0); - /* "View.MemoryView":390 + /* "View.MemoryView":395 * cdef char *get_item_pointer(memoryview self, object index) except NULL: * cdef Py_ssize_t dim * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< @@ -15449,7 +17700,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py */ __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - /* "View.MemoryView":392 + /* "View.MemoryView":397 * cdef char *itemp = self.view.buf * * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< @@ -15461,26 +17712,26 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py __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_ERR(2, 392, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 392, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error) } for (;;) { 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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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_ERR(2, 392, __pyx_L1_error) + __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_ERR(2, 397, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 392, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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_ERR(2, 392, __pyx_L1_error) + __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_ERR(2, 397, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 392, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -15490,7 +17741,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 392, __pyx_L1_error) + else __PYX_ERR(2, 397, __pyx_L1_error) } break; } @@ -15501,18 +17752,18 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py __pyx_v_dim = __pyx_t_1; __pyx_t_1 = (__pyx_t_1 + 1); - /* "View.MemoryView":393 + /* "View.MemoryView":398 * * 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_ERR(2, 393, __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 == ((char *)NULL))) __PYX_ERR(2, 393, __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_ERR(2, 398, __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 == ((char *)NULL))) __PYX_ERR(2, 398, __pyx_L1_error) __pyx_v_itemp = __pyx_t_7; - /* "View.MemoryView":392 + /* "View.MemoryView":397 * cdef char *itemp = self.view.buf * * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< @@ -15522,7 +17773,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":395 + /* "View.MemoryView":400 * itemp = pybuffer_index(&self.view, itemp, idx, dim) * * return itemp # <<<<<<<<<<<<<< @@ -15532,7 +17783,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py __pyx_r = __pyx_v_itemp; goto __pyx_L0; - /* "View.MemoryView":388 + /* "View.MemoryView":393 * PyThread_free_lock(self.lock) * * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< @@ -15552,7 +17803,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py return __pyx_r; } -/* "View.MemoryView":398 +/* "View.MemoryView":403 * * * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< @@ -15587,7 +17838,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ char *__pyx_t_6; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "View.MemoryView":399 + /* "View.MemoryView":404 * * def __getitem__(memoryview self, object index): * if index is Ellipsis: # <<<<<<<<<<<<<< @@ -15598,7 +17849,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":400 + /* "View.MemoryView":405 * def __getitem__(memoryview self, object index): * if index is Ellipsis: * return self # <<<<<<<<<<<<<< @@ -15610,7 +17861,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "View.MemoryView":399 + /* "View.MemoryView":404 * * def __getitem__(memoryview self, object index): * if index is Ellipsis: # <<<<<<<<<<<<<< @@ -15619,14 +17870,14 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ */ } - /* "View.MemoryView":402 + /* "View.MemoryView":407 * return self * * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * * cdef char *itemp */ - __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 402, __pyx_L1_error) + __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (likely(__pyx_t_3 != Py_None)) { PyObject* sequence = __pyx_t_3; @@ -15634,7 +17885,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 402, __pyx_L1_error) + __PYX_ERR(2, 407, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); @@ -15642,31 +17893,31 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 402, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 402, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 402, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __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":405 + /* "View.MemoryView":410 * * 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_ERR(2, 405, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error) if (__pyx_t_2) { - /* "View.MemoryView":406 + /* "View.MemoryView":411 * cdef char *itemp * if have_slices: * return memview_slice(self, indices) # <<<<<<<<<<<<<< @@ -15674,13 +17925,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ * 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_ERR(2, 406, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "View.MemoryView":405 + /* "View.MemoryView":410 * * cdef char *itemp * if have_slices: # <<<<<<<<<<<<<< @@ -15689,7 +17940,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ */ } - /* "View.MemoryView":408 + /* "View.MemoryView":413 * return memview_slice(self, indices) * else: * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< @@ -15697,10 +17948,10 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ * */ /*else*/ { - __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 == ((char *)NULL))) __PYX_ERR(2, 408, __pyx_L1_error) + __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 == ((char *)NULL))) __PYX_ERR(2, 413, __pyx_L1_error) __pyx_v_itemp = __pyx_t_6; - /* "View.MemoryView":409 + /* "View.MemoryView":414 * else: * itemp = self.get_item_pointer(indices) * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< @@ -15708,14 +17959,14 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ * 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_ERR(2, 409, __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_ERR(2, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; } - /* "View.MemoryView":398 + /* "View.MemoryView":403 * * * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< @@ -15738,7 +17989,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ return __pyx_r; } -/* "View.MemoryView":411 +/* "View.MemoryView":416 * return self.convert_item_to_object(itemp) * * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< @@ -15771,7 +18022,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit __Pyx_RefNannySetupContext("__setitem__", 0); __Pyx_INCREF(__pyx_v_index); - /* "View.MemoryView":412 + /* "View.MemoryView":417 * * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: # <<<<<<<<<<<<<< @@ -15781,20 +18032,20 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit __pyx_t_1 = (__pyx_v_self->view.readonly != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":413 + /* "View.MemoryView":418 * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< * * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 413, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __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_ERR(2, 413, __pyx_L1_error) + __PYX_ERR(2, 418, __pyx_L1_error) - /* "View.MemoryView":412 + /* "View.MemoryView":417 * * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: # <<<<<<<<<<<<<< @@ -15803,14 +18054,14 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit */ } - /* "View.MemoryView":415 + /* "View.MemoryView":420 * raise TypeError("Cannot assign to read-only memoryview") * * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * * if have_slices: */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 415, __pyx_L1_error) + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(__pyx_t_2 != Py_None)) { PyObject* sequence = __pyx_t_2; @@ -15818,7 +18069,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 415, __pyx_L1_error) + __PYX_ERR(2, 420, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); @@ -15826,67 +18077,67 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 415, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 415, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 415, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error) } __pyx_v_have_slices = __pyx_t_3; __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":417 + /* "View.MemoryView":422 * have_slices, index = _unellipsify(index, self.view.ndim) * * if have_slices: # <<<<<<<<<<<<<< * obj = self.is_slice(value) * if obj: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 417, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error) if (__pyx_t_1) { - /* "View.MemoryView":418 + /* "View.MemoryView":423 * * if have_slices: * obj = self.is_slice(value) # <<<<<<<<<<<<<< * if obj: * self.setitem_slice_assignment(self[index], obj) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":419 + /* "View.MemoryView":424 * if have_slices: * obj = self.is_slice(value) * if obj: # <<<<<<<<<<<<<< * self.setitem_slice_assignment(self[index], obj) * else: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 419, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error) if (__pyx_t_1) { - /* "View.MemoryView":420 + /* "View.MemoryView":425 * 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_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":419 + /* "View.MemoryView":424 * if have_slices: * obj = self.is_slice(value) * if obj: # <<<<<<<<<<<<<< @@ -15896,7 +18147,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit goto __pyx_L5; } - /* "View.MemoryView":422 + /* "View.MemoryView":427 * self.setitem_slice_assignment(self[index], obj) * else: * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< @@ -15904,17 +18155,17 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit * self.setitem_indexed(index, value) */ /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 422, __pyx_L1_error) - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error) + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L5:; - /* "View.MemoryView":417 + /* "View.MemoryView":422 * have_slices, index = _unellipsify(index, self.view.ndim) * * if have_slices: # <<<<<<<<<<<<<< @@ -15924,7 +18175,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit goto __pyx_L4; } - /* "View.MemoryView":424 + /* "View.MemoryView":429 * self.setitem_slice_assign_scalar(self[index], value) * else: * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< @@ -15932,13 +18183,13 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit * cdef is_slice(self, obj): */ /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 424, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L4:; - /* "View.MemoryView":411 + /* "View.MemoryView":416 * return self.convert_item_to_object(itemp) * * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< @@ -15963,7 +18214,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit return __pyx_r; } -/* "View.MemoryView":426 +/* "View.MemoryView":431 * self.setitem_indexed(index, value) * * cdef is_slice(self, obj): # <<<<<<<<<<<<<< @@ -15986,22 +18237,22 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_RefNannySetupContext("is_slice", 0); __Pyx_INCREF(__pyx_v_obj); - /* "View.MemoryView":427 + /* "View.MemoryView":432 * * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":428 + /* "View.MemoryView":433 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) */ { @@ -16013,34 +18264,34 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { - /* "View.MemoryView":429 + /* "View.MemoryView":434 * if not isinstance(obj, memoryview): * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< * self.dtype_is_object) * except TypeError: */ - __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 429, __pyx_L4_error) + __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); - /* "View.MemoryView":430 + /* "View.MemoryView":435 * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | 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_ERR(2, 430, __pyx_L4_error) + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); - /* "View.MemoryView":429 + /* "View.MemoryView":434 * if not isinstance(obj, memoryview): * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< * self.dtype_is_object) * except TypeError: */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 429, __pyx_L4_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_obj); __Pyx_GIVEREF(__pyx_v_obj); @@ -16051,17 +18302,17 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 429, __pyx_L4_error) + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error) __Pyx_GOTREF(__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; - /* "View.MemoryView":428 + /* "View.MemoryView":433 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) */ } @@ -16071,11 +18322,11 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ goto __pyx_L9_try_end; __pyx_L4_error:; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "View.MemoryView":431 - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + /* "View.MemoryView":436 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) * except TypeError: # <<<<<<<<<<<<<< * return None @@ -16084,12 +18335,12 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_t_9 = __Pyx_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_ERR(2, 431, __pyx_L6_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_6); - /* "View.MemoryView":432 + /* "View.MemoryView":437 * self.dtype_is_object) * except TypeError: * return None # <<<<<<<<<<<<<< @@ -16106,11 +18357,11 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ goto __pyx_L6_except_error; __pyx_L6_except_error:; - /* "View.MemoryView":428 + /* "View.MemoryView":433 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) */ __Pyx_XGIVEREF(__pyx_t_3); @@ -16127,16 +18378,16 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_L9_try_end:; } - /* "View.MemoryView":427 + /* "View.MemoryView":432 * * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ } - /* "View.MemoryView":434 + /* "View.MemoryView":439 * return None * * return obj # <<<<<<<<<<<<<< @@ -16148,7 +18399,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_r = __pyx_v_obj; goto __pyx_L0; - /* "View.MemoryView":426 + /* "View.MemoryView":431 * self.setitem_indexed(index, value) * * cdef is_slice(self, obj): # <<<<<<<<<<<<<< @@ -16170,7 +18421,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ return __pyx_r; } -/* "View.MemoryView":436 +/* "View.MemoryView":441 * return obj * * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< @@ -16189,50 +18440,50 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi int __pyx_t_4; __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - /* "View.MemoryView":440 + /* "View.MemoryView":445 * 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_ERR(2, 440, __pyx_L1_error) + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error) - /* "View.MemoryView":441 + /* "View.MemoryView":446 * * 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_ERR(2, 441, __pyx_L1_error) + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error) - /* "View.MemoryView":442 + /* "View.MemoryView":447 * 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_ERR(2, 442, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 442, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __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_ERR(2, 442, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 442, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":440 + /* "View.MemoryView":445 * 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 == ((int)-1))) __PYX_ERR(2, 440, __pyx_L1_error) + __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 == ((int)-1))) __PYX_ERR(2, 445, __pyx_L1_error) - /* "View.MemoryView":436 + /* "View.MemoryView":441 * return obj * * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< @@ -16253,7 +18504,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi return __pyx_r; } -/* "View.MemoryView":444 +/* "View.MemoryView":449 * src.ndim, dst.ndim, self.dtype_is_object) * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< @@ -16282,7 +18533,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor PyObject *__pyx_t_11 = NULL; __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - /* "View.MemoryView":446 + /* "View.MemoryView":451 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): * cdef int array[128] * cdef void *tmp = NULL # <<<<<<<<<<<<<< @@ -16291,7 +18542,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_tmp = NULL; - /* "View.MemoryView":451 + /* "View.MemoryView":456 * cdef __Pyx_memviewslice *dst_slice * cdef __Pyx_memviewslice tmp_slice * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< @@ -16300,7 +18551,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); - /* "View.MemoryView":453 + /* "View.MemoryView":458 * dst_slice = get_slice_from_memview(dst, &tmp_slice) * * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< @@ -16310,7 +18561,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); if (__pyx_t_1) { - /* "View.MemoryView":454 + /* "View.MemoryView":459 * * if self.view.itemsize > sizeof(array): * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< @@ -16319,7 +18570,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - /* "View.MemoryView":455 + /* "View.MemoryView":460 * if self.view.itemsize > sizeof(array): * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: # <<<<<<<<<<<<<< @@ -16329,16 +18580,16 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":456 + /* "View.MemoryView":461 * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: * raise MemoryError # <<<<<<<<<<<<<< * item = tmp * else: */ - PyErr_NoMemory(); __PYX_ERR(2, 456, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error) - /* "View.MemoryView":455 + /* "View.MemoryView":460 * if self.view.itemsize > sizeof(array): * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: # <<<<<<<<<<<<<< @@ -16347,7 +18598,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ } - /* "View.MemoryView":457 + /* "View.MemoryView":462 * if tmp == NULL: * raise MemoryError * item = tmp # <<<<<<<<<<<<<< @@ -16356,7 +18607,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_item = __pyx_v_tmp; - /* "View.MemoryView":453 + /* "View.MemoryView":458 * dst_slice = get_slice_from_memview(dst, &tmp_slice) * * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< @@ -16366,7 +18617,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor goto __pyx_L3; } - /* "View.MemoryView":459 + /* "View.MemoryView":464 * item = tmp * else: * item = array # <<<<<<<<<<<<<< @@ -16378,7 +18629,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor } __pyx_L3:; - /* "View.MemoryView":461 + /* "View.MemoryView":466 * item = array * * try: # <<<<<<<<<<<<<< @@ -16387,7 +18638,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ /*try:*/ { - /* "View.MemoryView":462 + /* "View.MemoryView":467 * * try: * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -16397,7 +18648,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":463 + /* "View.MemoryView":468 * try: * if self.dtype_is_object: * ( item)[0] = value # <<<<<<<<<<<<<< @@ -16406,7 +18657,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - /* "View.MemoryView":462 + /* "View.MemoryView":467 * * try: * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -16416,7 +18667,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor goto __pyx_L8; } - /* "View.MemoryView":465 + /* "View.MemoryView":470 * ( item)[0] = value * else: * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< @@ -16424,13 +18675,13 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor * */ /*else*/ { - __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_ERR(2, 465, __pyx_L6_error) + __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_ERR(2, 470, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L8:; - /* "View.MemoryView":469 + /* "View.MemoryView":474 * * * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -16440,18 +18691,18 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":470 + /* "View.MemoryView":475 * * 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_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 470, __pyx_L6_error) + __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 475, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":469 + /* "View.MemoryView":474 * * * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -16460,7 +18711,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ } - /* "View.MemoryView":471 + /* "View.MemoryView":476 * 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, # <<<<<<<<<<<<<< @@ -16470,7 +18721,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } - /* "View.MemoryView":474 + /* "View.MemoryView":479 * item, self.dtype_is_object) * finally: * PyMem_Free(tmp) # <<<<<<<<<<<<<< @@ -16517,7 +18768,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_L7:; } - /* "View.MemoryView":444 + /* "View.MemoryView":449 * src.ndim, dst.ndim, self.dtype_is_object) * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< @@ -16538,7 +18789,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor return __pyx_r; } -/* "View.MemoryView":476 +/* "View.MemoryView":481 * PyMem_Free(tmp) * * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< @@ -16554,28 +18805,28 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("setitem_indexed", 0); - /* "View.MemoryView":477 + /* "View.MemoryView":482 * * 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 == ((char *)NULL))) __PYX_ERR(2, 477, __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 == ((char *)NULL))) __PYX_ERR(2, 482, __pyx_L1_error) __pyx_v_itemp = __pyx_t_1; - /* "View.MemoryView":478 + /* "View.MemoryView":483 * 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_ERR(2, 478, __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_ERR(2, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":476 + /* "View.MemoryView":481 * PyMem_Free(tmp) * * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< @@ -16596,7 +18847,7 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ return __pyx_r; } -/* "View.MemoryView":480 +/* "View.MemoryView":485 * self.assign_item_from_object(itemp, value) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -16623,31 +18874,31 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview int __pyx_t_11; __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "View.MemoryView":483 + /* "View.MemoryView":488 * """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(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 483, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":486 + /* "View.MemoryView":491 * 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_ERR(2, 486, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":487 + /* "View.MemoryView":492 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< @@ -16663,16 +18914,16 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __Pyx_XGOTREF(__pyx_t_4); /*try:*/ { - /* "View.MemoryView":488 + /* "View.MemoryView":493 * 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_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -16689,7 +18940,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -16698,14 +18949,14 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; @@ -16716,7 +18967,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __Pyx_GIVEREF(__pyx_v_bytesitem); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __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_ERR(2, 488, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } @@ -16724,7 +18975,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":487 + /* "View.MemoryView":492 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< @@ -16733,7 +18984,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview */ } - /* "View.MemoryView":492 + /* "View.MemoryView":497 * raise ValueError("Unable to convert item to object") * else: * if len(self.view.format) == 1: # <<<<<<<<<<<<<< @@ -16745,7 +18996,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __pyx_t_11 = ((__pyx_t_10 == 1) != 0); if (__pyx_t_11) { - /* "View.MemoryView":493 + /* "View.MemoryView":498 * else: * if len(self.view.format) == 1: * return result[0] # <<<<<<<<<<<<<< @@ -16753,13 +19004,13 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L5_except_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 498, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L6_except_return; - /* "View.MemoryView":492 + /* "View.MemoryView":497 * raise ValueError("Unable to convert item to object") * else: * if len(self.view.format) == 1: # <<<<<<<<<<<<<< @@ -16768,7 +19019,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview */ } - /* "View.MemoryView":494 + /* "View.MemoryView":499 * if len(self.view.format) == 1: * return result[0] * return result # <<<<<<<<<<<<<< @@ -16781,13 +19032,13 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview goto __pyx_L6_except_return; } __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 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":489 + /* "View.MemoryView":494 * try: * result = struct.unpack(self.view.format, bytesitem) * except struct.error: # <<<<<<<<<<<<<< @@ -16795,7 +19046,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview * else: */ __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 489, __pyx_L5_except_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -16803,28 +19054,28 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; if (__pyx_t_8) { __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 489, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_1); - /* "View.MemoryView":490 + /* "View.MemoryView":495 * 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_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 490, __pyx_L5_except_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __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_ERR(2, 490, __pyx_L5_except_error) + __PYX_ERR(2, 495, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "View.MemoryView":487 + /* "View.MemoryView":492 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< @@ -16844,7 +19095,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview goto __pyx_L0; } - /* "View.MemoryView":480 + /* "View.MemoryView":485 * self.assign_item_from_object(itemp, value) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -16870,7 +19121,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview return __pyx_r; } -/* "View.MemoryView":496 +/* "View.MemoryView":501 * return result * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -16901,19 +19152,19 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie char *__pyx_t_14; __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":499 + /* "View.MemoryView":504 * """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(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 499, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":504 + /* "View.MemoryView":509 * cdef Py_ssize_t i * * if isinstance(value, tuple): # <<<<<<<<<<<<<< @@ -16924,37 +19175,37 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "View.MemoryView":505 + /* "View.MemoryView":510 * * 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_ERR(2, 505, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __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_ERR(2, 505, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 505, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 505, __pyx_L1_error) + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __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_ERR(2, 505, __pyx_L1_error) + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __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_ERR(2, 505, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_ERR(2, 505, __pyx_L1_error) + 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_ERR(2, 510, __pyx_L1_error) __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":504 + /* "View.MemoryView":509 * cdef Py_ssize_t i * * if isinstance(value, tuple): # <<<<<<<<<<<<<< @@ -16964,7 +19215,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie goto __pyx_L3; } - /* "View.MemoryView":507 + /* "View.MemoryView":512 * bytesvalue = struct.pack(self.view.format, *value) * else: * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< @@ -16972,9 +19223,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie * for i, c in enumerate(bytesvalue): */ /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __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_ERR(2, 507, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; __pyx_t_7 = 0; @@ -16991,7 +19242,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17000,14 +19251,14 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; @@ -17018,18 +19269,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __Pyx_GIVEREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __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_ERR(2, 507, __pyx_L1_error) + 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_ERR(2, 512, __pyx_L1_error) __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; } __pyx_L3:; - /* "View.MemoryView":509 + /* "View.MemoryView":514 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< @@ -17039,7 +19290,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __pyx_t_9 = 0; if (unlikely(__pyx_v_bytesvalue == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(2, 509, __pyx_L1_error) + __PYX_ERR(2, 514, __pyx_L1_error) } __Pyx_INCREF(__pyx_v_bytesvalue); __pyx_t_10 = __pyx_v_bytesvalue; @@ -17049,7 +19300,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __pyx_t_11 = __pyx_t_14; __pyx_v_c = (__pyx_t_11[0]); - /* "View.MemoryView":510 + /* "View.MemoryView":515 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< @@ -17058,7 +19309,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ __pyx_v_i = __pyx_t_9; - /* "View.MemoryView":509 + /* "View.MemoryView":514 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< @@ -17067,7 +19318,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ __pyx_t_9 = (__pyx_t_9 + 1); - /* "View.MemoryView":510 + /* "View.MemoryView":515 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< @@ -17078,7 +19329,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "View.MemoryView":496 + /* "View.MemoryView":501 * return result * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -17106,7 +19357,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie return __pyx_r; } -/* "View.MemoryView":513 +/* "View.MemoryView":518 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< @@ -17146,7 +19397,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "View.MemoryView":514 + /* "View.MemoryView":519 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< @@ -17164,20 +19415,20 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":515 + /* "View.MemoryView":520 * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: + * if flags & PyBUF_ND: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 515, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __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_ERR(2, 515, __pyx_L1_error) + __PYX_ERR(2, 520, __pyx_L1_error) - /* "View.MemoryView":514 + /* "View.MemoryView":519 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< @@ -17186,19 +19437,19 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu */ } - /* "View.MemoryView":517 + /* "View.MemoryView":522 * raise ValueError("Cannot create writable memory view from read-only memoryview") * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< * info.shape = self.view.shape * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); if (__pyx_t_1) { - /* "View.MemoryView":518 + /* "View.MemoryView":523 * - * if flags & PyBUF_STRIDES: + * if flags & PyBUF_ND: * info.shape = self.view.shape # <<<<<<<<<<<<<< * else: * info.shape = NULL @@ -17206,17 +19457,17 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_4 = __pyx_v_self->view.shape; __pyx_v_info->shape = __pyx_t_4; - /* "View.MemoryView":517 + /* "View.MemoryView":522 * raise ValueError("Cannot create writable memory view from read-only memoryview") * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< * info.shape = self.view.shape * else: */ goto __pyx_L6; } - /* "View.MemoryView":520 + /* "View.MemoryView":525 * info.shape = self.view.shape * else: * info.shape = NULL # <<<<<<<<<<<<<< @@ -17228,7 +19479,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu } __pyx_L6:; - /* "View.MemoryView":522 + /* "View.MemoryView":527 * info.shape = NULL * * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< @@ -17238,7 +19489,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); if (__pyx_t_1) { - /* "View.MemoryView":523 + /* "View.MemoryView":528 * * if flags & PyBUF_STRIDES: * info.strides = self.view.strides # <<<<<<<<<<<<<< @@ -17248,7 +19499,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_4 = __pyx_v_self->view.strides; __pyx_v_info->strides = __pyx_t_4; - /* "View.MemoryView":522 + /* "View.MemoryView":527 * info.shape = NULL * * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< @@ -17258,7 +19509,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu goto __pyx_L7; } - /* "View.MemoryView":525 + /* "View.MemoryView":530 * info.strides = self.view.strides * else: * info.strides = NULL # <<<<<<<<<<<<<< @@ -17270,7 +19521,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu } __pyx_L7:; - /* "View.MemoryView":527 + /* "View.MemoryView":532 * info.strides = NULL * * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< @@ -17280,7 +19531,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":528 + /* "View.MemoryView":533 * * if flags & PyBUF_INDIRECT: * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< @@ -17290,7 +19541,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_4 = __pyx_v_self->view.suboffsets; __pyx_v_info->suboffsets = __pyx_t_4; - /* "View.MemoryView":527 + /* "View.MemoryView":532 * info.strides = NULL * * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< @@ -17300,7 +19551,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu goto __pyx_L8; } - /* "View.MemoryView":530 + /* "View.MemoryView":535 * info.suboffsets = self.view.suboffsets * else: * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -17312,7 +19563,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu } __pyx_L8:; - /* "View.MemoryView":532 + /* "View.MemoryView":537 * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -17322,7 +19573,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":533 + /* "View.MemoryView":538 * * if flags & PyBUF_FORMAT: * info.format = self.view.format # <<<<<<<<<<<<<< @@ -17332,7 +19583,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_5 = __pyx_v_self->view.format; __pyx_v_info->format = __pyx_t_5; - /* "View.MemoryView":532 + /* "View.MemoryView":537 * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -17342,7 +19593,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu goto __pyx_L9; } - /* "View.MemoryView":535 + /* "View.MemoryView":540 * info.format = self.view.format * else: * info.format = NULL # <<<<<<<<<<<<<< @@ -17354,7 +19605,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu } __pyx_L9:; - /* "View.MemoryView":537 + /* "View.MemoryView":542 * info.format = NULL * * info.buf = self.view.buf # <<<<<<<<<<<<<< @@ -17364,7 +19615,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_6 = __pyx_v_self->view.buf; __pyx_v_info->buf = __pyx_t_6; - /* "View.MemoryView":538 + /* "View.MemoryView":543 * * info.buf = self.view.buf * info.ndim = self.view.ndim # <<<<<<<<<<<<<< @@ -17374,7 +19625,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_7 = __pyx_v_self->view.ndim; __pyx_v_info->ndim = __pyx_t_7; - /* "View.MemoryView":539 + /* "View.MemoryView":544 * info.buf = self.view.buf * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< @@ -17384,7 +19635,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_8 = __pyx_v_self->view.itemsize; __pyx_v_info->itemsize = __pyx_t_8; - /* "View.MemoryView":540 + /* "View.MemoryView":545 * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize * info.len = self.view.len # <<<<<<<<<<<<<< @@ -17394,7 +19645,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_8 = __pyx_v_self->view.len; __pyx_v_info->len = __pyx_t_8; - /* "View.MemoryView":541 + /* "View.MemoryView":546 * info.itemsize = self.view.itemsize * info.len = self.view.len * info.readonly = self.view.readonly # <<<<<<<<<<<<<< @@ -17404,7 +19655,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_1 = __pyx_v_self->view.readonly; __pyx_v_info->readonly = __pyx_t_1; - /* "View.MemoryView":542 + /* "View.MemoryView":547 * info.len = self.view.len * info.readonly = self.view.readonly * info.obj = self # <<<<<<<<<<<<<< @@ -17417,7 +19668,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "View.MemoryView":513 + /* "View.MemoryView":518 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< @@ -17447,7 +19698,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu return __pyx_r; } -/* "View.MemoryView":548 +/* "View.MemoryView":553 * * @property * def T(self): # <<<<<<<<<<<<<< @@ -17476,29 +19727,29 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct _ int __pyx_t_2; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":549 + /* "View.MemoryView":554 * @property * def T(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_ERR(2, 549, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __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_ERR(2, 549, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error) __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":550 + /* "View.MemoryView":555 * def T(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 == ((int)0))) __PYX_ERR(2, 550, __pyx_L1_error) + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error) - /* "View.MemoryView":551 + /* "View.MemoryView":556 * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) * return result # <<<<<<<<<<<<<< @@ -17510,7 +19761,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct _ __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "View.MemoryView":548 + /* "View.MemoryView":553 * * @property * def T(self): # <<<<<<<<<<<<<< @@ -17530,7 +19781,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct _ return __pyx_r; } -/* "View.MemoryView":554 +/* "View.MemoryView":559 * * @property * def base(self): # <<<<<<<<<<<<<< @@ -17556,7 +19807,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":555 + /* "View.MemoryView":560 * @property * def base(self): * return self.obj # <<<<<<<<<<<<<< @@ -17568,7 +19819,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struc __pyx_r = __pyx_v_self->obj; goto __pyx_L0; - /* "View.MemoryView":554 + /* "View.MemoryView":559 * * @property * def base(self): # <<<<<<<<<<<<<< @@ -17583,7 +19834,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struc return __pyx_r; } -/* "View.MemoryView":558 +/* "View.MemoryView":563 * * @property * def shape(self): # <<<<<<<<<<<<<< @@ -17615,7 +19866,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(stru PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":559 + /* "View.MemoryView":564 * @property * def shape(self): * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< @@ -17623,25 +19874,25 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(stru * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 559, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { __pyx_t_2 = __pyx_t_4; __pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 559, __pyx_L1_error) + __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 559, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 559, __pyx_L1_error) + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "View.MemoryView":558 + /* "View.MemoryView":563 * * @property * def shape(self): # <<<<<<<<<<<<<< @@ -17661,7 +19912,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(stru return __pyx_r; } -/* "View.MemoryView":562 +/* "View.MemoryView":567 * * @property * def strides(self): # <<<<<<<<<<<<<< @@ -17694,7 +19945,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":563 + /* "View.MemoryView":568 * @property * def strides(self): * if self.view.strides == NULL: # <<<<<<<<<<<<<< @@ -17704,20 +19955,20 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":565 + /* "View.MemoryView":570 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 565, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __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_ERR(2, 565, __pyx_L1_error) + __PYX_ERR(2, 570, __pyx_L1_error) - /* "View.MemoryView":563 + /* "View.MemoryView":568 * @property * def strides(self): * if self.view.strides == NULL: # <<<<<<<<<<<<<< @@ -17726,7 +19977,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st */ } - /* "View.MemoryView":567 + /* "View.MemoryView":572 * raise ValueError("Buffer view does not expose strides") * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< @@ -17734,25 +19985,25 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 567, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { __pyx_t_3 = __pyx_t_5; __pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 567, __pyx_L1_error) + __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 567, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 567, __pyx_L1_error) + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - /* "View.MemoryView":562 + /* "View.MemoryView":567 * * @property * def strides(self): # <<<<<<<<<<<<<< @@ -17772,7 +20023,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st return __pyx_r; } -/* "View.MemoryView":570 +/* "View.MemoryView":575 * * @property * def suboffsets(self): # <<<<<<<<<<<<<< @@ -17805,7 +20056,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ Py_ssize_t *__pyx_t_6; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":571 + /* "View.MemoryView":576 * @property * def suboffsets(self): * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< @@ -17815,7 +20066,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":572 + /* "View.MemoryView":577 * def suboffsets(self): * if self.view.suboffsets == NULL: * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< @@ -17823,16 +20074,16 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__22, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__19, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __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; - /* "View.MemoryView":571 + /* "View.MemoryView":576 * @property * def suboffsets(self): * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< @@ -17841,7 +20092,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ */ } - /* "View.MemoryView":574 + /* "View.MemoryView":579 * return (-1,) * self.view.ndim * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< @@ -17849,25 +20100,25 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 574, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { __pyx_t_4 = __pyx_t_6; __pyx_v_suboffset = (__pyx_t_4[0]); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 574, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) + __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":570 + /* "View.MemoryView":575 * * @property * def suboffsets(self): # <<<<<<<<<<<<<< @@ -17887,7 +20138,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ return __pyx_r; } -/* "View.MemoryView":577 +/* "View.MemoryView":582 * * @property * def ndim(self): # <<<<<<<<<<<<<< @@ -17914,7 +20165,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struc PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":578 + /* "View.MemoryView":583 * @property * def ndim(self): * return self.view.ndim # <<<<<<<<<<<<<< @@ -17922,13 +20173,13 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struc * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 578, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":577 + /* "View.MemoryView":582 * * @property * def ndim(self): # <<<<<<<<<<<<<< @@ -17947,7 +20198,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struc return __pyx_r; } -/* "View.MemoryView":581 +/* "View.MemoryView":586 * * @property * def itemsize(self): # <<<<<<<<<<<<<< @@ -17974,7 +20225,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(s PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":582 + /* "View.MemoryView":587 * @property * def itemsize(self): * return self.view.itemsize # <<<<<<<<<<<<<< @@ -17982,13 +20233,13 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(s * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 582, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":581 + /* "View.MemoryView":586 * * @property * def itemsize(self): # <<<<<<<<<<<<<< @@ -18007,7 +20258,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(s return __pyx_r; } -/* "View.MemoryView":585 +/* "View.MemoryView":590 * * @property * def nbytes(self): # <<<<<<<<<<<<<< @@ -18036,7 +20287,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":586 + /* "View.MemoryView":591 * @property * def nbytes(self): * return self.size * self.view.itemsize # <<<<<<<<<<<<<< @@ -18044,11 +20295,11 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 586, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __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_ERR(2, 586, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __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_ERR(2, 586, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __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; @@ -18056,7 +20307,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str __pyx_t_3 = 0; goto __pyx_L0; - /* "View.MemoryView":585 + /* "View.MemoryView":590 * * @property * def nbytes(self): # <<<<<<<<<<<<<< @@ -18077,7 +20328,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str return __pyx_r; } -/* "View.MemoryView":589 +/* "View.MemoryView":594 * * @property * def size(self): # <<<<<<<<<<<<<< @@ -18111,7 +20362,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":590 + /* "View.MemoryView":595 * @property * def size(self): * if self._size is None: # <<<<<<<<<<<<<< @@ -18122,7 +20373,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":591 + /* "View.MemoryView":596 * def size(self): * if self._size is None: * result = 1 # <<<<<<<<<<<<<< @@ -18132,7 +20383,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __Pyx_INCREF(__pyx_int_1); __pyx_v_result = __pyx_int_1; - /* "View.MemoryView":593 + /* "View.MemoryView":598 * result = 1 * * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< @@ -18142,25 +20393,25 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { __pyx_t_3 = __pyx_t_5; - __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 593, __pyx_L1_error) + __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); __pyx_t_6 = 0; - /* "View.MemoryView":594 + /* "View.MemoryView":599 * * for length in self.view.shape[:self.view.ndim]: * result *= length # <<<<<<<<<<<<<< * * self._size = result */ - __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 594, __pyx_L1_error) + __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); __pyx_t_6 = 0; } - /* "View.MemoryView":596 + /* "View.MemoryView":601 * result *= length * * self._size = result # <<<<<<<<<<<<<< @@ -18173,7 +20424,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __Pyx_DECREF(__pyx_v_self->_size); __pyx_v_self->_size = __pyx_v_result; - /* "View.MemoryView":590 + /* "View.MemoryView":595 * @property * def size(self): * if self._size is None: # <<<<<<<<<<<<<< @@ -18182,7 +20433,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc */ } - /* "View.MemoryView":598 + /* "View.MemoryView":603 * self._size = result * * return self._size # <<<<<<<<<<<<<< @@ -18194,7 +20445,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __pyx_r = __pyx_v_self->_size; goto __pyx_L0; - /* "View.MemoryView":589 + /* "View.MemoryView":594 * * @property * def size(self): # <<<<<<<<<<<<<< @@ -18215,7 +20466,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc return __pyx_r; } -/* "View.MemoryView":600 +/* "View.MemoryView":605 * return self._size * * def __len__(self): # <<<<<<<<<<<<<< @@ -18242,7 +20493,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 int __pyx_t_1; __Pyx_RefNannySetupContext("__len__", 0); - /* "View.MemoryView":601 + /* "View.MemoryView":606 * * def __len__(self): * if self.view.ndim >= 1: # <<<<<<<<<<<<<< @@ -18252,7 +20503,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":602 + /* "View.MemoryView":607 * def __len__(self): * if self.view.ndim >= 1: * return self.view.shape[0] # <<<<<<<<<<<<<< @@ -18262,7 +20513,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 __pyx_r = (__pyx_v_self->view.shape[0]); goto __pyx_L0; - /* "View.MemoryView":601 + /* "View.MemoryView":606 * * def __len__(self): * if self.view.ndim >= 1: # <<<<<<<<<<<<<< @@ -18271,7 +20522,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 */ } - /* "View.MemoryView":604 + /* "View.MemoryView":609 * return self.view.shape[0] * * return 0 # <<<<<<<<<<<<<< @@ -18281,7 +20532,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":600 + /* "View.MemoryView":605 * return self._size * * def __len__(self): # <<<<<<<<<<<<<< @@ -18295,7 +20546,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 return __pyx_r; } -/* "View.MemoryView":606 +/* "View.MemoryView":611 * return 0 * * def __repr__(self): # <<<<<<<<<<<<<< @@ -18324,7 +20575,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "View.MemoryView":607 + /* "View.MemoryView":612 * * def __repr__(self): * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< @@ -18332,33 +20583,33 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 607, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __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_ERR(2, 607, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __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_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 607, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":608 + /* "View.MemoryView":613 * def __repr__(self): * return "" % (self.base.__class__.__name__, * id(self)) # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 608, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "View.MemoryView":607 + /* "View.MemoryView":612 * * def __repr__(self): * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< * id(self)) * */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 607, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -18366,14 +20617,14 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 607, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":606 + /* "View.MemoryView":611 * return 0 * * def __repr__(self): # <<<<<<<<<<<<<< @@ -18394,7 +20645,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 return __pyx_r; } -/* "View.MemoryView":610 +/* "View.MemoryView":615 * id(self)) * * def __str__(self): # <<<<<<<<<<<<<< @@ -18422,7 +20673,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14 PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__str__", 0); - /* "View.MemoryView":611 + /* "View.MemoryView":616 * * def __str__(self): * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< @@ -18430,27 +20681,27 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 611, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __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_ERR(2, 611, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __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_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 611, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __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_ERR(2, 611, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 611, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __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; - /* "View.MemoryView":610 + /* "View.MemoryView":615 * id(self)) * * def __str__(self): # <<<<<<<<<<<<<< @@ -18470,7 +20721,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14 return __pyx_r; } -/* "View.MemoryView":614 +/* "View.MemoryView":619 * * * def is_c_contig(self): # <<<<<<<<<<<<<< @@ -18499,7 +20750,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("is_c_contig", 0); - /* "View.MemoryView":617 + /* "View.MemoryView":622 * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< @@ -18508,7 +20759,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); - /* "View.MemoryView":618 + /* "View.MemoryView":623 * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< @@ -18516,13 +20767,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 * def is_f_contig(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":614 + /* "View.MemoryView":619 * * * def is_c_contig(self): # <<<<<<<<<<<<<< @@ -18541,7 +20792,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 return __pyx_r; } -/* "View.MemoryView":620 +/* "View.MemoryView":625 * return slice_is_contig(mslice[0], 'C', self.view.ndim) * * def is_f_contig(self): # <<<<<<<<<<<<<< @@ -18570,7 +20821,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("is_f_contig", 0); - /* "View.MemoryView":623 + /* "View.MemoryView":628 * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< @@ -18579,7 +20830,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); - /* "View.MemoryView":624 + /* "View.MemoryView":629 * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< @@ -18587,13 +20838,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 * def copy(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 624, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":620 + /* "View.MemoryView":625 * return slice_is_contig(mslice[0], 'C', self.view.ndim) * * def is_f_contig(self): # <<<<<<<<<<<<<< @@ -18612,7 +20863,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 return __pyx_r; } -/* "View.MemoryView":626 +/* "View.MemoryView":631 * return slice_is_contig(mslice[0], 'F', self.view.ndim) * * def copy(self): # <<<<<<<<<<<<<< @@ -18642,7 +20893,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("copy", 0); - /* "View.MemoryView":628 + /* "View.MemoryView":633 * def copy(self): * cdef __Pyx_memviewslice mslice * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< @@ -18651,7 +20902,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "View.MemoryView":630 + /* "View.MemoryView":635 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS * * slice_copy(self, &mslice) # <<<<<<<<<<<<<< @@ -18660,17 +20911,17 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 */ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "View.MemoryView":631 + /* "View.MemoryView":636 * * slice_copy(self, &mslice) * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"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_ERR(2, 631, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"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_ERR(2, 636, __pyx_L1_error) __pyx_v_mslice = __pyx_t_1; - /* "View.MemoryView":636 + /* "View.MemoryView":641 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< @@ -18678,13 +20929,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 * 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_ERR(2, 636, __pyx_L1_error) + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":626 + /* "View.MemoryView":631 * return slice_is_contig(mslice[0], 'F', self.view.ndim) * * def copy(self): # <<<<<<<<<<<<<< @@ -18703,7 +20954,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 return __pyx_r; } -/* "View.MemoryView":638 +/* "View.MemoryView":643 * return memoryview_copy_from_slice(self, &mslice) * * def copy_fortran(self): # <<<<<<<<<<<<<< @@ -18734,7 +20985,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("copy_fortran", 0); - /* "View.MemoryView":640 + /* "View.MemoryView":645 * def copy_fortran(self): * cdef __Pyx_memviewslice src, dst * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< @@ -18743,7 +20994,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - /* "View.MemoryView":642 + /* "View.MemoryView":647 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS * * slice_copy(self, &src) # <<<<<<<<<<<<<< @@ -18752,17 +21003,17 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 */ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - /* "View.MemoryView":643 + /* "View.MemoryView":648 * * slice_copy(self, &src) * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_F_CONTIGUOUS, */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"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_ERR(2, 643, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"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_ERR(2, 648, __pyx_L1_error) __pyx_v_dst = __pyx_t_1; - /* "View.MemoryView":648 + /* "View.MemoryView":653 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< @@ -18770,13 +21021,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 * */ __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_ERR(2, 648, __pyx_L1_error) + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":638 + /* "View.MemoryView":643 * return memoryview_copy_from_slice(self, &mslice) * * def copy_fortran(self): # <<<<<<<<<<<<<< @@ -18826,7 +21077,7 @@ static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struc * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __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; @@ -18879,7 +21130,7 @@ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED st * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __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; @@ -18902,7 +21153,7 @@ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED st return __pyx_r; } -/* "View.MemoryView":652 +/* "View.MemoryView":657 * * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< @@ -18919,18 +21170,18 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - /* "View.MemoryView":653 + /* "View.MemoryView":658 * @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 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 653, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __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_ERR(2, 653, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 653, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_o); __Pyx_GIVEREF(__pyx_v_o); @@ -18941,13 +21192,13 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __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":654 + /* "View.MemoryView":659 * 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 # <<<<<<<<<<<<<< @@ -18956,7 +21207,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in */ __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "View.MemoryView":655 + /* "View.MemoryView":660 * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo * return result # <<<<<<<<<<<<<< @@ -18968,7 +21219,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "View.MemoryView":652 + /* "View.MemoryView":657 * * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< @@ -18990,7 +21241,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in return __pyx_r; } -/* "View.MemoryView":658 +/* "View.MemoryView":663 * * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< @@ -19004,7 +21255,7 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { int __pyx_t_1; __Pyx_RefNannySetupContext("memoryview_check", 0); - /* "View.MemoryView":659 + /* "View.MemoryView":664 * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): * return isinstance(o, memoryview) # <<<<<<<<<<<<<< @@ -19015,7 +21266,7 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { __pyx_r = __pyx_t_1; goto __pyx_L0; - /* "View.MemoryView":658 + /* "View.MemoryView":663 * * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< @@ -19029,7 +21280,7 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { return __pyx_r; } -/* "View.MemoryView":661 +/* "View.MemoryView":666 * return isinstance(o, memoryview) * * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< @@ -19060,7 +21311,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { PyObject *__pyx_t_11 = NULL; __Pyx_RefNannySetupContext("_unellipsify", 0); - /* "View.MemoryView":666 + /* "View.MemoryView":671 * full slices. * """ * if not isinstance(index, tuple): # <<<<<<<<<<<<<< @@ -19071,14 +21322,14 @@ 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":667 + /* "View.MemoryView":672 * """ * if not isinstance(index, tuple): * tup = (index,) # <<<<<<<<<<<<<< * else: * tup = index */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 667, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_index); __Pyx_GIVEREF(__pyx_v_index); @@ -19086,7 +21337,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_v_tup = __pyx_t_3; __pyx_t_3 = 0; - /* "View.MemoryView":666 + /* "View.MemoryView":671 * full slices. * """ * if not isinstance(index, tuple): # <<<<<<<<<<<<<< @@ -19096,7 +21347,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { goto __pyx_L3; } - /* "View.MemoryView":669 + /* "View.MemoryView":674 * tup = (index,) * else: * tup = index # <<<<<<<<<<<<<< @@ -19109,19 +21360,19 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { } __pyx_L3:; - /* "View.MemoryView":671 + /* "View.MemoryView":676 * tup = index * * result = [] # <<<<<<<<<<<<<< * have_slices = False * seen_ellipsis = False */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 671, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_result = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":672 + /* "View.MemoryView":677 * * result = [] * have_slices = False # <<<<<<<<<<<<<< @@ -19130,7 +21381,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_have_slices = 0; - /* "View.MemoryView":673 + /* "View.MemoryView":678 * result = [] * have_slices = False * seen_ellipsis = False # <<<<<<<<<<<<<< @@ -19139,7 +21390,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_seen_ellipsis = 0; - /* "View.MemoryView":674 + /* "View.MemoryView":679 * have_slices = False * seen_ellipsis = False * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< @@ -19152,26 +21403,26 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error) } for (;;) { 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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -19181,7 +21432,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 674, __pyx_L1_error) + else __PYX_ERR(2, 679, __pyx_L1_error) } break; } @@ -19191,13 +21442,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __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":675 + /* "View.MemoryView":680 * seen_ellipsis = False * for idx, item in enumerate(tup): * if item is Ellipsis: # <<<<<<<<<<<<<< @@ -19208,7 +21459,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":676 + /* "View.MemoryView":681 * for idx, item in enumerate(tup): * if item is Ellipsis: * if not seen_ellipsis: # <<<<<<<<<<<<<< @@ -19218,27 +21469,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":677 + /* "View.MemoryView":682 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ - __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 677, __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_ERR(2, 677, __pyx_L1_error) + __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __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_ERR(2, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__25); - __Pyx_GIVEREF(__pyx_slice__25); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__25); + __Pyx_INCREF(__pyx_slice__22); + __Pyx_GIVEREF(__pyx_slice__22); + PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__22); } } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 677, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":678 + /* "View.MemoryView":683 * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) * seen_ellipsis = True # <<<<<<<<<<<<<< @@ -19247,7 +21498,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_seen_ellipsis = 1; - /* "View.MemoryView":676 + /* "View.MemoryView":681 * for idx, item in enumerate(tup): * if item is Ellipsis: * if not seen_ellipsis: # <<<<<<<<<<<<<< @@ -19257,7 +21508,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { goto __pyx_L7; } - /* "View.MemoryView":680 + /* "View.MemoryView":685 * seen_ellipsis = True * else: * result.append(slice(None)) # <<<<<<<<<<<<<< @@ -19265,11 +21516,11 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { * else: */ /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__26); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 680, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__22); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error) } __pyx_L7:; - /* "View.MemoryView":681 + /* "View.MemoryView":686 * else: * result.append(slice(None)) * have_slices = True # <<<<<<<<<<<<<< @@ -19278,7 +21529,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_have_slices = 1; - /* "View.MemoryView":675 + /* "View.MemoryView":680 * seen_ellipsis = False * for idx, item in enumerate(tup): * if item is Ellipsis: # <<<<<<<<<<<<<< @@ -19288,7 +21539,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { goto __pyx_L6; } - /* "View.MemoryView":683 + /* "View.MemoryView":688 * have_slices = True * else: * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< @@ -19308,23 +21559,23 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_L9_bool_binop_done:; if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":684 + /* "View.MemoryView":689 * 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_7 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 689, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 684, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_11, 0, 0, 0); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(2, 684, __pyx_L1_error) + __PYX_ERR(2, 689, __pyx_L1_error) - /* "View.MemoryView":683 + /* "View.MemoryView":688 * have_slices = True * else: * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< @@ -19333,7 +21584,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ } - /* "View.MemoryView":686 + /* "View.MemoryView":691 * raise TypeError("Cannot index with type '%s'" % type(item)) * * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< @@ -19352,18 +21603,18 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_L11_bool_binop_done:; __pyx_v_have_slices = __pyx_t_1; - /* "View.MemoryView":687 + /* "View.MemoryView":692 * * have_slices = have_slices or isinstance(item, slice) * result.append(item) # <<<<<<<<<<<<<< * * nslices = ndim - len(result) */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error) } __pyx_L6:; - /* "View.MemoryView":674 + /* "View.MemoryView":679 * have_slices = False * seen_ellipsis = False * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< @@ -19374,17 +21625,17 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":689 + /* "View.MemoryView":694 * result.append(item) * * nslices = ndim - len(result) # <<<<<<<<<<<<<< * if nslices: * result.extend([slice(None)] * nslices) */ - __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 689, __pyx_L1_error) + __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error) __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); - /* "View.MemoryView":690 + /* "View.MemoryView":695 * * nslices = ndim - len(result) * if nslices: # <<<<<<<<<<<<<< @@ -19394,26 +21645,26 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_1 = (__pyx_v_nslices != 0); if (__pyx_t_1) { - /* "View.MemoryView":691 + /* "View.MemoryView":696 * nslices = ndim - len(result) * if nslices: * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< * * return have_slices or nslices, tuple(result) */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 691, __pyx_L1_error) + __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__27); - __Pyx_GIVEREF(__pyx_slice__27); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__27); + __Pyx_INCREF(__pyx_slice__22); + __Pyx_GIVEREF(__pyx_slice__22); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__22); } } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 691, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":690 + /* "View.MemoryView":695 * * nslices = ndim - len(result) * if nslices: # <<<<<<<<<<<<<< @@ -19422,7 +21673,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ } - /* "View.MemoryView":693 + /* "View.MemoryView":698 * result.extend([slice(None)] * nslices) * * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< @@ -19432,20 +21683,20 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_XDECREF(__pyx_r); if (!__pyx_v_have_slices) { } else { - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 693, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __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 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 693, __pyx_L1_error) + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __pyx_t_4; __pyx_t_4 = 0; __pyx_L14_bool_binop_done:; - __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 693, __pyx_L1_error) + __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 693, __pyx_L1_error) + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); @@ -19457,7 +21708,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_11 = 0; goto __pyx_L0; - /* "View.MemoryView":661 + /* "View.MemoryView":666 * return isinstance(o, memoryview) * * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< @@ -19483,7 +21734,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { return __pyx_r; } -/* "View.MemoryView":695 +/* "View.MemoryView":700 * return have_slices or nslices, tuple(result) * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< @@ -19502,7 +21753,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - /* "View.MemoryView":696 + /* "View.MemoryView":701 * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< @@ -19514,7 +21765,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ __pyx_t_1 = __pyx_t_3; __pyx_v_suboffset = (__pyx_t_1[0]); - /* "View.MemoryView":697 + /* "View.MemoryView":702 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -19524,20 +21775,20 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":698 + /* "View.MemoryView":703 * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 698, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __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_ERR(2, 698, __pyx_L1_error) + __PYX_ERR(2, 703, __pyx_L1_error) - /* "View.MemoryView":697 + /* "View.MemoryView":702 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -19547,7 +21798,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ } } - /* "View.MemoryView":695 + /* "View.MemoryView":700 * return have_slices or nslices, tuple(result) * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< @@ -19568,7 +21819,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ return __pyx_r; } -/* "View.MemoryView":705 +/* "View.MemoryView":710 * * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< @@ -19609,7 +21860,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ Py_ssize_t __pyx_t_12; __Pyx_RefNannySetupContext("memview_slice", 0); - /* "View.MemoryView":706 + /* "View.MemoryView":711 * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< @@ -19619,7 +21870,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_v_new_ndim = 0; __pyx_v_suboffset_dim = -1; - /* "View.MemoryView":713 + /* "View.MemoryView":718 * * * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< @@ -19628,7 +21879,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "View.MemoryView":717 + /* "View.MemoryView":722 * cdef _memoryviewslice memviewsliceobj * * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< @@ -19639,12 +21890,12 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(2, 717, __pyx_L1_error) + __PYX_ERR(2, 722, __pyx_L1_error) } } #endif - /* "View.MemoryView":719 + /* "View.MemoryView":724 * assert memview.view.ndim > 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -19655,20 +21906,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":720 + /* "View.MemoryView":725 * * 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_ERR(2, 720, __pyx_L1_error) + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __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":721 + /* "View.MemoryView":726 * if isinstance(memview, _memoryviewslice): * memviewsliceobj = memview * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< @@ -19677,7 +21928,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - /* "View.MemoryView":719 + /* "View.MemoryView":724 * assert memview.view.ndim > 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -19687,7 +21938,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ goto __pyx_L3; } - /* "View.MemoryView":723 + /* "View.MemoryView":728 * p_src = &memviewsliceobj.from_slice * else: * slice_copy(memview, &src) # <<<<<<<<<<<<<< @@ -19697,7 +21948,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ /*else*/ { __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* "View.MemoryView":724 + /* "View.MemoryView":729 * else: * slice_copy(memview, &src) * p_src = &src # <<<<<<<<<<<<<< @@ -19708,7 +21959,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __pyx_L3:; - /* "View.MemoryView":730 + /* "View.MemoryView":735 * * * dst.memview = p_src.memview # <<<<<<<<<<<<<< @@ -19718,7 +21969,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_4 = __pyx_v_p_src->memview; __pyx_v_dst.memview = __pyx_t_4; - /* "View.MemoryView":731 + /* "View.MemoryView":736 * * dst.memview = p_src.memview * dst.data = p_src.data # <<<<<<<<<<<<<< @@ -19728,7 +21979,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_5 = __pyx_v_p_src->data; __pyx_v_dst.data = __pyx_t_5; - /* "View.MemoryView":736 + /* "View.MemoryView":741 * * * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< @@ -19737,7 +21988,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_dst = (&__pyx_v_dst); - /* "View.MemoryView":737 + /* "View.MemoryView":742 * * cdef __Pyx_memviewslice *p_dst = &dst * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< @@ -19746,7 +21997,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "View.MemoryView":741 + /* "View.MemoryView":746 * cdef bint have_start, have_stop, have_step * * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< @@ -19758,26 +22009,26 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __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_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error) } for (;;) { 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_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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_ERR(2, 741, __pyx_L1_error) + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error) #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __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_ERR(2, 741, __pyx_L1_error) + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error) #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } @@ -19787,7 +22038,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 741, __pyx_L1_error) + else __PYX_ERR(2, 746, __pyx_L1_error) } break; } @@ -19798,7 +22049,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_v_dim = __pyx_t_6; __pyx_t_6 = (__pyx_t_6 + 1); - /* "View.MemoryView":742 + /* "View.MemoryView":747 * * for dim, index in enumerate(indices): * if PyIndex_Check(index): # <<<<<<<<<<<<<< @@ -19808,25 +22059,25 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); if (__pyx_t_2) { - /* "View.MemoryView":746 + /* "View.MemoryView":751 * 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_ERR(2, 746, __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_ERR(2, 751, __pyx_L1_error) - /* "View.MemoryView":743 + /* "View.MemoryView":748 * 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 == ((int)-1))) __PYX_ERR(2, 743, __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 == ((int)-1))) __PYX_ERR(2, 748, __pyx_L1_error) - /* "View.MemoryView":742 + /* "View.MemoryView":747 * * for dim, index in enumerate(indices): * if PyIndex_Check(index): # <<<<<<<<<<<<<< @@ -19836,7 +22087,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ goto __pyx_L6; } - /* "View.MemoryView":749 + /* "View.MemoryView":754 * 0, 0, 0, # have_{start,stop,step} * False) * elif index is None: # <<<<<<<<<<<<<< @@ -19847,7 +22098,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":750 + /* "View.MemoryView":755 * False) * elif index is None: * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< @@ -19856,7 +22107,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - /* "View.MemoryView":751 + /* "View.MemoryView":756 * elif index is None: * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< @@ -19865,7 +22116,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "View.MemoryView":752 + /* "View.MemoryView":757 * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< @@ -19874,7 +22125,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; - /* "View.MemoryView":753 + /* "View.MemoryView":758 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 * new_ndim += 1 # <<<<<<<<<<<<<< @@ -19883,7 +22134,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - /* "View.MemoryView":749 + /* "View.MemoryView":754 * 0, 0, 0, # have_{start,stop,step} * False) * elif index is None: # <<<<<<<<<<<<<< @@ -19893,7 +22144,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ goto __pyx_L6; } - /* "View.MemoryView":755 + /* "View.MemoryView":760 * new_ndim += 1 * else: * start = index.start or 0 # <<<<<<<<<<<<<< @@ -19901,13 +22152,13 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * step = index.step or 0 */ /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 755, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 755, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 755, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error) __pyx_t_10 = __pyx_t_12; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L7_bool_binop_done; @@ -19916,20 +22167,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_L7_bool_binop_done:; __pyx_v_start = __pyx_t_10; - /* "View.MemoryView":756 + /* "View.MemoryView":761 * 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_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 756, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 756, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 756, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error) __pyx_t_10 = __pyx_t_12; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L9_bool_binop_done; @@ -19938,20 +22189,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_L9_bool_binop_done:; __pyx_v_stop = __pyx_t_10; - /* "View.MemoryView":757 + /* "View.MemoryView":762 * 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_ERR(2, 757, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 757, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 757, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error) __pyx_t_10 = __pyx_t_12; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L11_bool_binop_done; @@ -19960,55 +22211,55 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_L11_bool_binop_done:; __pyx_v_step = __pyx_t_10; - /* "View.MemoryView":759 + /* "View.MemoryView":764 * 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_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 759, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __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":760 + /* "View.MemoryView":765 * * have_start = index.start is not None * have_stop = index.stop is not None # <<<<<<<<<<<<<< * have_step = index.step is not None * */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __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":761 + /* "View.MemoryView":766 * 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_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __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":763 + /* "View.MemoryView":768 * 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 == ((int)-1))) __PYX_ERR(2, 763, __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 == ((int)-1))) __PYX_ERR(2, 768, __pyx_L1_error) - /* "View.MemoryView":769 + /* "View.MemoryView":774 * have_start, have_stop, have_step, * True) * new_ndim += 1 # <<<<<<<<<<<<<< @@ -20019,7 +22270,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __pyx_L6:; - /* "View.MemoryView":741 + /* "View.MemoryView":746 * cdef bint have_start, have_stop, have_step * * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< @@ -20029,7 +22280,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":771 + /* "View.MemoryView":776 * new_ndim += 1 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -20040,7 +22291,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":772 + /* "View.MemoryView":777 * * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< @@ -20049,39 +22300,39 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - /* "View.MemoryView":773 + /* "View.MemoryView":778 * 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_ERR(2, 773, __pyx_L1_error) } + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) } - /* "View.MemoryView":774 + /* "View.MemoryView":779 * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< * memview.dtype_is_object) * else: */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 774, __pyx_L1_error) } + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) } - /* "View.MemoryView":772 + /* "View.MemoryView":777 * * 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_ERR(2, 772, __pyx_L1_error) + __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_ERR(2, 777, __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_ERR(2, 772, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error) __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "View.MemoryView":771 + /* "View.MemoryView":776 * new_ndim += 1 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -20090,7 +22341,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ } - /* "View.MemoryView":777 + /* "View.MemoryView":782 * memview.dtype_is_object) * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< @@ -20100,30 +22351,30 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ /*else*/ { __Pyx_XDECREF(((PyObject *)__pyx_r)); - /* "View.MemoryView":778 + /* "View.MemoryView":783 * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ - __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_ERR(2, 777, __pyx_L1_error) + __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_ERR(2, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "View.MemoryView":777 + /* "View.MemoryView":782 * 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_ERR(2, 777, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error) __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; } - /* "View.MemoryView":705 + /* "View.MemoryView":710 * * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< @@ -20145,7 +22396,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ return __pyx_r; } -/* "View.MemoryView":802 +/* "View.MemoryView":807 * * @cname('__pyx_memoryview_slice_memviewslice') * cdef int slice_memviewslice( # <<<<<<<<<<<<<< @@ -20161,7 +22412,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":822 + /* "View.MemoryView":827 * cdef bint negative_step * * if not is_slice: # <<<<<<<<<<<<<< @@ -20171,7 +22422,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":824 + /* "View.MemoryView":829 * if not is_slice: * * if start < 0: # <<<<<<<<<<<<<< @@ -20181,7 +22432,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":825 + /* "View.MemoryView":830 * * if start < 0: * start += shape # <<<<<<<<<<<<<< @@ -20190,7 +22441,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "View.MemoryView":824 + /* "View.MemoryView":829 * if not is_slice: * * if start < 0: # <<<<<<<<<<<<<< @@ -20199,7 +22450,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":826 + /* "View.MemoryView":831 * if start < 0: * start += shape * if not 0 <= start < shape: # <<<<<<<<<<<<<< @@ -20213,16 +22464,16 @@ 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":827 + /* "View.MemoryView":832 * 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, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 832, __pyx_L1_error) - /* "View.MemoryView":826 + /* "View.MemoryView":831 * if start < 0: * start += shape * if not 0 <= start < shape: # <<<<<<<<<<<<<< @@ -20231,7 +22482,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":822 + /* "View.MemoryView":827 * cdef bint negative_step * * if not is_slice: # <<<<<<<<<<<<<< @@ -20241,7 +22492,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L3; } - /* "View.MemoryView":830 + /* "View.MemoryView":835 * else: * * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< @@ -20260,7 +22511,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_L6_bool_binop_done:; __pyx_v_negative_step = __pyx_t_2; - /* "View.MemoryView":832 + /* "View.MemoryView":837 * negative_step = have_step != 0 and step < 0 * * if have_step and step == 0: # <<<<<<<<<<<<<< @@ -20278,16 +22529,16 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_L9_bool_binop_done:; if (__pyx_t_2) { - /* "View.MemoryView":833 + /* "View.MemoryView":838 * * 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, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 838, __pyx_L1_error) - /* "View.MemoryView":832 + /* "View.MemoryView":837 * negative_step = have_step != 0 and step < 0 * * if have_step and step == 0: # <<<<<<<<<<<<<< @@ -20296,7 +22547,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":836 + /* "View.MemoryView":841 * * * if have_start: # <<<<<<<<<<<<<< @@ -20306,7 +22557,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":837 + /* "View.MemoryView":842 * * if have_start: * if start < 0: # <<<<<<<<<<<<<< @@ -20316,7 +22567,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":838 + /* "View.MemoryView":843 * if have_start: * if start < 0: * start += shape # <<<<<<<<<<<<<< @@ -20325,7 +22576,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "View.MemoryView":839 + /* "View.MemoryView":844 * if start < 0: * start += shape * if start < 0: # <<<<<<<<<<<<<< @@ -20335,7 +22586,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":840 + /* "View.MemoryView":845 * start += shape * if start < 0: * start = 0 # <<<<<<<<<<<<<< @@ -20344,7 +22595,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = 0; - /* "View.MemoryView":839 + /* "View.MemoryView":844 * if start < 0: * start += shape * if start < 0: # <<<<<<<<<<<<<< @@ -20353,7 +22604,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":837 + /* "View.MemoryView":842 * * if have_start: * if start < 0: # <<<<<<<<<<<<<< @@ -20363,7 +22614,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L12; } - /* "View.MemoryView":841 + /* "View.MemoryView":846 * if start < 0: * start = 0 * elif start >= shape: # <<<<<<<<<<<<<< @@ -20373,7 +22624,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":842 + /* "View.MemoryView":847 * start = 0 * elif start >= shape: * if negative_step: # <<<<<<<<<<<<<< @@ -20383,7 +22634,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":843 + /* "View.MemoryView":848 * elif start >= shape: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< @@ -20392,7 +22643,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_shape - 1); - /* "View.MemoryView":842 + /* "View.MemoryView":847 * start = 0 * elif start >= shape: * if negative_step: # <<<<<<<<<<<<<< @@ -20402,7 +22653,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L14; } - /* "View.MemoryView":845 + /* "View.MemoryView":850 * start = shape - 1 * else: * start = shape # <<<<<<<<<<<<<< @@ -20414,7 +22665,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L14:; - /* "View.MemoryView":841 + /* "View.MemoryView":846 * if start < 0: * start = 0 * elif start >= shape: # <<<<<<<<<<<<<< @@ -20424,7 +22675,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L12:; - /* "View.MemoryView":836 + /* "View.MemoryView":841 * * * if have_start: # <<<<<<<<<<<<<< @@ -20434,7 +22685,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L11; } - /* "View.MemoryView":847 + /* "View.MemoryView":852 * start = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -20445,7 +22696,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":848 + /* "View.MemoryView":853 * else: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< @@ -20454,7 +22705,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_shape - 1); - /* "View.MemoryView":847 + /* "View.MemoryView":852 * start = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -20464,7 +22715,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L15; } - /* "View.MemoryView":850 + /* "View.MemoryView":855 * start = shape - 1 * else: * start = 0 # <<<<<<<<<<<<<< @@ -20478,7 +22729,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L11:; - /* "View.MemoryView":852 + /* "View.MemoryView":857 * start = 0 * * if have_stop: # <<<<<<<<<<<<<< @@ -20488,7 +22739,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":853 + /* "View.MemoryView":858 * * if have_stop: * if stop < 0: # <<<<<<<<<<<<<< @@ -20498,7 +22749,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":854 + /* "View.MemoryView":859 * if have_stop: * if stop < 0: * stop += shape # <<<<<<<<<<<<<< @@ -20507,7 +22758,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* "View.MemoryView":855 + /* "View.MemoryView":860 * if stop < 0: * stop += shape * if stop < 0: # <<<<<<<<<<<<<< @@ -20517,7 +22768,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":856 + /* "View.MemoryView":861 * stop += shape * if stop < 0: * stop = 0 # <<<<<<<<<<<<<< @@ -20526,7 +22777,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = 0; - /* "View.MemoryView":855 + /* "View.MemoryView":860 * if stop < 0: * stop += shape * if stop < 0: # <<<<<<<<<<<<<< @@ -20535,7 +22786,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":853 + /* "View.MemoryView":858 * * if have_stop: * if stop < 0: # <<<<<<<<<<<<<< @@ -20545,7 +22796,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L17; } - /* "View.MemoryView":857 + /* "View.MemoryView":862 * if stop < 0: * stop = 0 * elif stop > shape: # <<<<<<<<<<<<<< @@ -20555,7 +22806,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":858 + /* "View.MemoryView":863 * stop = 0 * elif stop > shape: * stop = shape # <<<<<<<<<<<<<< @@ -20564,7 +22815,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = __pyx_v_shape; - /* "View.MemoryView":857 + /* "View.MemoryView":862 * if stop < 0: * stop = 0 * elif stop > shape: # <<<<<<<<<<<<<< @@ -20574,7 +22825,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L17:; - /* "View.MemoryView":852 + /* "View.MemoryView":857 * start = 0 * * if have_stop: # <<<<<<<<<<<<<< @@ -20584,7 +22835,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L16; } - /* "View.MemoryView":860 + /* "View.MemoryView":865 * stop = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -20595,7 +22846,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":861 + /* "View.MemoryView":866 * else: * if negative_step: * stop = -1 # <<<<<<<<<<<<<< @@ -20604,7 +22855,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = -1L; - /* "View.MemoryView":860 + /* "View.MemoryView":865 * stop = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -20614,7 +22865,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L19; } - /* "View.MemoryView":863 + /* "View.MemoryView":868 * stop = -1 * else: * stop = shape # <<<<<<<<<<<<<< @@ -20628,7 +22879,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L16:; - /* "View.MemoryView":865 + /* "View.MemoryView":870 * stop = shape * * if not have_step: # <<<<<<<<<<<<<< @@ -20638,7 +22889,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":866 + /* "View.MemoryView":871 * * if not have_step: * step = 1 # <<<<<<<<<<<<<< @@ -20647,7 +22898,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_step = 1; - /* "View.MemoryView":865 + /* "View.MemoryView":870 * stop = shape * * if not have_step: # <<<<<<<<<<<<<< @@ -20656,7 +22907,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":870 + /* "View.MemoryView":875 * * with cython.cdivision(True): * new_shape = (stop - start) // step # <<<<<<<<<<<<<< @@ -20665,7 +22916,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":872 + /* "View.MemoryView":877 * new_shape = (stop - start) // step * * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< @@ -20675,7 +22926,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":873 + /* "View.MemoryView":878 * * if (stop - start) - step * new_shape: * new_shape += 1 # <<<<<<<<<<<<<< @@ -20684,7 +22935,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_new_shape = (__pyx_v_new_shape + 1); - /* "View.MemoryView":872 + /* "View.MemoryView":877 * new_shape = (stop - start) // step * * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< @@ -20693,7 +22944,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":875 + /* "View.MemoryView":880 * new_shape += 1 * * if new_shape < 0: # <<<<<<<<<<<<<< @@ -20703,7 +22954,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":876 + /* "View.MemoryView":881 * * if new_shape < 0: * new_shape = 0 # <<<<<<<<<<<<<< @@ -20712,7 +22963,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_new_shape = 0; - /* "View.MemoryView":875 + /* "View.MemoryView":880 * new_shape += 1 * * if new_shape < 0: # <<<<<<<<<<<<<< @@ -20721,7 +22972,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":879 + /* "View.MemoryView":884 * * * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< @@ -20730,7 +22981,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":880 + /* "View.MemoryView":885 * * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< @@ -20739,7 +22990,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":881 + /* "View.MemoryView":886 * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< @@ -20750,7 +23001,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L3:; - /* "View.MemoryView":884 + /* "View.MemoryView":889 * * * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< @@ -20760,7 +23011,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":885 + /* "View.MemoryView":890 * * if suboffset_dim[0] < 0: * dst.data += start * stride # <<<<<<<<<<<<<< @@ -20769,7 +23020,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - /* "View.MemoryView":884 + /* "View.MemoryView":889 * * * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< @@ -20779,7 +23030,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L23; } - /* "View.MemoryView":887 + /* "View.MemoryView":892 * dst.data += start * stride * else: * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< @@ -20792,7 +23043,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L23:; - /* "View.MemoryView":889 + /* "View.MemoryView":894 * dst.suboffsets[suboffset_dim[0]] += start * stride * * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -20802,7 +23053,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":890 + /* "View.MemoryView":895 * * if suboffset >= 0: * if not is_slice: # <<<<<<<<<<<<<< @@ -20812,7 +23063,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":891 + /* "View.MemoryView":896 * if suboffset >= 0: * if not is_slice: * if new_ndim == 0: # <<<<<<<<<<<<<< @@ -20822,7 +23073,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":892 + /* "View.MemoryView":897 * if not is_slice: * if new_ndim == 0: * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< @@ -20831,7 +23082,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - /* "View.MemoryView":891 + /* "View.MemoryView":896 * if suboffset >= 0: * if not is_slice: * if new_ndim == 0: # <<<<<<<<<<<<<< @@ -20841,7 +23092,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L26; } - /* "View.MemoryView":894 + /* "View.MemoryView":899 * dst.data = ( dst.data)[0] + suboffset * else: * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< @@ -20850,18 +23101,18 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ /*else*/ { - /* "View.MemoryView":895 + /* "View.MemoryView":900 * else: * _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, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 894, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 899, __pyx_L1_error) } __pyx_L26:; - /* "View.MemoryView":890 + /* "View.MemoryView":895 * * if suboffset >= 0: * if not is_slice: # <<<<<<<<<<<<<< @@ -20871,7 +23122,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L25; } - /* "View.MemoryView":897 + /* "View.MemoryView":902 * "must be indexed and not sliced", dim) * else: * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< @@ -20883,7 +23134,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L25:; - /* "View.MemoryView":889 + /* "View.MemoryView":894 * dst.suboffsets[suboffset_dim[0]] += start * stride * * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -20892,7 +23143,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":899 + /* "View.MemoryView":904 * suboffset_dim[0] = new_ndim * * return 0 # <<<<<<<<<<<<<< @@ -20902,7 +23153,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":802 + /* "View.MemoryView":807 * * @cname('__pyx_memoryview_slice_memviewslice') * cdef int slice_memviewslice( # <<<<<<<<<<<<<< @@ -20926,7 +23177,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, return __pyx_r; } -/* "View.MemoryView":905 +/* "View.MemoryView":910 * * @cname('__pyx_pybuffer_index') * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< @@ -20948,7 +23199,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("pybuffer_index", 0); - /* "View.MemoryView":907 + /* "View.MemoryView":912 * 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 # <<<<<<<<<<<<<< @@ -20957,7 +23208,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_suboffset = -1L; - /* "View.MemoryView":908 + /* "View.MemoryView":913 * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< @@ -20967,7 +23218,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":911 + /* "View.MemoryView":916 * cdef char *resultp * * if view.ndim == 0: # <<<<<<<<<<<<<< @@ -20977,7 +23228,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":912 + /* "View.MemoryView":917 * * if view.ndim == 0: * shape = view.len / itemsize # <<<<<<<<<<<<<< @@ -20986,15 +23237,15 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ if (unlikely(__pyx_v_itemsize == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 912, __pyx_L1_error) + __PYX_ERR(2, 917, __pyx_L1_error) } else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 912, __pyx_L1_error) + __PYX_ERR(2, 917, __pyx_L1_error) } __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize); - /* "View.MemoryView":913 + /* "View.MemoryView":918 * if view.ndim == 0: * shape = view.len / itemsize * stride = itemsize # <<<<<<<<<<<<<< @@ -21003,7 +23254,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_stride = __pyx_v_itemsize; - /* "View.MemoryView":911 + /* "View.MemoryView":916 * cdef char *resultp * * if view.ndim == 0: # <<<<<<<<<<<<<< @@ -21013,7 +23264,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P goto __pyx_L3; } - /* "View.MemoryView":915 + /* "View.MemoryView":920 * stride = itemsize * else: * shape = view.shape[dim] # <<<<<<<<<<<<<< @@ -21023,7 +23274,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P /*else*/ { __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "View.MemoryView":916 + /* "View.MemoryView":921 * else: * shape = view.shape[dim] * stride = view.strides[dim] # <<<<<<<<<<<<<< @@ -21032,7 +23283,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":917 + /* "View.MemoryView":922 * shape = view.shape[dim] * stride = view.strides[dim] * if view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -21042,7 +23293,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":918 + /* "View.MemoryView":923 * stride = view.strides[dim] * if view.suboffsets != NULL: * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< @@ -21051,7 +23302,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - /* "View.MemoryView":917 + /* "View.MemoryView":922 * shape = view.shape[dim] * stride = view.strides[dim] * if view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -21062,7 +23313,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P } __pyx_L3:; - /* "View.MemoryView":920 + /* "View.MemoryView":925 * suboffset = view.suboffsets[dim] * * if index < 0: # <<<<<<<<<<<<<< @@ -21072,7 +23323,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":921 + /* "View.MemoryView":926 * * if index < 0: * index += view.shape[dim] # <<<<<<<<<<<<<< @@ -21081,7 +23332,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":922 + /* "View.MemoryView":927 * if index < 0: * index += view.shape[dim] * if index < 0: # <<<<<<<<<<<<<< @@ -21091,26 +23342,26 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index < 0) != 0); if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":923 + /* "View.MemoryView":928 * index += view.shape[dim] * if index < 0: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * if index >= shape: */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 923, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __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_ERR(2, 923, __pyx_L1_error) + __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_ERR(2, 928, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 923, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __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_ERR(2, 923, __pyx_L1_error) + __PYX_ERR(2, 928, __pyx_L1_error) - /* "View.MemoryView":922 + /* "View.MemoryView":927 * if index < 0: * index += view.shape[dim] * if index < 0: # <<<<<<<<<<<<<< @@ -21119,7 +23370,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ } - /* "View.MemoryView":920 + /* "View.MemoryView":925 * suboffset = view.suboffsets[dim] * * if index < 0: # <<<<<<<<<<<<<< @@ -21128,7 +23379,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ } - /* "View.MemoryView":925 + /* "View.MemoryView":930 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * if index >= shape: # <<<<<<<<<<<<<< @@ -21138,26 +23389,26 @@ 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 (unlikely(__pyx_t_2)) { - /* "View.MemoryView":926 + /* "View.MemoryView":931 * * if index >= shape: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * resultp = bufp + index * stride */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 926, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __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_ERR(2, 926, __pyx_L1_error) + __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_ERR(2, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 926, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __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_ERR(2, 926, __pyx_L1_error) + __PYX_ERR(2, 931, __pyx_L1_error) - /* "View.MemoryView":925 + /* "View.MemoryView":930 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * if index >= shape: # <<<<<<<<<<<<<< @@ -21166,7 +23417,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ } - /* "View.MemoryView":928 + /* "View.MemoryView":933 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * resultp = bufp + index * stride # <<<<<<<<<<<<<< @@ -21175,7 +23426,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":929 + /* "View.MemoryView":934 * * resultp = bufp + index * stride * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -21185,7 +23436,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":930 + /* "View.MemoryView":935 * resultp = bufp + index * stride * if suboffset >= 0: * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< @@ -21194,7 +23445,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); - /* "View.MemoryView":929 + /* "View.MemoryView":934 * * resultp = bufp + index * stride * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -21203,7 +23454,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ } - /* "View.MemoryView":932 + /* "View.MemoryView":937 * resultp = ( resultp)[0] + suboffset * * return resultp # <<<<<<<<<<<<<< @@ -21213,7 +23464,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_r = __pyx_v_resultp; goto __pyx_L0; - /* "View.MemoryView":905 + /* "View.MemoryView":910 * * @cname('__pyx_pybuffer_index') * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< @@ -21232,7 +23483,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P return __pyx_r; } -/* "View.MemoryView":938 +/* "View.MemoryView":943 * * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< @@ -21257,7 +23508,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { int __pyx_t_8; int __pyx_t_9; - /* "View.MemoryView":939 + /* "View.MemoryView":944 * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< @@ -21267,7 +23518,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":941 + /* "View.MemoryView":946 * cdef int ndim = memslice.memview.view.ndim * * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< @@ -21277,7 +23528,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":942 + /* "View.MemoryView":947 * * cdef Py_ssize_t *shape = memslice.shape * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< @@ -21287,7 +23538,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":946 + /* "View.MemoryView":951 * * cdef int i, j * for i in range(ndim / 2): # <<<<<<<<<<<<<< @@ -21299,7 +23550,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":947 + /* "View.MemoryView":952 * cdef int i, j * for i in range(ndim / 2): * j = ndim - 1 - i # <<<<<<<<<<<<<< @@ -21308,7 +23559,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { */ __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - /* "View.MemoryView":948 + /* "View.MemoryView":953 * for i in range(ndim / 2): * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< @@ -21320,7 +23571,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - /* "View.MemoryView":949 + /* "View.MemoryView":954 * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< @@ -21332,7 +23583,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; - /* "View.MemoryView":951 + /* "View.MemoryView":956 * shape[i], shape[j] = shape[j], shape[i] * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< @@ -21350,16 +23601,16 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_L6_bool_binop_done:; if (__pyx_t_7) { - /* "View.MemoryView":952 + /* "View.MemoryView":957 * * 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, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 952, __pyx_L1_error) + __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L1_error) - /* "View.MemoryView":951 + /* "View.MemoryView":956 * shape[i], shape[j] = shape[j], shape[i] * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< @@ -21369,7 +23620,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { } } - /* "View.MemoryView":954 + /* "View.MemoryView":959 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * * return 1 # <<<<<<<<<<<<<< @@ -21379,7 +23630,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_r = 1; goto __pyx_L0; - /* "View.MemoryView":938 + /* "View.MemoryView":943 * * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< @@ -21403,7 +23654,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { return __pyx_r; } -/* "View.MemoryView":971 +/* "View.MemoryView":976 * cdef int (*to_dtype_func)(char *, object) except 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -21426,7 +23677,7 @@ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewsl __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":972 + /* "View.MemoryView":977 * * def __dealloc__(self): * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< @@ -21435,7 +23686,7 @@ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewsl */ __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); - /* "View.MemoryView":971 + /* "View.MemoryView":976 * cdef int (*to_dtype_func)(char *, object) except 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -21447,7 +23698,7 @@ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewsl __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":974 +/* "View.MemoryView":979 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -21462,7 +23713,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "View.MemoryView":975 + /* "View.MemoryView":980 * * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: # <<<<<<<<<<<<<< @@ -21472,7 +23723,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":976 + /* "View.MemoryView":981 * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: * return self.to_object_func(itemp) # <<<<<<<<<<<<<< @@ -21480,13 +23731,13 @@ 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_ERR(2, 976, __pyx_L1_error) + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":975 + /* "View.MemoryView":980 * * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: # <<<<<<<<<<<<<< @@ -21495,7 +23746,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor */ } - /* "View.MemoryView":978 + /* "View.MemoryView":983 * return self.to_object_func(itemp) * else: * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< @@ -21504,14 +23755,14 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __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_ERR(2, 978, __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_ERR(2, 983, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; } - /* "View.MemoryView":974 + /* "View.MemoryView":979 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -21530,7 +23781,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor return __pyx_r; } -/* "View.MemoryView":980 +/* "View.MemoryView":985 * return memoryview.convert_item_to_object(self, itemp) * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -21546,7 +23797,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":981 + /* "View.MemoryView":986 * * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< @@ -21556,16 +23807,16 @@ 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":982 + /* "View.MemoryView":987 * 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 == ((int)0))) __PYX_ERR(2, 982, __pyx_L1_error) + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error) - /* "View.MemoryView":981 + /* "View.MemoryView":986 * * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< @@ -21575,7 +23826,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo goto __pyx_L3; } - /* "View.MemoryView":984 + /* "View.MemoryView":989 * self.to_dtype_func(itemp, value) * else: * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< @@ -21583,13 +23834,13 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo * @property */ /*else*/ { - __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_ERR(2, 984, __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_ERR(2, 989, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_L3:; - /* "View.MemoryView":980 + /* "View.MemoryView":985 * return memoryview.convert_item_to_object(self, itemp) * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -21610,7 +23861,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo return __pyx_r; } -/* "View.MemoryView":987 +/* "View.MemoryView":992 * * @property * def base(self): # <<<<<<<<<<<<<< @@ -21636,7 +23887,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":988 + /* "View.MemoryView":993 * @property * def base(self): * return self.from_object # <<<<<<<<<<<<<< @@ -21648,7 +23899,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__ __pyx_r = __pyx_v_self->from_object; goto __pyx_L0; - /* "View.MemoryView":987 + /* "View.MemoryView":992 * * @property * def base(self): # <<<<<<<<<<<<<< @@ -21694,7 +23945,7 @@ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __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; @@ -21747,7 +23998,7 @@ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUS * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __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; @@ -21770,7 +24021,7 @@ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUS return __pyx_r; } -/* "View.MemoryView":994 +/* "View.MemoryView":999 * * @cname('__pyx_memoryview_fromslice') * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< @@ -21795,7 +24046,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl Py_ssize_t __pyx_t_9; __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - /* "View.MemoryView":1002 + /* "View.MemoryView":1007 * cdef _memoryviewslice result * * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< @@ -21805,7 +24056,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":1003 + /* "View.MemoryView":1008 * * if memviewslice.memview == Py_None: * return None # <<<<<<<<<<<<<< @@ -21816,7 +24067,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "View.MemoryView":1002 + /* "View.MemoryView":1007 * cdef _memoryviewslice result * * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< @@ -21825,16 +24076,16 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ } - /* "View.MemoryView":1008 + /* "View.MemoryView":1013 * * * 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_ERR(2, 1008, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1008, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); @@ -21845,13 +24096,13 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1008, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __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":1010 + /* "View.MemoryView":1015 * result = _memoryviewslice(None, 0, dtype_is_object) * * result.from_slice = memviewslice # <<<<<<<<<<<<<< @@ -21860,7 +24111,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "View.MemoryView":1011 + /* "View.MemoryView":1016 * * result.from_slice = memviewslice * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< @@ -21869,14 +24120,14 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "View.MemoryView":1013 + /* "View.MemoryView":1018 * __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_ERR(2, 1013, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_result->from_object); @@ -21884,7 +24135,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":1014 + /* "View.MemoryView":1019 * * result.from_object = ( memviewslice.memview).base * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< @@ -21894,7 +24145,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":1016 + /* "View.MemoryView":1021 * result.typeinfo = memviewslice.memview.typeinfo * * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< @@ -21904,7 +24155,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":1017 + /* "View.MemoryView":1022 * * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< @@ -21913,7 +24164,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":1018 + /* "View.MemoryView":1023 * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data * result.view.ndim = ndim # <<<<<<<<<<<<<< @@ -21922,7 +24173,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* "View.MemoryView":1019 + /* "View.MemoryView":1024 * result.view.buf = memviewslice.data * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< @@ -21931,7 +24182,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - /* "View.MemoryView":1020 + /* "View.MemoryView":1025 * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -21940,7 +24191,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ Py_INCREF(Py_None); - /* "View.MemoryView":1022 + /* "View.MemoryView":1027 * Py_INCREF(Py_None) * * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< @@ -21950,7 +24201,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1023 + /* "View.MemoryView":1028 * * if (memviewslice.memview).flags & PyBUF_WRITABLE: * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< @@ -21959,7 +24210,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - /* "View.MemoryView":1022 + /* "View.MemoryView":1027 * Py_INCREF(Py_None) * * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< @@ -21969,7 +24220,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl goto __pyx_L4; } - /* "View.MemoryView":1025 + /* "View.MemoryView":1030 * result.flags = PyBUF_RECORDS * else: * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< @@ -21981,7 +24232,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl } __pyx_L4:; - /* "View.MemoryView":1027 + /* "View.MemoryView":1032 * result.flags = PyBUF_RECORDS_RO * * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< @@ -21990,7 +24241,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":1028 + /* "View.MemoryView":1033 * * result.view.shape = result.from_slice.shape * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< @@ -21999,7 +24250,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":1031 + /* "View.MemoryView":1036 * * * result.view.suboffsets = NULL # <<<<<<<<<<<<<< @@ -22008,7 +24259,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.suboffsets = NULL; - /* "View.MemoryView":1032 + /* "View.MemoryView":1037 * * result.view.suboffsets = NULL * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< @@ -22020,7 +24271,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_6 = __pyx_t_8; __pyx_v_suboffset = (__pyx_t_6[0]); - /* "View.MemoryView":1033 + /* "View.MemoryView":1038 * result.view.suboffsets = NULL * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -22030,7 +24281,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1034 + /* "View.MemoryView":1039 * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< @@ -22039,7 +24290,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":1035 + /* "View.MemoryView":1040 * if suboffset >= 0: * result.view.suboffsets = result.from_slice.suboffsets * break # <<<<<<<<<<<<<< @@ -22048,7 +24299,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ goto __pyx_L6_break; - /* "View.MemoryView":1033 + /* "View.MemoryView":1038 * result.view.suboffsets = NULL * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -22059,7 +24310,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl } __pyx_L6_break:; - /* "View.MemoryView":1037 + /* "View.MemoryView":1042 * break * * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< @@ -22069,7 +24320,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - /* "View.MemoryView":1038 + /* "View.MemoryView":1043 * * result.view.len = result.view.itemsize * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< @@ -22079,29 +24330,29 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1038, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1039 + /* "View.MemoryView":1044 * result.view.len = result.view.itemsize * for length in result.view.shape[:ndim]: * result.view.len *= length # <<<<<<<<<<<<<< * * result.to_object_func = to_object_func */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1039, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1039, __pyx_L1_error) + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1039, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result->__pyx_base.view.len = __pyx_t_9; } - /* "View.MemoryView":1041 + /* "View.MemoryView":1046 * result.view.len *= length * * result.to_object_func = to_object_func # <<<<<<<<<<<<<< @@ -22110,7 +24361,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->to_object_func = __pyx_v_to_object_func; - /* "View.MemoryView":1042 + /* "View.MemoryView":1047 * * result.to_object_func = to_object_func * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< @@ -22119,7 +24370,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - /* "View.MemoryView":1044 + /* "View.MemoryView":1049 * result.to_dtype_func = to_dtype_func * * return result # <<<<<<<<<<<<<< @@ -22131,7 +24382,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "View.MemoryView":994 + /* "View.MemoryView":999 * * @cname('__pyx_memoryview_fromslice') * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< @@ -22153,7 +24404,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl return __pyx_r; } -/* "View.MemoryView":1047 +/* "View.MemoryView":1052 * * @cname('__pyx_memoryview_get_slice_from_memoryview') * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< @@ -22170,7 +24421,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - /* "View.MemoryView":1050 + /* "View.MemoryView":1055 * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -22181,20 +24432,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":1051 + /* "View.MemoryView":1056 * 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_ERR(2, 1051, __pyx_L1_error) + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __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":1052 + /* "View.MemoryView":1057 * if isinstance(memview, _memoryviewslice): * obj = memview * return &obj.from_slice # <<<<<<<<<<<<<< @@ -22204,7 +24455,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p __pyx_r = (&__pyx_v_obj->from_slice); goto __pyx_L0; - /* "View.MemoryView":1050 + /* "View.MemoryView":1055 * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -22213,7 +24464,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p */ } - /* "View.MemoryView":1054 + /* "View.MemoryView":1059 * return &obj.from_slice * else: * slice_copy(memview, mslice) # <<<<<<<<<<<<<< @@ -22223,7 +24474,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p /*else*/ { __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - /* "View.MemoryView":1055 + /* "View.MemoryView":1060 * else: * slice_copy(memview, mslice) * return mslice # <<<<<<<<<<<<<< @@ -22234,7 +24485,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p goto __pyx_L0; } - /* "View.MemoryView":1047 + /* "View.MemoryView":1052 * * @cname('__pyx_memoryview_get_slice_from_memoryview') * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< @@ -22253,7 +24504,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p return __pyx_r; } -/* "View.MemoryView":1058 +/* "View.MemoryView":1063 * * @cname('__pyx_memoryview_slice_copy') * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< @@ -22274,7 +24525,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem Py_ssize_t __pyx_t_5; __Pyx_RefNannySetupContext("slice_copy", 0); - /* "View.MemoryView":1062 + /* "View.MemoryView":1067 * cdef (Py_ssize_t*) shape, strides, suboffsets * * shape = memview.view.shape # <<<<<<<<<<<<<< @@ -22284,7 +24535,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":1063 + /* "View.MemoryView":1068 * * shape = memview.view.shape * strides = memview.view.strides # <<<<<<<<<<<<<< @@ -22294,7 +24545,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":1064 + /* "View.MemoryView":1069 * shape = memview.view.shape * strides = memview.view.strides * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< @@ -22304,7 +24555,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":1066 + /* "View.MemoryView":1071 * suboffsets = memview.view.suboffsets * * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< @@ -22313,7 +24564,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":1067 + /* "View.MemoryView":1072 * * dst.memview = <__pyx_memoryview *> memview * dst.data = memview.view.buf # <<<<<<<<<<<<<< @@ -22322,7 +24573,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":1069 + /* "View.MemoryView":1074 * dst.data = memview.view.buf * * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< @@ -22334,7 +24585,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_dim = __pyx_t_4; - /* "View.MemoryView":1070 + /* "View.MemoryView":1075 * * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< @@ -22343,7 +24594,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":1071 + /* "View.MemoryView":1076 * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< @@ -22352,7 +24603,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":1072 + /* "View.MemoryView":1077 * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< @@ -22367,7 +24618,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; } - /* "View.MemoryView":1058 + /* "View.MemoryView":1063 * * @cname('__pyx_memoryview_slice_copy') * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< @@ -22379,7 +24630,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":1075 +/* "View.MemoryView":1080 * * @cname('__pyx_memoryview_copy_object') * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< @@ -22394,7 +24645,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* "View.MemoryView":1078 + /* "View.MemoryView":1083 * "Create a new memoryview object" * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< @@ -22403,7 +24654,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx */ __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - /* "View.MemoryView":1079 + /* "View.MemoryView":1084 * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< @@ -22411,13 +24662,13 @@ 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_ERR(2, 1079, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":1075 + /* "View.MemoryView":1080 * * @cname('__pyx_memoryview_copy_object') * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< @@ -22436,7 +24687,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx return __pyx_r; } -/* "View.MemoryView":1082 +/* "View.MemoryView":1087 * * @cname('__pyx_memoryview_copy_object_from_slice') * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< @@ -22456,7 +24707,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "View.MemoryView":1089 + /* "View.MemoryView":1094 * cdef int (*to_dtype_func)(char *, object) except 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -22467,7 +24718,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":1090 + /* "View.MemoryView":1095 * * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< @@ -22477,7 +24728,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":1091 + /* "View.MemoryView":1096 * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< @@ -22487,7 +24738,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; __pyx_v_to_dtype_func = __pyx_t_4; - /* "View.MemoryView":1089 + /* "View.MemoryView":1094 * cdef int (*to_dtype_func)(char *, object) except 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -22497,7 +24748,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview goto __pyx_L3; } - /* "View.MemoryView":1093 + /* "View.MemoryView":1098 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func * else: * to_object_func = NULL # <<<<<<<<<<<<<< @@ -22507,7 +24758,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview /*else*/ { __pyx_v_to_object_func = NULL; - /* "View.MemoryView":1094 + /* "View.MemoryView":1099 * else: * to_object_func = NULL * to_dtype_func = NULL # <<<<<<<<<<<<<< @@ -22518,7 +24769,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview } __pyx_L3:; - /* "View.MemoryView":1096 + /* "View.MemoryView":1101 * to_dtype_func = NULL * * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< @@ -22527,20 +24778,20 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview */ __Pyx_XDECREF(__pyx_r); - /* "View.MemoryView":1098 + /* "View.MemoryView":1103 * 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_ERR(2, 1096, __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_ERR(2, 1101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "View.MemoryView":1082 + /* "View.MemoryView":1087 * * @cname('__pyx_memoryview_copy_object_from_slice') * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< @@ -22559,7 +24810,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview return __pyx_r; } -/* "View.MemoryView":1104 +/* "View.MemoryView":1109 * * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< @@ -22571,7 +24822,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":1105 + /* "View.MemoryView":1110 * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: # <<<<<<<<<<<<<< @@ -22581,7 +24832,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":1106 + /* "View.MemoryView":1111 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: * return -arg # <<<<<<<<<<<<<< @@ -22591,7 +24842,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { __pyx_r = (-__pyx_v_arg); goto __pyx_L0; - /* "View.MemoryView":1105 + /* "View.MemoryView":1110 * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: # <<<<<<<<<<<<<< @@ -22600,7 +24851,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { */ } - /* "View.MemoryView":1108 + /* "View.MemoryView":1113 * return -arg * else: * return arg # <<<<<<<<<<<<<< @@ -22612,7 +24863,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { goto __pyx_L0; } - /* "View.MemoryView":1104 + /* "View.MemoryView":1109 * * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< @@ -22625,7 +24876,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { return __pyx_r; } -/* "View.MemoryView":1111 +/* "View.MemoryView":1116 * * @cname('__pyx_get_best_slice_order') * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< @@ -22643,7 +24894,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ int __pyx_t_3; int __pyx_t_4; - /* "View.MemoryView":1116 + /* "View.MemoryView":1121 * """ * cdef int i * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< @@ -22652,7 +24903,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_c_stride = 0; - /* "View.MemoryView":1117 + /* "View.MemoryView":1122 * cdef int i * cdef Py_ssize_t c_stride = 0 * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< @@ -22661,7 +24912,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_f_stride = 0; - /* "View.MemoryView":1119 + /* "View.MemoryView":1124 * cdef Py_ssize_t f_stride = 0 * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -22671,7 +24922,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":1120 + /* "View.MemoryView":1125 * * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -22681,7 +24932,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":1121 + /* "View.MemoryView":1126 * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< @@ -22690,7 +24941,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":1122 + /* "View.MemoryView":1127 * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< @@ -22699,7 +24950,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ goto __pyx_L4_break; - /* "View.MemoryView":1120 + /* "View.MemoryView":1125 * * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -22710,7 +24961,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ } __pyx_L4_break:; - /* "View.MemoryView":1124 + /* "View.MemoryView":1129 * break * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -22722,7 +24973,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1125 + /* "View.MemoryView":1130 * * for i in range(ndim): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -22732,7 +24983,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":1126 + /* "View.MemoryView":1131 * for i in range(ndim): * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< @@ -22741,7 +24992,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":1127 + /* "View.MemoryView":1132 * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< @@ -22750,7 +25001,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ goto __pyx_L7_break; - /* "View.MemoryView":1125 + /* "View.MemoryView":1130 * * for i in range(ndim): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -22761,7 +25012,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ } __pyx_L7_break:; - /* "View.MemoryView":1129 + /* "View.MemoryView":1134 * break * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< @@ -22771,7 +25022,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":1130 + /* "View.MemoryView":1135 * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): * return 'C' # <<<<<<<<<<<<<< @@ -22781,7 +25032,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_r = 'C'; goto __pyx_L0; - /* "View.MemoryView":1129 + /* "View.MemoryView":1134 * break * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< @@ -22790,7 +25041,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ } - /* "View.MemoryView":1132 + /* "View.MemoryView":1137 * return 'C' * else: * return 'F' # <<<<<<<<<<<<<< @@ -22802,7 +25053,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ goto __pyx_L0; } - /* "View.MemoryView":1111 + /* "View.MemoryView":1116 * * @cname('__pyx_get_best_slice_order') * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< @@ -22815,7 +25066,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ return __pyx_r; } -/* "View.MemoryView":1135 +/* "View.MemoryView":1140 * * @cython.cdivision(True) * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< @@ -22836,7 +25087,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; - /* "View.MemoryView":1142 + /* "View.MemoryView":1147 * * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< @@ -22845,7 +25096,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":1143 + /* "View.MemoryView":1148 * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< @@ -22854,7 +25105,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":1144 + /* "View.MemoryView":1149 * 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] # <<<<<<<<<<<<<< @@ -22863,7 +25114,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":1145 + /* "View.MemoryView":1150 * 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] # <<<<<<<<<<<<<< @@ -22872,7 +25123,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":1147 + /* "View.MemoryView":1152 * cdef Py_ssize_t dst_stride = dst_strides[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -22882,7 +25133,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1148 + /* "View.MemoryView":1153 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< @@ -22902,7 +25153,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v goto __pyx_L5_bool_binop_done; } - /* "View.MemoryView":1149 + /* "View.MemoryView":1154 * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< @@ -22917,7 +25168,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v __pyx_t_1 = __pyx_t_3; __pyx_L5_bool_binop_done:; - /* "View.MemoryView":1148 + /* "View.MemoryView":1153 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< @@ -22926,7 +25177,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ if (__pyx_t_1) { - /* "View.MemoryView":1150 + /* "View.MemoryView":1155 * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< @@ -22935,7 +25186,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - /* "View.MemoryView":1148 + /* "View.MemoryView":1153 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< @@ -22945,7 +25196,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v goto __pyx_L4; } - /* "View.MemoryView":1152 + /* "View.MemoryView":1157 * memcpy(dst_data, src_data, itemsize * dst_extent) * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< @@ -22958,7 +25209,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1153 + /* "View.MemoryView":1158 * else: * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< @@ -22967,7 +25218,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - /* "View.MemoryView":1154 + /* "View.MemoryView":1159 * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< @@ -22976,7 +25227,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":1155 + /* "View.MemoryView":1160 * memcpy(dst_data, src_data, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< @@ -22988,7 +25239,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } __pyx_L4:; - /* "View.MemoryView":1147 + /* "View.MemoryView":1152 * cdef Py_ssize_t dst_stride = dst_strides[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -22998,7 +25249,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v goto __pyx_L3; } - /* "View.MemoryView":1157 + /* "View.MemoryView":1162 * dst_data += dst_stride * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< @@ -23011,7 +25262,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1158 + /* "View.MemoryView":1163 * else: * for i in range(dst_extent): * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< @@ -23020,7 +25271,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ _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":1162 + /* "View.MemoryView":1167 * src_shape + 1, dst_shape + 1, * ndim - 1, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< @@ -23029,7 +25280,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":1163 + /* "View.MemoryView":1168 * ndim - 1, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< @@ -23041,7 +25292,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } __pyx_L3:; - /* "View.MemoryView":1135 + /* "View.MemoryView":1140 * * @cython.cdivision(True) * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< @@ -23052,7 +25303,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v /* function exit code */ } -/* "View.MemoryView":1165 +/* "View.MemoryView":1170 * dst_data += dst_stride * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -23062,7 +25313,7 @@ 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":1168 + /* "View.MemoryView":1173 * __Pyx_memviewslice *dst, * int ndim, size_t itemsize) nogil: * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< @@ -23071,7 +25322,7 @@ static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memvi */ _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":1165 + /* "View.MemoryView":1170 * dst_data += dst_stride * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -23082,7 +25333,7 @@ static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memvi /* function exit code */ } -/* "View.MemoryView":1172 +/* "View.MemoryView":1177 * * @cname('__pyx_memoryview_slice_get_size') * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< @@ -23099,7 +25350,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr int __pyx_t_3; int __pyx_t_4; - /* "View.MemoryView":1175 + /* "View.MemoryView":1180 * "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 # <<<<<<<<<<<<<< @@ -23109,7 +25360,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":1177 + /* "View.MemoryView":1182 * cdef Py_ssize_t size = src.memview.view.itemsize * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -23121,7 +25372,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1178 + /* "View.MemoryView":1183 * * for i in range(ndim): * size *= src.shape[i] # <<<<<<<<<<<<<< @@ -23131,7 +25382,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":1180 + /* "View.MemoryView":1185 * size *= src.shape[i] * * return size # <<<<<<<<<<<<<< @@ -23141,7 +25392,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_r = __pyx_v_size; goto __pyx_L0; - /* "View.MemoryView":1172 + /* "View.MemoryView":1177 * * @cname('__pyx_memoryview_slice_get_size') * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< @@ -23154,7 +25405,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr return __pyx_r; } -/* "View.MemoryView":1183 +/* "View.MemoryView":1188 * * @cname('__pyx_fill_contig_strides_array') * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< @@ -23170,7 +25421,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ int __pyx_t_3; int __pyx_t_4; - /* "View.MemoryView":1192 + /* "View.MemoryView":1197 * cdef int idx * * if order == 'F': # <<<<<<<<<<<<<< @@ -23180,7 +25431,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":1193 + /* "View.MemoryView":1198 * * if order == 'F': * for idx in range(ndim): # <<<<<<<<<<<<<< @@ -23192,7 +25443,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_idx = __pyx_t_4; - /* "View.MemoryView":1194 + /* "View.MemoryView":1199 * if order == 'F': * for idx in range(ndim): * strides[idx] = stride # <<<<<<<<<<<<<< @@ -23201,7 +25452,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":1195 + /* "View.MemoryView":1200 * for idx in range(ndim): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< @@ -23211,7 +25462,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } - /* "View.MemoryView":1192 + /* "View.MemoryView":1197 * cdef int idx * * if order == 'F': # <<<<<<<<<<<<<< @@ -23221,7 +25472,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ goto __pyx_L3; } - /* "View.MemoryView":1197 + /* "View.MemoryView":1202 * stride = stride * shape[idx] * else: * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -23232,7 +25483,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":1198 + /* "View.MemoryView":1203 * else: * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride # <<<<<<<<<<<<<< @@ -23241,7 +25492,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":1199 + /* "View.MemoryView":1204 * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< @@ -23253,7 +25504,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ } __pyx_L3:; - /* "View.MemoryView":1201 + /* "View.MemoryView":1206 * stride = stride * shape[idx] * * return stride # <<<<<<<<<<<<<< @@ -23263,7 +25514,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ __pyx_r = __pyx_v_stride; goto __pyx_L0; - /* "View.MemoryView":1183 + /* "View.MemoryView":1188 * * @cname('__pyx_fill_contig_strides_array') * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< @@ -23276,7 +25527,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ return __pyx_r; } -/* "View.MemoryView":1204 +/* "View.MemoryView":1209 * * @cname('__pyx_memoryview_copy_data_to_temp') * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -23297,7 +25548,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, int __pyx_t_5; int __pyx_t_6; - /* "View.MemoryView":1215 + /* "View.MemoryView":1220 * cdef void *result * * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -23307,7 +25558,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":1216 + /* "View.MemoryView":1221 * * cdef size_t itemsize = src.memview.view.itemsize * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< @@ -23316,7 +25567,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":1218 + /* "View.MemoryView":1223 * cdef size_t size = slice_get_size(src, ndim) * * result = malloc(size) # <<<<<<<<<<<<<< @@ -23325,7 +25576,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_result = malloc(__pyx_v_size); - /* "View.MemoryView":1219 + /* "View.MemoryView":1224 * * result = malloc(size) * if not result: # <<<<<<<<<<<<<< @@ -23335,16 +25586,16 @@ 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":1220 + /* "View.MemoryView":1225 * result = malloc(size) * if not result: * _err(MemoryError, NULL) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1220, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1225, __pyx_L1_error) - /* "View.MemoryView":1219 + /* "View.MemoryView":1224 * * result = malloc(size) * if not result: # <<<<<<<<<<<<<< @@ -23353,7 +25604,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ } - /* "View.MemoryView":1223 + /* "View.MemoryView":1228 * * * tmpslice.data = result # <<<<<<<<<<<<<< @@ -23362,7 +25613,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "View.MemoryView":1224 + /* "View.MemoryView":1229 * * tmpslice.data = result * tmpslice.memview = src.memview # <<<<<<<<<<<<<< @@ -23372,7 +25623,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":1225 + /* "View.MemoryView":1230 * tmpslice.data = result * tmpslice.memview = src.memview * for i in range(ndim): # <<<<<<<<<<<<<< @@ -23384,7 +25635,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1226 + /* "View.MemoryView":1231 * tmpslice.memview = src.memview * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< @@ -23393,7 +25644,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":1227 + /* "View.MemoryView":1232 * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< @@ -23403,7 +25654,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; } - /* "View.MemoryView":1229 + /* "View.MemoryView":1234 * tmpslice.suboffsets[i] = -1 * * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< @@ -23412,7 +25663,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ (void)(__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":1233 + /* "View.MemoryView":1238 * * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -23424,7 +25675,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1234 + /* "View.MemoryView":1239 * * for i in range(ndim): * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< @@ -23434,7 +25685,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":1235 + /* "View.MemoryView":1240 * for i in range(ndim): * if tmpslice.shape[i] == 1: * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< @@ -23443,7 +25694,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - /* "View.MemoryView":1234 + /* "View.MemoryView":1239 * * for i in range(ndim): * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< @@ -23453,7 +25704,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, } } - /* "View.MemoryView":1237 + /* "View.MemoryView":1242 * tmpslice.strides[i] = 0 * * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< @@ -23463,7 +25714,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1238 + /* "View.MemoryView":1243 * * if slice_is_contig(src[0], order, ndim): * memcpy(result, src.data, size) # <<<<<<<<<<<<<< @@ -23472,7 +25723,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - /* "View.MemoryView":1237 + /* "View.MemoryView":1242 * tmpslice.strides[i] = 0 * * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< @@ -23482,7 +25733,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, goto __pyx_L9; } - /* "View.MemoryView":1240 + /* "View.MemoryView":1245 * memcpy(result, src.data, size) * else: * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< @@ -23494,7 +25745,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, } __pyx_L9:; - /* "View.MemoryView":1242 + /* "View.MemoryView":1247 * copy_strided_to_strided(src, tmpslice, ndim, itemsize) * * return result # <<<<<<<<<<<<<< @@ -23504,7 +25755,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "View.MemoryView":1204 + /* "View.MemoryView":1209 * * @cname('__pyx_memoryview_copy_data_to_temp') * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -23528,7 +25779,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, return __pyx_r; } -/* "View.MemoryView":1247 +/* "View.MemoryView":1252 * * @cname('__pyx_memoryview_err_extents') * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< @@ -23548,20 +25799,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":1250 + /* "View.MemoryView":1255 * 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 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1250, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1250, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1250, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1250, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -23573,24 +25824,24 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent __pyx_t_2 = 0; __pyx_t_3 = 0; - /* "View.MemoryView":1249 + /* "View.MemoryView":1254 * 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_ERR(2, 1249, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1249, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __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_ERR(2, 1249, __pyx_L1_error) + __PYX_ERR(2, 1254, __pyx_L1_error) - /* "View.MemoryView":1247 + /* "View.MemoryView":1252 * * @cname('__pyx_memoryview_err_extents') * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< @@ -23613,7 +25864,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent return __pyx_r; } -/* "View.MemoryView":1253 +/* "View.MemoryView":1258 * * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< @@ -23628,25 +25879,24 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err_dim", 0); __Pyx_INCREF(__pyx_v_error); - /* "View.MemoryView":1254 + /* "View.MemoryView":1259 * @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_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __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_ERR(2, 1259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error) + __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -23661,47 +25911,17 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, __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_ERR(2, 1254, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __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_ERR(2, 1254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1259, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __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_ERR(2, 1254, __pyx_L1_error) + __PYX_ERR(2, 1259, __pyx_L1_error) - /* "View.MemoryView":1253 + /* "View.MemoryView":1258 * * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< @@ -23715,7 +25935,6 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, __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_XDECREF(__pyx_v_error); @@ -23726,7 +25945,7 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, return __pyx_r; } -/* "View.MemoryView":1257 +/* "View.MemoryView":1262 * * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< @@ -23742,14 +25961,13 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err", 0); __Pyx_INCREF(__pyx_v_error); - /* "View.MemoryView":1258 + /* "View.MemoryView":1263 * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: # <<<<<<<<<<<<<< @@ -23759,14 +25977,14 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":1259 + /* "View.MemoryView":1264 * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< * else: * raise 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_ERR(2, 1259, __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_ERR(2, 1264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_error); __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; @@ -23779,47 +25997,17 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __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_ERR(2, 1259, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1259, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1259, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __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_ERR(2, 1259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __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_ERR(2, 1259, __pyx_L1_error) + __PYX_ERR(2, 1264, __pyx_L1_error) - /* "View.MemoryView":1258 + /* "View.MemoryView":1263 * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: # <<<<<<<<<<<<<< @@ -23828,7 +26016,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { */ } - /* "View.MemoryView":1261 + /* "View.MemoryView":1266 * raise error(msg.decode('ascii')) * else: * raise error # <<<<<<<<<<<<<< @@ -23837,10 +26025,10 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { */ /*else*/ { __Pyx_Raise(__pyx_v_error, 0, 0, 0); - __PYX_ERR(2, 1261, __pyx_L1_error) + __PYX_ERR(2, 1266, __pyx_L1_error) } - /* "View.MemoryView":1257 + /* "View.MemoryView":1262 * * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< @@ -23854,7 +26042,6 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __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_XDECREF(__pyx_v_error); @@ -23865,7 +26052,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { return __pyx_r; } -/* "View.MemoryView":1264 +/* "View.MemoryView":1269 * * @cname('__pyx_memoryview_copy_contents') * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< @@ -23892,7 +26079,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ void *__pyx_t_7; int __pyx_t_8; - /* "View.MemoryView":1272 + /* "View.MemoryView":1277 * Check for overlapping memory and verify the shapes. * """ * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< @@ -23901,7 +26088,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_tmpdata = NULL; - /* "View.MemoryView":1273 + /* "View.MemoryView":1278 * """ * cdef void *tmpdata = NULL * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -23911,7 +26098,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":1275 + /* "View.MemoryView":1280 * cdef size_t itemsize = src.memview.view.itemsize * cdef int i * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< @@ -23920,7 +26107,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":1276 + /* "View.MemoryView":1281 * cdef int i * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False # <<<<<<<<<<<<<< @@ -23929,7 +26116,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_broadcasting = 0; - /* "View.MemoryView":1277 + /* "View.MemoryView":1282 * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False * cdef bint direct_copy = False # <<<<<<<<<<<<<< @@ -23938,7 +26125,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_direct_copy = 0; - /* "View.MemoryView":1280 + /* "View.MemoryView":1285 * cdef __Pyx_memviewslice tmp * * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< @@ -23948,7 +26135,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":1281 + /* "View.MemoryView":1286 * * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< @@ -23957,7 +26144,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - /* "View.MemoryView":1280 + /* "View.MemoryView":1285 * cdef __Pyx_memviewslice tmp * * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< @@ -23967,7 +26154,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L3; } - /* "View.MemoryView":1282 + /* "View.MemoryView":1287 * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< @@ -23977,7 +26164,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":1283 + /* "View.MemoryView":1288 * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< @@ -23986,7 +26173,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* "View.MemoryView":1282 + /* "View.MemoryView":1287 * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< @@ -23996,7 +26183,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L3:; - /* "View.MemoryView":1285 + /* "View.MemoryView":1290 * broadcast_leading(&dst, dst_ndim, src_ndim) * * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< @@ -24012,7 +26199,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_v_ndim = __pyx_t_5; - /* "View.MemoryView":1287 + /* "View.MemoryView":1292 * cdef int ndim = max(src_ndim, dst_ndim) * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -24024,7 +26211,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1288 + /* "View.MemoryView":1293 * * for i in range(ndim): * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< @@ -24034,7 +26221,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":1289 + /* "View.MemoryView":1294 * for i in range(ndim): * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: # <<<<<<<<<<<<<< @@ -24044,7 +26231,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":1290 + /* "View.MemoryView":1295 * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: * broadcasting = True # <<<<<<<<<<<<<< @@ -24053,7 +26240,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_broadcasting = 1; - /* "View.MemoryView":1291 + /* "View.MemoryView":1296 * if src.shape[i] == 1: * broadcasting = True * src.strides[i] = 0 # <<<<<<<<<<<<<< @@ -24062,7 +26249,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ (__pyx_v_src.strides[__pyx_v_i]) = 0; - /* "View.MemoryView":1289 + /* "View.MemoryView":1294 * for i in range(ndim): * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: # <<<<<<<<<<<<<< @@ -24072,7 +26259,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L7; } - /* "View.MemoryView":1293 + /* "View.MemoryView":1298 * src.strides[i] = 0 * else: * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< @@ -24080,11 +26267,11 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * if src.suboffsets[i] >= 0: */ /*else*/ { - __pyx_t_6 = __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_6 == ((int)-1))) __PYX_ERR(2, 1293, __pyx_L1_error) + __pyx_t_6 = __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_6 == ((int)-1))) __PYX_ERR(2, 1298, __pyx_L1_error) } __pyx_L7:; - /* "View.MemoryView":1288 + /* "View.MemoryView":1293 * * for i in range(ndim): * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< @@ -24093,7 +26280,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1295 + /* "View.MemoryView":1300 * _err_extents(i, dst.shape[i], src.shape[i]) * * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< @@ -24103,16 +26290,16 @@ 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":1296 + /* "View.MemoryView":1301 * * if src.suboffsets[i] >= 0: * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< * * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1296, __pyx_L1_error) + __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1301, __pyx_L1_error) - /* "View.MemoryView":1295 + /* "View.MemoryView":1300 * _err_extents(i, dst.shape[i], src.shape[i]) * * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< @@ -24122,7 +26309,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } } - /* "View.MemoryView":1298 + /* "View.MemoryView":1303 * _err_dim(ValueError, "Dimension %d is not direct", i) * * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< @@ -24132,7 +26319,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":1300 + /* "View.MemoryView":1305 * if slices_overlap(&src, &dst, ndim, itemsize): * * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< @@ -24142,7 +26329,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":1301 + /* "View.MemoryView":1306 * * if not slice_is_contig(src, order, ndim): * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< @@ -24151,7 +26338,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - /* "View.MemoryView":1300 + /* "View.MemoryView":1305 * if slices_overlap(&src, &dst, ndim, itemsize): * * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< @@ -24160,17 +26347,17 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1303 + /* "View.MemoryView":1308 * order = get_best_order(&dst, ndim) * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< * src = tmp * */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1303, __pyx_L1_error) + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1308, __pyx_L1_error) __pyx_v_tmpdata = __pyx_t_7; - /* "View.MemoryView":1304 + /* "View.MemoryView":1309 * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) * src = tmp # <<<<<<<<<<<<<< @@ -24179,7 +26366,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_src = __pyx_v_tmp; - /* "View.MemoryView":1298 + /* "View.MemoryView":1303 * _err_dim(ValueError, "Dimension %d is not direct", i) * * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< @@ -24188,7 +26375,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1306 + /* "View.MemoryView":1311 * src = tmp * * if not broadcasting: # <<<<<<<<<<<<<< @@ -24198,7 +26385,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":1309 + /* "View.MemoryView":1314 * * * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< @@ -24208,7 +26395,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":1310 + /* "View.MemoryView":1315 * * if slice_is_contig(src, 'C', ndim): * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< @@ -24217,7 +26404,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); - /* "View.MemoryView":1309 + /* "View.MemoryView":1314 * * * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< @@ -24227,7 +26414,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L12; } - /* "View.MemoryView":1311 + /* "View.MemoryView":1316 * if slice_is_contig(src, 'C', ndim): * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< @@ -24237,7 +26424,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":1312 + /* "View.MemoryView":1317 * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< @@ -24246,7 +26433,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - /* "View.MemoryView":1311 + /* "View.MemoryView":1316 * if slice_is_contig(src, 'C', ndim): * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< @@ -24256,7 +26443,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L12:; - /* "View.MemoryView":1314 + /* "View.MemoryView":1319 * direct_copy = slice_is_contig(dst, 'F', ndim) * * if direct_copy: # <<<<<<<<<<<<<< @@ -24266,7 +26453,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":1316 + /* "View.MemoryView":1321 * if direct_copy: * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -24275,7 +26462,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":1317 + /* "View.MemoryView":1322 * * refcount_copying(&dst, dtype_is_object, ndim, False) * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< @@ -24284,7 +26471,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "View.MemoryView":1318 + /* "View.MemoryView":1323 * 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) # <<<<<<<<<<<<<< @@ -24293,7 +26480,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":1319 + /* "View.MemoryView":1324 * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) * free(tmpdata) # <<<<<<<<<<<<<< @@ -24302,7 +26489,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ free(__pyx_v_tmpdata); - /* "View.MemoryView":1320 + /* "View.MemoryView":1325 * refcount_copying(&dst, dtype_is_object, ndim, True) * free(tmpdata) * return 0 # <<<<<<<<<<<<<< @@ -24312,7 +26499,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":1314 + /* "View.MemoryView":1319 * direct_copy = slice_is_contig(dst, 'F', ndim) * * if direct_copy: # <<<<<<<<<<<<<< @@ -24321,7 +26508,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1306 + /* "View.MemoryView":1311 * src = tmp * * if not broadcasting: # <<<<<<<<<<<<<< @@ -24330,7 +26517,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1322 + /* "View.MemoryView":1327 * return 0 * * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< @@ -24344,25 +26531,25 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_8 = (__pyx_t_2 != 0); if (__pyx_t_8) { - /* "View.MemoryView":1325 + /* "View.MemoryView":1330 * * * transpose_memslice(&src) # <<<<<<<<<<<<<< * transpose_memslice(&dst) * */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1325, __pyx_L1_error) + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error) - /* "View.MemoryView":1326 + /* "View.MemoryView":1331 * * 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 == ((int)0))) __PYX_ERR(2, 1326, __pyx_L1_error) + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error) - /* "View.MemoryView":1322 + /* "View.MemoryView":1327 * return 0 * * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< @@ -24371,7 +26558,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1328 + /* "View.MemoryView":1333 * transpose_memslice(&dst) * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -24380,7 +26567,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":1329 + /* "View.MemoryView":1334 * * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< @@ -24389,7 +26576,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":1330 + /* "View.MemoryView":1335 * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -24398,7 +26585,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":1332 + /* "View.MemoryView":1337 * refcount_copying(&dst, dtype_is_object, ndim, True) * * free(tmpdata) # <<<<<<<<<<<<<< @@ -24407,7 +26594,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ free(__pyx_v_tmpdata); - /* "View.MemoryView":1333 + /* "View.MemoryView":1338 * * free(tmpdata) * return 0 # <<<<<<<<<<<<<< @@ -24417,7 +26604,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":1264 + /* "View.MemoryView":1269 * * @cname('__pyx_memoryview_copy_contents') * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< @@ -24441,7 +26628,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ return __pyx_r; } -/* "View.MemoryView":1336 +/* "View.MemoryView":1341 * * @cname('__pyx_memoryview_broadcast_leading') * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< @@ -24456,7 +26643,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":1340 + /* "View.MemoryView":1345 * int ndim_other) nogil: * cdef int i * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< @@ -24465,7 +26652,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "View.MemoryView":1342 + /* "View.MemoryView":1347 * cdef int offset = ndim_other - ndim * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -24475,7 +26662,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":1343 + /* "View.MemoryView":1348 * * for i in range(ndim - 1, -1, -1): * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< @@ -24484,7 +26671,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - /* "View.MemoryView":1344 + /* "View.MemoryView":1349 * for i in range(ndim - 1, -1, -1): * mslice.shape[i + offset] = mslice.shape[i] * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< @@ -24493,7 +26680,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":1345 + /* "View.MemoryView":1350 * mslice.shape[i + offset] = mslice.shape[i] * mslice.strides[i + offset] = mslice.strides[i] * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< @@ -24503,7 +26690,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); } - /* "View.MemoryView":1347 + /* "View.MemoryView":1352 * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * * for i in range(offset): # <<<<<<<<<<<<<< @@ -24515,7 +26702,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1348 + /* "View.MemoryView":1353 * * for i in range(offset): * mslice.shape[i] = 1 # <<<<<<<<<<<<<< @@ -24524,7 +26711,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - /* "View.MemoryView":1349 + /* "View.MemoryView":1354 * for i in range(offset): * mslice.shape[i] = 1 * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< @@ -24533,7 +26720,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - /* "View.MemoryView":1350 + /* "View.MemoryView":1355 * mslice.shape[i] = 1 * mslice.strides[i] = mslice.strides[0] * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< @@ -24543,7 +26730,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; } - /* "View.MemoryView":1336 + /* "View.MemoryView":1341 * * @cname('__pyx_memoryview_broadcast_leading') * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< @@ -24554,7 +26741,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic /* function exit code */ } -/* "View.MemoryView":1358 +/* "View.MemoryView":1363 * * @cname('__pyx_memoryview_refcount_copying') * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< @@ -24565,7 +26752,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic 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":1362 + /* "View.MemoryView":1367 * * * if dtype_is_object: # <<<<<<<<<<<<<< @@ -24575,7 +26762,7 @@ 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":1363 + /* "View.MemoryView":1368 * * if dtype_is_object: * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< @@ -24584,7 +26771,7 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i */ __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); - /* "View.MemoryView":1362 + /* "View.MemoryView":1367 * * * if dtype_is_object: # <<<<<<<<<<<<<< @@ -24593,7 +26780,7 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i */ } - /* "View.MemoryView":1358 + /* "View.MemoryView":1363 * * @cname('__pyx_memoryview_refcount_copying') * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< @@ -24604,7 +26791,7 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i /* function exit code */ } -/* "View.MemoryView":1367 +/* "View.MemoryView":1372 * * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24619,7 +26806,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":1370 + /* "View.MemoryView":1375 * Py_ssize_t *strides, int ndim, * bint inc) with gil: * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< @@ -24628,7 +26815,7 @@ 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":1367 + /* "View.MemoryView":1372 * * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24643,7 +26830,7 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da #endif } -/* "View.MemoryView":1373 +/* "View.MemoryView":1378 * * @cname('__pyx_memoryview_refcount_objects_in_slice') * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24660,7 +26847,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss int __pyx_t_4; __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - /* "View.MemoryView":1377 + /* "View.MemoryView":1382 * cdef Py_ssize_t i * * for i in range(shape[0]): # <<<<<<<<<<<<<< @@ -24672,7 +26859,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1378 + /* "View.MemoryView":1383 * * for i in range(shape[0]): * if ndim == 1: # <<<<<<<<<<<<<< @@ -24682,7 +26869,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_4) { - /* "View.MemoryView":1379 + /* "View.MemoryView":1384 * for i in range(shape[0]): * if ndim == 1: * if inc: # <<<<<<<<<<<<<< @@ -24692,7 +26879,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_t_4 = (__pyx_v_inc != 0); if (__pyx_t_4) { - /* "View.MemoryView":1380 + /* "View.MemoryView":1385 * if ndim == 1: * if inc: * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< @@ -24701,7 +26888,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss */ Py_INCREF((((PyObject **)__pyx_v_data)[0])); - /* "View.MemoryView":1379 + /* "View.MemoryView":1384 * for i in range(shape[0]): * if ndim == 1: * if inc: # <<<<<<<<<<<<<< @@ -24711,7 +26898,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss goto __pyx_L6; } - /* "View.MemoryView":1382 + /* "View.MemoryView":1387 * Py_INCREF(( data)[0]) * else: * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< @@ -24723,7 +26910,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss } __pyx_L6:; - /* "View.MemoryView":1378 + /* "View.MemoryView":1383 * * for i in range(shape[0]): * if ndim == 1: # <<<<<<<<<<<<<< @@ -24733,7 +26920,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss goto __pyx_L5; } - /* "View.MemoryView":1384 + /* "View.MemoryView":1389 * Py_DECREF(( data)[0]) * else: * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< @@ -24742,7 +26929,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss */ /*else*/ { - /* "View.MemoryView":1385 + /* "View.MemoryView":1390 * else: * refcount_objects_in_slice(data, shape + 1, strides + 1, * ndim - 1, inc) # <<<<<<<<<<<<<< @@ -24753,7 +26940,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss } __pyx_L5:; - /* "View.MemoryView":1387 + /* "View.MemoryView":1392 * ndim - 1, inc) * * data += strides[0] # <<<<<<<<<<<<<< @@ -24763,7 +26950,7 @@ 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":1373 + /* "View.MemoryView":1378 * * @cname('__pyx_memoryview_refcount_objects_in_slice') * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24775,7 +26962,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":1393 +/* "View.MemoryView":1398 * * @cname('__pyx_memoryview_slice_assign_scalar') * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< @@ -24785,7 +26972,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":1396 + /* "View.MemoryView":1401 * size_t itemsize, void *item, * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -24794,7 +26981,7 @@ 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":1397 + /* "View.MemoryView":1402 * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< @@ -24803,7 +26990,7 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst */ __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":1399 + /* "View.MemoryView":1404 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, * itemsize, item) * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -24812,7 +26999,7 @@ 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":1393 + /* "View.MemoryView":1398 * * @cname('__pyx_memoryview_slice_assign_scalar') * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< @@ -24823,7 +27010,7 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst /* function exit code */ } -/* "View.MemoryView":1403 +/* "View.MemoryView":1408 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24840,7 +27027,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t Py_ssize_t __pyx_t_3; Py_ssize_t __pyx_t_4; - /* "View.MemoryView":1407 + /* "View.MemoryView":1412 * size_t itemsize, void *item) nogil: * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< @@ -24849,7 +27036,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":1408 + /* "View.MemoryView":1413 * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< @@ -24858,7 +27045,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __pyx_v_extent = (__pyx_v_shape[0]); - /* "View.MemoryView":1410 + /* "View.MemoryView":1415 * cdef Py_ssize_t extent = shape[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -24868,7 +27055,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":1411 + /* "View.MemoryView":1416 * * if ndim == 1: * for i in range(extent): # <<<<<<<<<<<<<< @@ -24880,7 +27067,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1412 + /* "View.MemoryView":1417 * if ndim == 1: * for i in range(extent): * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< @@ -24889,7 +27076,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - /* "View.MemoryView":1413 + /* "View.MemoryView":1418 * for i in range(extent): * memcpy(data, item, itemsize) * data += stride # <<<<<<<<<<<<<< @@ -24899,7 +27086,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t __pyx_v_data = (__pyx_v_data + __pyx_v_stride); } - /* "View.MemoryView":1410 + /* "View.MemoryView":1415 * cdef Py_ssize_t extent = shape[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -24909,7 +27096,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t goto __pyx_L3; } - /* "View.MemoryView":1415 + /* "View.MemoryView":1420 * data += stride * else: * for i in range(extent): # <<<<<<<<<<<<<< @@ -24922,7 +27109,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1416 + /* "View.MemoryView":1421 * else: * for i in range(extent): * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< @@ -24931,7 +27118,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __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":1418 + /* "View.MemoryView":1423 * _slice_assign_scalar(data, shape + 1, strides + 1, * ndim - 1, itemsize, item) * data += stride # <<<<<<<<<<<<<< @@ -24943,7 +27130,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t } __pyx_L3:; - /* "View.MemoryView":1403 + /* "View.MemoryView":1408 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24956,13 +27143,13 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * if __pyx_checksum != 0xb068931: - * from pickle import PickleError as __pyx_PickleError + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; @@ -25034,8 +27221,8 @@ static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *_ } static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = NULL; - PyObject *__pyx_v___pyx_result = NULL; + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -25043,12 +27230,12 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + int __pyx_t_6; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); - /* "(tree fragment)":2 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) @@ -25056,38 +27243,38 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0); if (__pyx_t_1) { - /* "(tree fragment)":3 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + /* "(tree fragment)":5 + * cdef object __pyx_result * if __pyx_checksum != 0xb068931: * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error) + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_PickleError); __Pyx_GIVEREF(__pyx_n_s_PickleError); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 3, __pyx_L1_error) + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_v___pyx_PickleError = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "(tree fragment)":4 + /* "(tree fragment)":6 * if __pyx_checksum != 0xb068931: * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: */ - __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_v___pyx_PickleError); @@ -25101,110 +27288,53 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE __Pyx_DECREF_SET(__pyx_t_2, function); } } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __PYX_ERR(2, 6, __pyx_L1_error) - /* "(tree fragment)":2 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) */ } - /* "(tree fragment)":5 + /* "(tree fragment)":7 * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< * if __pyx_state is not None: * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = NULL; + __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } - if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_INCREF(__pyx_v___pyx_type); - __Pyx_GIVEREF(__pyx_v___pyx_type); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v___pyx_result = __pyx_t_3; __pyx_t_3 = 0; - /* "(tree fragment)":6 + /* "(tree fragment)":8 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< @@ -25212,22 +27342,22 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE * return __pyx_result */ __pyx_t_1 = (__pyx_v___pyx_state != Py_None); - __pyx_t_7 = (__pyx_t_1 != 0); - if (__pyx_t_7) { + __pyx_t_6 = (__pyx_t_1 != 0); + if (__pyx_t_6) { - /* "(tree fragment)":7 + /* "(tree fragment)":9 * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 7, __pyx_L1_error) - __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) + __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "(tree fragment)":6 + /* "(tree fragment)":8 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< @@ -25236,7 +27366,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE */ } - /* "(tree fragment)":8 + /* "(tree fragment)":10 * if __pyx_state is not None: * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result # <<<<<<<<<<<<<< @@ -25250,8 +27380,8 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * if __pyx_checksum != 0xb068931: - * from pickle import PickleError as __pyx_PickleError + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ @@ -25260,7 +27390,6 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -25271,7 +27400,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE return __pyx_r; } -/* "(tree fragment)":9 +/* "(tree fragment)":11 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< @@ -25290,10 +27419,9 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - /* "(tree fragment)":10 + /* "(tree fragment)":12 * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< @@ -25302,9 +27430,9 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 10, __pyx_L1_error) + __PYX_ERR(2, 12, __pyx_L1_error) } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->name); @@ -25312,7 +27440,7 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ __pyx_v___pyx_result->name = __pyx_t_1; __pyx_t_1 = 0; - /* "(tree fragment)":11 + /* "(tree fragment)":13 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< @@ -25320,36 +27448,36 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 11, __pyx_L1_error) + __PYX_ERR(2, 13, __pyx_L1_error) } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) __pyx_t_4 = ((__pyx_t_3 > 1) != 0); if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) __pyx_t_5 = (__pyx_t_4 != 0); __pyx_t_2 = __pyx_t_5; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { - /* "(tree fragment)":12 + /* "(tree fragment)":14 * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 12, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 12, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 12, __pyx_L1_error) + __PYX_ERR(2, 14, __pyx_L1_error) } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 12, __pyx_L1_error) + __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { @@ -25361,45 +27489,15 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ __Pyx_DECREF_SET(__pyx_t_7, function); } } - if (!__pyx_t_8) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } + __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":11 + /* "(tree fragment)":13 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< @@ -25407,7 +27505,7 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ */ } - /* "(tree fragment)":9 + /* "(tree fragment)":11 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< @@ -25423,7 +27521,6 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -25608,6 +27705,9 @@ static PyTypeObject __pyx_type___pyx_array = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif }; static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -25716,6 +27816,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif }; static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; @@ -25966,6 +28069,9 @@ static PyTypeObject __pyx_type___pyx_memoryview = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif }; static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; @@ -26101,10 +28207,12 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif }; static PyMethodDef __pyx_methods[] = { - {"lower_to_symmetric", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric, METH_O, __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric}, {0, 0, 0, 0} }; @@ -26139,6 +28247,15 @@ static struct PyModuleDef __pyx_moduledef = { NULL /* m_free */ }; #endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, @@ -26176,11 +28293,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 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_callback, __pyx_k_callback, sizeof(__pyx_k_callback), 0, 0, 1, 1}, {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 0, 1, 1}, {&__pyx_n_s_col1, __pyx_k_col1, sizeof(__pyx_k_col1), 0, 0, 1, 1}, {&__pyx_n_s_col2, __pyx_k_col2, sizeof(__pyx_k_col2), 0, 0, 1, 1}, + {&__pyx_n_s_col_start, __pyx_k_col_start, sizeof(__pyx_k_col_start), 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_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1}, @@ -26220,6 +28339,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ival2, __pyx_k_ival2, sizeof(__pyx_k_ival2), 0, 0, 1, 1}, {&__pyx_n_s_jaccard_cols, __pyx_k_jaccard_cols, sizeof(__pyx_k_jaccard_cols), 0, 0, 1, 1}, {&__pyx_n_s_jaccard_rows, __pyx_k_jaccard_rows, sizeof(__pyx_k_jaccard_rows), 0, 0, 1, 1}, + {&__pyx_n_s_lower_to_symmetric, __pyx_k_lower_to_symmetric, sizeof(__pyx_k_lower_to_symmetric), 0, 0, 1, 1}, {&__pyx_n_s_mads, __pyx_k_mads, sizeof(__pyx_k_mads), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_manhattan_cols, __pyx_k_manhattan_cols, sizeof(__pyx_k_manhattan_cols), 0, 0, 1, 1}, @@ -26241,6 +28361,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_next_callback, __pyx_k_next_callback, sizeof(__pyx_k_next_callback), 0, 0, 1, 1}, {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, {&__pyx_n_s_nonnans, __pyx_k_nonnans, sizeof(__pyx_k_nonnans), 0, 0, 1, 1}, {&__pyx_n_s_nonzeros, __pyx_k_nonzeros, sizeof(__pyx_k_nonzeros), 0, 0, 1, 1}, @@ -26250,8 +28371,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_not1_unk2, __pyx_k_not1_unk2, sizeof(__pyx_k_not1_unk2), 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_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0}, - {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0}, + {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, + {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, {&__pyx_n_s_p_nonzero, __pyx_k_p_nonzero, sizeof(__pyx_k_p_nonzero), 0, 0, 1, 1}, {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, @@ -26272,6 +28393,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_row, __pyx_k_row, sizeof(__pyx_k_row), 0, 0, 1, 1}, {&__pyx_n_s_row1, __pyx_k_row1, sizeof(__pyx_k_row1), 0, 0, 1, 1}, {&__pyx_n_s_row2, __pyx_k_row2, sizeof(__pyx_k_row2), 0, 0, 1, 1}, + {&__pyx_n_s_row_start, __pyx_k_row_start, sizeof(__pyx_k_row_start), 0, 0, 1, 1}, {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, @@ -26305,188 +28427,157 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_ERR(0, 20, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 229, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 810, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1000, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 147, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 150, __pyx_L1_error) +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 399, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 608, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } -static int __Pyx_InitCachedConstants(void) { +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":229 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 229, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":233 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 233, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":263 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306 * 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_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 263, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":810 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856 * * 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_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 810, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 856, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":814 - * 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_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":834 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880 * 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_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1000 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1000, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 1038, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1006 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1012 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1012, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); - /* "View.MemoryView":132 + /* "View.MemoryView":133 * * if not self.ndim: * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< * * if itemsize <= 0: */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "View.MemoryView":135 + /* "View.MemoryView":136 * * if itemsize <= 0: * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * * if not isinstance(format, bytes): */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 135, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - - /* "View.MemoryView":138 - * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_ASCII); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "View.MemoryView":147 + /* "View.MemoryView":148 * * if not self._shape: * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); - /* "View.MemoryView":175 + /* "View.MemoryView":176 * self.data = malloc(self.len) * if not self.data: * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< * * if self.dtype_is_object: */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 175, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); - /* "View.MemoryView":191 + /* "View.MemoryView":192 * 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_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 191, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -26494,76 +28585,76 @@ static int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); - /* "View.MemoryView":413 + /* "View.MemoryView":418 * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< * * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); - /* "View.MemoryView":490 + /* "View.MemoryView":495 * 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_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); - /* "View.MemoryView":515 + /* "View.MemoryView":520 * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: + * if flags & PyBUF_ND: */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); - /* "View.MemoryView":565 + /* "View.MemoryView":570 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); - /* "View.MemoryView":572 + /* "View.MemoryView":577 * def suboffsets(self): * if self.view.suboffsets == NULL: * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple__22 = PyTuple_New(1); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); + __pyx_tuple__19 = PyTuple_New(1); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); __Pyx_INCREF(__pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__22, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__22); + PyTuple_SET_ITEM(__pyx_tuple__19, 0, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_tuple__19); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -26571,62 +28662,40 @@ static int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); - /* "View.MemoryView":677 + /* "View.MemoryView":682 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ - __pyx_slice__25 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__25)) __PYX_ERR(2, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__25); - __Pyx_GIVEREF(__pyx_slice__25); + __pyx_slice__22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__22)) __PYX_ERR(2, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__22); + __Pyx_GIVEREF(__pyx_slice__22); - /* "View.MemoryView":680 - * seen_ellipsis = True - * else: - * result.append(slice(None)) # <<<<<<<<<<<<<< - * have_slices = True - * else: + /* "View.MemoryView":703 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< + * + * */ - __pyx_slice__26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(2, 680, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__26); - __Pyx_GIVEREF(__pyx_slice__26); - - /* "View.MemoryView":691 - * nslices = ndim - len(result) - * if nslices: - * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< - * - * return have_slices or nslices, tuple(result) - */ - __pyx_slice__27 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__27); - __Pyx_GIVEREF(__pyx_slice__27); - - /* "View.MemoryView":698 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -26634,239 +28703,251 @@ static int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + + /* "Orange/distance/_distance.pyx":18 + * + * + * def lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * cdef int row1, row2, step, n_rows1 + * + */ + __pyx_tuple__26 = PyTuple_Pack(7, __pyx_n_s_distances, __pyx_n_s_callback, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_step, __pyx_n_s_n_rows1, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_lower_to_symmetric, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 18, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":25 + /* "Orange/distance/_distance.pyx":31 * * * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_tuple__31 = PyTuple_Pack(17, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_dist_missing, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_ival1, __pyx_n_s_ival2); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(6, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_euclidean_rows_discrete, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(20, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_dist_missing, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(7, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_euclidean_rows_discrete, 31, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 31, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":57 + /* "Orange/distance/_distance.pyx":67 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__33 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows, 57, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 67, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":92 + /* "Orange/distance/_distance.pyx":106 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__35 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows_normalized, 92, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows_normalized, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 106, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":127 + /* "Orange/distance/_distance.pyx":145 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_tuple__37 = PyTuple_Pack(12, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(15, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 145, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":157 + /* "Orange/distance/_distance.pyx":179 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_tuple__39 = PyTuple_Pack(12, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols_normalized, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(15, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols_normalized, 179, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 179, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":186 + /* "Orange/distance/_distance.pyx":212 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x2, - * char two_tables): + * char two_tables, */ - __pyx_tuple__41 = PyTuple_Pack(13, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(3, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_rows_cont, 186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(16, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(4, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_rows_cont, 212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 212, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":206 + /* "Orange/distance/_distance.pyx":236 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_tuple__43 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_dist_missing2_cont, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_tuple__40 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_dist_missing2_cont, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows, 236, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 236, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":239 + /* "Orange/distance/_distance.pyx":273 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_tuple__45 = PyTuple_Pack(13, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows_normalized, 239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_tuple__42 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(5, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows_normalized, 273, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 273, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":269 + /* "Orange/distance/_distance.pyx":307 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1] medians, * np.ndarray[np.float64_t, ndim=1] mads, */ - __pyx_tuple__47 = PyTuple_Pack(13, __pyx_n_s_x, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_normalize, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); - __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_cols, 269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(16, __pyx_n_s_x, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_normalize, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(5, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_cols, 307, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 307, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":310 + /* "Orange/distance/_distance.pyx":352 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< * cdef: * int row, nonzeros, nonnans */ - __pyx_tuple__49 = PyTuple_Pack(5, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_nonzeros, __pyx_n_s_nonnans, __pyx_n_s_val); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__49); - __Pyx_GIVEREF(__pyx_tuple__49); - __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_p_nonzero, 310, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 310, __pyx_L1_error) + __pyx_tuple__46 = PyTuple_Pack(5, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_nonzeros, __pyx_n_s_nonnans, __pyx_n_s_val); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_p_nonzero, 352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 352, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":324 + /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< + * callback): * cdef: - * int row, n_cols, n_rows */ - __pyx_tuple__51 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_n_cols, __pyx_n_s_n_rows, __pyx_n_s_flags, __pyx_n_s_col); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 324, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__51); - __Pyx_GIVEREF(__pyx_tuple__51); - __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_any_nan_row, 324, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(9, __pyx_n_s_x, __pyx_n_s_callback, __pyx_n_s_row, __pyx_n_s_n_cols, __pyx_n_s_n_rows, __pyx_n_s_step, __pyx_n_s_flags, __pyx_n_s_row_start, __pyx_n_s_col); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_any_nan_row, 366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 366, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":340 + /* "Orange/distance/_distance.pyx":386 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< * np.ndarray[np.int8_t, ndim=2] nonzeros2, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__53 = PyTuple_Pack(21, __pyx_n_s_nonzeros1, __pyx_n_s_nonzeros2, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_nans1, __pyx_n_s_nans2, __pyx_n_s_ps, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__53); - __Pyx_GIVEREF(__pyx_tuple__53); - __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(8, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_rows, 340, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(25, __pyx_n_s_nonzeros1, __pyx_n_s_nonzeros2, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_nans1, __pyx_n_s_nans2, __pyx_n_s_ps, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_next_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_distances, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(10, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_rows, 386, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 386, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":416 + /* "Orange/distance/_distance.pyx":467 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x, * np.ndarray[np.int8_t, ndim=1] nans, */ - __pyx_tuple__55 = PyTuple_Pack(23, __pyx_n_s_nonzeros, __pyx_n_s_x, __pyx_n_s_nans, __pyx_n_s_ps, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_in_both, __pyx_n_s_in_any, __pyx_n_s_in1_unk2, __pyx_n_s_unk1_in2, __pyx_n_s_unk1_unk2, __pyx_n_s_unk1_not2, __pyx_n_s_not1_unk2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__55); - __Pyx_GIVEREF(__pyx_tuple__55); - __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_cols, 416, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(26, __pyx_n_s_nonzeros, __pyx_n_s_x, __pyx_n_s_nans, __pyx_n_s_ps, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_in_both, __pyx_n_s_in_any, __pyx_n_s_in1_unk2, __pyx_n_s_unk1_in2, __pyx_n_s_unk1_unk2, __pyx_n_s_unk1_not2, __pyx_n_s_not1_unk2, __pyx_n_s_distances, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(5, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_cols, 467, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 467, __pyx_L1_error) - /* "View.MemoryView":285 + /* "View.MemoryView":286 * return self.name * * cdef generic = Enum("") # <<<<<<<<<<<<<< * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(2, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); + __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(2, 286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); - /* "View.MemoryView":286 + /* "View.MemoryView":287 * * cdef generic = Enum("") * cdef strided = Enum("") # default # <<<<<<<<<<<<<< * cdef indirect = Enum("") * */ - __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(2, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__58); - __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(2, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__55); + __Pyx_GIVEREF(__pyx_tuple__55); - /* "View.MemoryView":287 + /* "View.MemoryView":288 * cdef generic = Enum("") * cdef strided = Enum("") # default * cdef indirect = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(2, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); - /* "View.MemoryView":290 + /* "View.MemoryView":291 * * * cdef contiguous = Enum("") # <<<<<<<<<<<<<< * cdef indirect_contiguous = Enum("") * */ - __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(2, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); + __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(2, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); - /* "View.MemoryView":291 + /* "View.MemoryView":292 * * cdef contiguous = Enum("") * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__61 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(2, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__61); - __Pyx_GIVEREF(__pyx_tuple__61); + __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(2, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * if __pyx_checksum != 0xb068931: - * from pickle import PickleError as __pyx_PickleError + * cdef object __pyx_PickleError + * cdef object __pyx_result */ - __pyx_tuple__62 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__62); - __Pyx_GIVEREF(__pyx_tuple__62); - __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(2, 1, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(2, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -26874,7 +28955,7 @@ static int __Pyx_InitCachedConstants(void) { return -1; } -static int __Pyx_InitGlobals(void) { +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -26885,13 +28966,13 @@ static int __Pyx_InitGlobals(void) { return -1; } -static int __Pyx_modinit_global_init_code(void); /*proto*/ -static int __Pyx_modinit_variable_export_code(void); /*proto*/ -static int __Pyx_modinit_function_export_code(void); /*proto*/ -static int __Pyx_modinit_type_init_code(void); /*proto*/ -static int __Pyx_modinit_type_import_code(void); /*proto*/ -static int __Pyx_modinit_variable_import_code(void); /*proto*/ -static int __Pyx_modinit_function_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations @@ -26928,17 +29009,21 @@ static int __Pyx_modinit_type_init_code(void) { /*--- Type init code ---*/ __pyx_vtabptr_array = &__pyx_vtable_array; __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 104, __pyx_L1_error) + if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_array.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 104, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 104, __pyx_L1_error) + #endif + if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error) __pyx_array_type = &__pyx_type___pyx_array; - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 278, __pyx_L1_error) + if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_MemviewEnum.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 278, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error) __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; @@ -26948,26 +29033,30 @@ static int __Pyx_modinit_type_init_code(void) { __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_ERR(2, 329, __pyx_L1_error) + if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_memoryview.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 329, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 329, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __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_ERR(2, 960, __pyx_L1_error) + if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_memoryviewslice.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 960, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 960, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error) __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; __Pyx_RefNannyFinishContext(); return 0; @@ -26978,23 +29067,37 @@ static int __Pyx_modinit_type_init_code(void) { static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif - 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(3, 9, __pyx_L1_error) - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 164, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 186, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 190, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 872, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore); + if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore); + if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } @@ -27029,15 +29132,6 @@ static int __Pyx_modinit_function_import_code(void) { #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #endif #endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4))) - #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) -#else - #define CYTHON_SMALL_CODE -#endif -#endif #if PY_MAJOR_VERSION < 3 @@ -27050,11 +29144,36 @@ __Pyx_PyMODINIT_FUNC PyInit__distance(void) { return PyModuleDef_Init(&__pyx_moduledef); } -static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { - result = PyDict_SetItemString(moddict, to_name, value); + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); @@ -27063,8 +29182,10 @@ static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const ch } return result; } -static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + if (__Pyx_check_single_interpreter()) + return NULL; if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); @@ -27074,10 +29195,10 @@ static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *d if (unlikely(!module)) goto bad; moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: Py_XDECREF(module); @@ -27085,7 +29206,7 @@ static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *d } -static int __pyx_pymod_exec__distance(PyObject *__pyx_pyinit_module) +static CYTHON_SMALL_CODE int __pyx_pymod_exec__distance(PyObject *__pyx_pyinit_module) #endif #endif { @@ -27093,7 +29214,11 @@ static int __pyx_pymod_exec__distance(PyObject *__pyx_pyinit_module) static PyThread_type_lock __pyx_t_2[8]; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module '_distance' has already been imported. Re-initialisation is not supported."); + return -1; + } #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif @@ -27108,6 +29233,9 @@ if (!__Pyx_RefNanny) { #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__distance(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -27151,10 +29279,9 @@ if (!__Pyx_RefNanny) { __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); - #endif + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -27162,7 +29289,7 @@ if (!__Pyx_RefNanny) { if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_Orange__distance___distance) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { @@ -27173,9 +29300,9 @@ if (!__Pyx_RefNanny) { } #endif /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error; /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error; /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); @@ -27196,165 +29323,177 @@ if (!__Pyx_RefNanny) { * cimport numpy as np * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":25 + /* "Orange/distance/_distance.pyx":18 + * + * + * def lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * cdef int row1, row2, step, n_rows1 + * + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_1lower_to_symmetric, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_lower_to_symmetric, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "Orange/distance/_distance.pyx":31 * * * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_euclidean_rows_discrete, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_euclidean_rows_discrete, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":57 + /* "Orange/distance/_distance.pyx":67 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows, __pyx_t_1) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows, __pyx_t_1) < 0) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":92 + /* "Orange/distance/_distance.pyx":106 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":127 + /* "Orange/distance/_distance.pyx":145 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols, __pyx_t_1) < 0) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":157 + /* "Orange/distance/_distance.pyx":179 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 157, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":186 + /* "Orange/distance/_distance.pyx":212 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x2, - * char two_tables): + * char two_tables, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_rows_cont, __pyx_t_1) < 0) __PYX_ERR(0, 186, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_rows_cont, __pyx_t_1) < 0) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":206 + /* "Orange/distance/_distance.pyx":236 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows, __pyx_t_1) < 0) __PYX_ERR(0, 206, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows, __pyx_t_1) < 0) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":239 + /* "Orange/distance/_distance.pyx":273 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 239, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":269 + /* "Orange/distance/_distance.pyx":307 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1] medians, * np.ndarray[np.float64_t, ndim=1] mads, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_cols, __pyx_t_1) < 0) __PYX_ERR(0, 269, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_cols, __pyx_t_1) < 0) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":310 + /* "Orange/distance/_distance.pyx":352 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< * cdef: * int row, nonzeros, nonnans */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_21p_nonzero, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_21p_nonzero, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_p_nonzero, __pyx_t_1) < 0) __PYX_ERR(0, 310, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_p_nonzero, __pyx_t_1) < 0) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":324 + /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< + * callback): * cdef: - * int row, n_cols, n_rows */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_23any_nan_row, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_23any_nan_row, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_any_nan_row, __pyx_t_1) < 0) __PYX_ERR(0, 324, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_any_nan_row, __pyx_t_1) < 0) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":340 + /* "Orange/distance/_distance.pyx":386 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< * np.ndarray[np.int8_t, ndim=2] nonzeros2, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_rows, __pyx_t_1) < 0) __PYX_ERR(0, 340, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_rows, __pyx_t_1) < 0) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":416 + /* "Orange/distance/_distance.pyx":467 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x, * np.ndarray[np.int8_t, ndim=1] nans, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_cols, __pyx_t_1) < 0) __PYX_ERR(0, 416, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_cols, __pyx_t_1) < 0) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Orange/distance/_distance.pyx":1 @@ -27367,90 +29506,90 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":208 + /* "View.MemoryView":209 * info.obj = self * * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * def __dealloc__(array self): */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 208, __pyx_L1_error) + __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 208, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 209, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_array_type); - /* "View.MemoryView":285 + /* "View.MemoryView":286 * return self.name * * cdef generic = Enum("") # <<<<<<<<<<<<<< * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 285, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(generic); __Pyx_DECREF_SET(generic, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":286 + /* "View.MemoryView":287 * * cdef generic = Enum("") * cdef strided = Enum("") # default # <<<<<<<<<<<<<< * cdef indirect = Enum("") * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(strided); __Pyx_DECREF_SET(strided, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":287 + /* "View.MemoryView":288 * cdef generic = Enum("") * cdef strided = Enum("") # default * cdef indirect = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect); __Pyx_DECREF_SET(indirect, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":290 + /* "View.MemoryView":291 * * * cdef contiguous = Enum("") # <<<<<<<<<<<<<< * cdef indirect_contiguous = Enum("") * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 290, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(contiguous); __Pyx_DECREF_SET(contiguous, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":291 + /* "View.MemoryView":292 * * cdef contiguous = Enum("") * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect_contiguous); __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":315 + /* "View.MemoryView":316 * * DEF THREAD_LOCKS_PREALLOCATED = 8 * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< @@ -27459,7 +29598,7 @@ if (!__Pyx_RefNanny) { */ __pyx_memoryview_thread_locks_used = 0; - /* "View.MemoryView":316 + /* "View.MemoryView":317 * DEF THREAD_LOCKS_PREALLOCATED = 8 * cdef int __pyx_memoryview_thread_locks_used = 0 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< @@ -27476,43 +29615,43 @@ if (!__Pyx_RefNanny) { __pyx_t_2[7] = PyThread_allocate_lock(); memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); - /* "View.MemoryView":544 + /* "View.MemoryView":549 * info.obj = self * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 544, __pyx_L1_error) + __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 544, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 549, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_memoryview_type); - /* "View.MemoryView":990 + /* "View.MemoryView":995 * return self.from_object * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 990, __pyx_L1_error) + __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 995, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 990, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 995, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_memoryviewslice_type); /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * if __pyx_checksum != 0xb068931: - * from pickle import PickleError as __pyx_PickleError + * cdef object __pyx_PickleError + * cdef object __pyx_result */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":9 + /* "(tree fragment)":11 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< @@ -27527,9 +29666,9 @@ if (!__Pyx_RefNanny) { __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init Orange.distance._distance", 0, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init Orange.distance._distance", __pyx_clineno, __pyx_lineno, __pyx_filename); } - Py_DECREF(__pyx_m); __pyx_m = 0; + Py_CLEAR(__pyx_m); } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init Orange.distance._distance"); } @@ -27550,9 +29689,9 @@ if (!__Pyx_RefNanny) { static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; - m = PyImport_ImportModule((char *)modname); + m = PyImport_ImportModule(modname); if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: @@ -27562,38 +29701,426 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* RaiseArgTupleInvalid */ +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) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.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); +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +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 +bad: + return -1; +} + +/* PyObjectCall */ +#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 + +/* PyCFunctionFastCall */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + } +} +#endif + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif +#endif + +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; +} + +/* PyObjectCallMethO */ +#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 + +/* PyObjectCallOneArg */ +#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) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } #endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif + } } - return result; + return __Pyx__PyObject_CallOneArg(func, arg); } - -/* None */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; } +#endif /* MemviewSliceInit */ static int @@ -27606,11 +30133,7 @@ __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, int i, retval=-1; Py_buffer *buf = &memview->view; __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (!buf) { - PyErr_SetString(PyExc_ValueError, - "buf is NULL."); - goto fail; - } else if (memviewslice->memview || memviewslice->data) { + if (memviewslice->memview || memviewslice->data) { PyErr_SetString(PyExc_ValueError, "memviewslice is already initialized!"); goto fail; @@ -27733,148 +30256,6 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, } } -/* RaiseArgTupleInvalid */ -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) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.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); -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -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 -bad: - return -1; -} - /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { @@ -27942,7 +30323,7 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { return -1; } else { count = *t++ - '0'; - while (*t >= '0' && *t < '9') { + while (*t >= '0' && *t <= '9') { count *= 10; count += *t++ - '0'; } @@ -28442,7 +30823,7 @@ static int __Pyx__GetBufferAndValidate( __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } - if (unlikely((unsigned)buf->itemsize != dtype->size)) { + if (unlikely((size_t)buf->itemsize != dtype->size)) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", @@ -28480,55 +30861,69 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject } #endif +/* PyDictVersioning */ + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + /* GetModuleGlobalName */ - static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + #if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { - Py_INCREF(result); + return __Pyx_NewRef(result); } else if (unlikely(PyErr_Occurred())) { - result = NULL; - } else { + return NULL; + } #else result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { - Py_INCREF(result); - } else { + return __Pyx_NewRef(result); + } #endif #else result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyObjectCall */ - #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; -} + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); #endif + return __Pyx_GetBuiltinName(name); +} /* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; @@ -28541,13 +30936,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } /* BufferFallbackError */ - static void __Pyx_RaiseBufferFallbackError(void) { + static void __Pyx_RaiseBufferFallbackError(void) { PyErr_SetString(PyExc_ValueError, "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } /* RaiseException */ - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare @@ -28705,220 +31100,22 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); - } -} -#endif - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif - -/* PyObjectCallMethO */ - #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 - -/* PyObjectCallOneArg */ - #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) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - /* DictGetItem */ - #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY + #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) - PyErr_SetObject(PyExc_KeyError, args); - Py_XDECREF(args); + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } } return NULL; } @@ -28928,30 +31125,46 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { #endif /* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + 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); } /* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } +/* GetTopmostException */ + #if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + /* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if PY_VERSION_HEX >= 0x030700A2 - *type = tstate->exc_state.exc_type; - *value = tstate->exc_state.exc_value; - *tb = tstate->exc_state.exc_traceback; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; #else *type = tstate->exc_type; *value = tstate->exc_value; @@ -28963,13 +31176,14 @@ static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject * } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = type; - tstate->exc_state.exc_value = value; - tstate->exc_state.exc_traceback = tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -28985,7 +31199,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #endif /* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(tuple); @@ -29010,11 +31224,12 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta #endif /* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif +{ PyObject *local_type, *local_value, *local_tb; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; @@ -29047,13 +31262,16 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = local_type; - tstate->exc_state.exc_value = local_value; - tstate->exc_state.exc_traceback = local_tb; + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + } #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -29080,7 +31298,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -29127,7 +31345,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + 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 @@ -29206,6 +31424,9 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); @@ -29226,7 +31447,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { + static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_USE_TYPE_SLOTS #if PY_MAJOR_VERSION >= 3 if (likely(PyUnicode_Check(n))) @@ -29239,7 +31460,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* GetItemInt */ - static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -29254,7 +31475,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ if (wraparound & unlikely(i < 0)) { wrapped_i += PyList_GET_SIZE(o); } - if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; @@ -29272,7 +31493,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize if (wraparound & unlikely(i < 0)) { wrapped_i += PyTuple_GET_SIZE(o); } - if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; @@ -29288,7 +31509,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; @@ -29296,7 +31517,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; @@ -29326,7 +31547,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } /* ObjectGetItem */ - #if CYTHON_USE_TYPE_SLOTS + #if CYTHON_USE_TYPE_SLOTS static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { PyObject *runerr; Py_ssize_t key_value; @@ -29355,7 +31576,7 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { #endif /* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + 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)) { @@ -29388,7 +31609,7 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } /* GetAttr3 */ - static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + static PyObject *__Pyx_GetAttr3Default(PyObject *d) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) @@ -29403,16 +31624,17 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject } /* SwapException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = *type; - tstate->exc_state.exc_value = *value; - tstate->exc_state.exc_traceback = *tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -29437,7 +31659,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #endif /* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; @@ -29484,7 +31706,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); + name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( @@ -29502,7 +31724,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, } /* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = a->tp_base; @@ -29557,14 +31779,42 @@ static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, return res; } #endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 3 @@ -29810,7 +32067,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj #endif /* PyObject_GenericGetAttr */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { return PyObject_GenericGetAttr(obj, attr_name); @@ -29820,7 +32077,7 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #endif /* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { + static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 PyObject *ob = PyCapsule_New(vtable, 0, 0); #else @@ -29838,7 +32095,7 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam } /* SetupReduce */ - static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); @@ -29905,17 +32162,78 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); #endif - Py_XDECREF(reduce); - Py_XDECREF(reduce_ex); - Py_XDECREF(reduce_cython); - Py_XDECREF(setstate); - Py_XDECREF(setstate_cython); - return ret; + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* TypeImport */ + #ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, + size_t size, enum __Pyx_ImportType_CheckSize check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if ((size_t)basicsize < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; } +#endif /* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { + #ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON @@ -29928,7 +32246,9 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #if CYTHON_COMPILING_IN_CPYTHON cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); if (likely(cython_runtime_dict)) { - use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) } else #endif { @@ -29945,7 +32265,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li c_line = 0; PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } - else if (PyObject_Not(use_cline) != 0) { + else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); @@ -29954,7 +32274,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + 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; @@ -30034,7 +32354,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ - #include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -30142,8 +32462,8 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { #endif - /* MemviewSliceIsContig */ - static int + /* MemviewSliceIsContig */ + static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) { int i, index, step, start; @@ -30165,7 +32485,7 @@ __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) } /* OverlappingSlices */ - static void + static void __pyx_get_array_memory_extents(__Pyx_memviewslice *slice, void **out_start, void **out_end, int ndim, size_t itemsize) @@ -30201,7 +32521,7 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, } /* Capsule */ - static CYTHON_INLINE PyObject * + static CYTHON_INLINE PyObject * __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) { PyObject *cobj; @@ -30214,7 +32534,7 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) } /* TypeInfoCompare */ - static int + static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) { int i; @@ -30255,7 +32575,7 @@ __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) } /* MemviewSliceValidateAndInit */ - static int + static int __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) { if (buf->shape[dim] <= 1) @@ -30320,7 +32640,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)) { + if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) { PyErr_Format(PyExc_ValueError, "Buffer is not indirectly accessible " "in dimension %d.", dim); @@ -30437,7 +32757,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -30460,7 +32780,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -30482,7 +32802,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -30505,8 +32825,8 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { @@ -30535,8 +32855,39 @@ static int __Pyx_ValidateAndInit_memviewslice( } } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 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); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + /* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) { + static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) { return (PyObject *) PyFloat_FromDouble(*(double *) itemp); } static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) { @@ -30548,8 +32899,8 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o } /* CIntToPy */ - 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 = (Py_intptr_t) 0; + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) { + const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(Py_intptr_t) < sizeof(long)) { @@ -30579,7 +32930,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o } /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -30599,7 +32950,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -30631,13 +32982,13 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { float r = b.imag / b.real; - float s = 1.0 / (b.real + b.imag * r); + float s = (float)(1.0) / (b.real + b.imag * r); return __pyx_t_float_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { float r = b.real / b.imag; - float s = 1.0 / (b.imag + b.real * r); + float s = (float)(1.0) / (b.imag + b.real * r); return __pyx_t_float_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } @@ -30717,7 +33068,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o theta = 0; } else { r = -a.real; - theta = atan2f(0, -1); + theta = atan2f(0.0, -1.0); } } else { r = __Pyx_c_abs_float(a); @@ -30734,7 +33085,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -30754,7 +33105,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -30786,13 +33137,13 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { double r = b.imag / b.real; - double s = 1.0 / (b.real + b.imag * r); + double s = (double)(1.0) / (b.real + b.imag * r); return __pyx_t_double_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { double r = b.real / b.imag; - double s = 1.0 / (b.imag + b.real * r); + double s = (double)(1.0) / (b.imag + b.real * r); return __pyx_t_double_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } @@ -30872,7 +33223,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o theta = 0; } else { r = -a.real; - theta = atan2(0, -1); + theta = atan2(0.0, -1.0); } } else { r = __Pyx_c_abs_double(a); @@ -30889,8 +33240,8 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { - const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { + const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(enum NPY_TYPES) < sizeof(long)) { @@ -30920,7 +33271,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o } /* MemviewSliceCopyTemplate */ - static __Pyx_memviewslice + static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const char *mode, int ndim, size_t sizeof_dtype, int contig_flag, @@ -30987,8 +33338,8 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { - const char neg_one = (char) -1, const_zero = (char) 0; + static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { + const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -31167,206 +33518,17 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } 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; -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 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_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_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_IntOrLong(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_IntOrLong(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; + "value too large to convert to char"); + return (char) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; + "can't convert negative value to char"); + return (char) -1; } /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -31553,39 +33715,197 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (long) -1; } -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; +/* CIntFromPy */ + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 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); +#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_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) + case -2: + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_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_IntOrLong(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_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } +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; } /* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { + static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); @@ -31600,91 +33920,8 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return 0; } -/* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - size_t size, int strict) -{ - PyObject *py_module = 0; - PyObject *result = 0; - PyObject *py_name = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - if (!py_name) - goto bad; - result = PyObject_GetAttr(py_module, py_name); - Py_DECREF(py_name); - py_name = 0; - Py_DECREF(py_module); - py_module = 0; - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -31793,6 +34030,13 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { @@ -31870,7 +34114,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else - return PyInt_AsSsize_t(x); + return PyInt_AsSsize_t(b); } #endif if (likely(PyLong_CheckExact(b))) { diff --git a/Orange/distance/_distance.pyx b/Orange/distance/_distance.pyx index d06af54d1dd..96c5bab17d8 100644 --- a/Orange/distance/_distance.pyx +++ b/Orange/distance/_distance.pyx @@ -15,11 +15,17 @@ cdef extern from "math.h": double sqrt(double x) nogil -cpdef void lower_to_symmetric(double [:, :] distances): - cdef int row1, row2 - for row1 in range(distances.shape[0]): - for row2 in range(row1): - distances[row2, row1] = distances[row1, row2] +def lower_to_symmetric(double [:, :] distances, callback): + cdef int row1, row2, step, n_rows1 + + n_rows1 = distances.shape[0] + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + with nogil: + for row1 in range(row_start, min(row_start + step, n_rows1)): + for row2 in range(row1): + distances[row2, row1] = distances[row1, row2] def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, @@ -27,31 +33,35 @@ def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=2] x2, double[:, :] dist_missing, np.ndarray[np.float64_t, ndim=1] dist_missing2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d int ival1, ival2 n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - ival1, ival2 = int(val1), int(val2) - if npy_isnan(val1): - if npy_isnan(val2): - d += dist_missing2[col] - else: - d += dist_missing[col, ival2] - elif npy_isnan(val2): - d += dist_missing[col, ival1] - elif ival1 != ival2: - d += 1 - distances[row1, row2] += d + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + ival1, ival2 = int(val1), int(val2) + if npy_isnan(val1): + if npy_isnan(val2): + d += dist_missing2[col] + else: + d += dist_missing[col, ival2] + elif npy_isnan(val2): + d += dist_missing[col, ival1] + elif ival1 != ival2: + d += 1 + distances[row1, row2] += d def fix_euclidean_rows( @@ -61,32 +71,36 @@ def fix_euclidean_rows( np.ndarray[np.float64_t, ndim=1] means, np.ndarray[np.float64_t, ndim=1] vars, np.ndarray[np.float64_t, ndim=1] dist_missing2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - if npy_isnan(distances[row1, row2]): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - d += dist_missing2[col] + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + if npy_isnan(distances[row1, row2]): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): + if npy_isnan(val2): + d += dist_missing2[col] + else: + d += (val2 - means[col]) ** 2 + vars[col] + elif npy_isnan(val2): + d += (val1 - means[col]) ** 2 + vars[col] else: - d += (val2 - means[col]) ** 2 + vars[col] - elif npy_isnan(val2): - d += (val1 - means[col]) ** 2 + vars[col] - else: - d += (val1 - val2) ** 2 - distances[row1, row2] = d - if not two_tables: - distances[row2, row1] = d + d += (val1 - val2) ** 2 + distances[row1, row2] = d + if not two_tables: + distances[row2, row1] = d def fix_euclidean_rows_normalized( @@ -96,111 +110,127 @@ def fix_euclidean_rows_normalized( np.ndarray[np.float64_t, ndim=1] means, np.ndarray[np.float64_t, ndim=1] vars, np.ndarray[np.float64_t, ndim=1] dist_missing2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - if npy_isnan(distances[row1, row2]): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - d += dist_missing2[col] + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + if npy_isnan(distances[row1, row2]): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): + if npy_isnan(val2): + d += dist_missing2[col] + else: + d += val2 ** 2 + 0.5 + elif npy_isnan(val2): + d += val1 ** 2 + 0.5 else: - d += val2 ** 2 + 0.5 - elif npy_isnan(val2): - d += val1 ** 2 + 0.5 - else: - d += (val1 - val2) ** 2 - distances[row1, row2] = d - if not two_tables: - distances[row2, row1] = d + d += (val1 - val2) ** 2 + distances[row1, row2] = d + if not two_tables: + distances[row2, row1] = d def fix_euclidean_cols( np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=2] x, double[:] means, - double[:] vars): + double[:] vars, + callback): cdef: - int n_rows, n_cols, col1, col2, row + int n_rows, n_cols, col1, col2, row, step double val1, val2, d n_rows, n_cols = x.shape[0], x.shape[1] - with nogil: - for col1 in range(n_cols): - for col2 in range(col1): - if npy_isnan(distances[col1, col2]): - d = 0 - for row in range(n_rows): - val1, val2 = x[row, col1], x[row, col2] - if npy_isnan(val1): - if npy_isnan(val2): - d += vars[col1] + vars[col2] \ - + (means[col1] - means[col2]) ** 2 + step = max(n_cols // 100, 100) + for col_start in range(0, n_cols, step): + callback(col_start * 100 / n_cols) + for col1 in range(col_start, min(col_start + step, n_cols)): + with nogil: + for col2 in range(col1): + if npy_isnan(distances[col1, col2]): + d = 0 + for row in range(n_rows): + val1, val2 = x[row, col1], x[row, col2] + if npy_isnan(val1): + if npy_isnan(val2): + d += vars[col1] + vars[col2] \ + + (means[col1] - means[col2]) ** 2 + else: + d += (val2 - means[col1]) ** 2 + vars[col1] + elif npy_isnan(val2): + d += (val1 - means[col2]) ** 2 + vars[col2] else: - d += (val2 - means[col1]) ** 2 + vars[col1] - elif npy_isnan(val2): - d += (val1 - means[col2]) ** 2 + vars[col2] - else: - d += (val1 - val2) ** 2 - distances[col1, col2] = distances[col2, col1] = d + d += (val1 - val2) ** 2 + distances[col1, col2] = distances[col2, col1] = d def fix_euclidean_cols_normalized( np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=2] x, double[:] means, - double[:] vars): + double[:] vars, + callback): cdef: - int n_rows, n_cols, col1, col2, row + int n_rows, n_cols, col1, col2, row, step double val1, val2, d n_rows, n_cols = x.shape[0], x.shape[1] - with nogil: - for col1 in range(n_cols): - for col2 in range(col1): - if npy_isnan(distances[col1, col2]): - d = 0 - for row in range(n_rows): - val1, val2 = x[row, col1], x[row, col2] - if npy_isnan(val1): - if npy_isnan(val2): - d += 1 + step = max(n_cols // 100, 100) + for col_start in range(0, n_cols, step): + callback(col_start * 100 / n_cols) + for col1 in range(col_start, min(col_start + step, n_cols)): + with nogil: + for col2 in range(col1): + if npy_isnan(distances[col1, col2]): + d = 0 + for row in range(n_rows): + val1, val2 = x[row, col1], x[row, col2] + if npy_isnan(val1): + if npy_isnan(val2): + d += 1 + else: + d += val2 ** 2 + 0.5 + elif npy_isnan(val2): + d += val1 ** 2 + 0.5 else: - d += val2 ** 2 + 0.5 - elif npy_isnan(val2): - d += val1 ** 2 + 0.5 - else: - d += (val1 - val2) ** 2 - distances[col1, col2] = distances[col2, col1] = d + d += (val1 - val2) ** 2 + distances[col1, col2] = distances[col2, col1] = d def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, np.ndarray[np.float64_t, ndim=2] x2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d np.ndarray[np.float64_t, ndim=2] distances n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] distances = np.zeros((n_rows1, n_rows2), dtype=float) - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - d = 0 - for col in range(n_cols): - d += fabs(x1[row1, col] - x2[row2, col]) - distances[row1, row2] = d + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + d = 0 + for col in range(n_cols): + d += fabs(x1[row1, col] - x2[row2, col]) + distances[row1, row2] = d return distances def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, @@ -209,101 +239,113 @@ def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=1] medians, np.ndarray[np.float64_t, ndim=1] mads, np.ndarray[np.float64_t, ndim=1] dist_missing2_cont, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] if two_tables else 0 - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - if npy_isnan(distances[row1, row2]): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - d += dist_missing2_cont[col] + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + if npy_isnan(distances[row1, row2]): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): + if npy_isnan(val2): + d += dist_missing2_cont[col] + else: + d += fabs(val2 - medians[col]) + mads[col] + elif npy_isnan(val2): + d += fabs(val1 - medians[col]) + mads[col] else: - d += fabs(val2 - medians[col]) + mads[col] - elif npy_isnan(val2): - d += fabs(val1 - medians[col]) + mads[col] - else: - d += fabs(val1 - val2) - distances[row1, row2] = d + d += fabs(val1 - val2) + distances[row1, row2] = d return distances def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=2] x1, np.ndarray[np.float64_t, ndim=2] x2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] if two_tables else 0 - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - if npy_isnan(distances[row1, row2]): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - d += 1 + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + if npy_isnan(distances[row1, row2]): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): + if npy_isnan(val2): + d += 1 + else: + d += fabs(val2) + 0.5 + elif npy_isnan(val2): + d += fabs(val1) + 0.5 else: - d += fabs(val2) + 0.5 - elif npy_isnan(val2): - d += fabs(val1) + 0.5 - else: - d += fabs(val1 - val2) - distances[row1, row2] = d + d += fabs(val1 - val2) + distances[row1, row2] = d return distances def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, np.ndarray[np.float64_t, ndim=1] medians, np.ndarray[np.float64_t, ndim=1] mads, - char normalize): + char normalize, + callback): cdef: - int n_rows, n_cols, col1, col2, row + int n_rows, n_cols, col1, col2, row, step double val1, val2, d double [:, :] distances n_rows, n_cols = x.shape[0], x.shape[1] + step = max(n_cols // 100, 100) distances = np.zeros((n_cols, n_cols), dtype=float) - with nogil: - for col1 in range(n_cols): - for col2 in range(col1): - d = 0 - for row in range(n_rows): - val1, val2 = x[row, col1], x[row, col2] - if npy_isnan(val1): - if npy_isnan(val2): - if normalize: - d += 1 + for col_start in range(0, n_cols, step): + callback(col_start * 100 / n_cols) + for col1 in range(col_start, min(col_start + step, n_cols)): + with nogil: + for col2 in range(col1): + d = 0 + for row in range(n_rows): + val1, val2 = x[row, col1], x[row, col2] + if npy_isnan(val1): + if npy_isnan(val2): + if normalize: + d += 1 + else: + d += mads[col1] + mads[col2] \ + + fabs(medians[col1] - medians[col2]) else: - d += mads[col1] + mads[col2] \ - + fabs(medians[col1] - medians[col2]) + if normalize: + d += fabs(val2) + 0.5 + else: + d += fabs(val2 - medians[col1]) + mads[col1] else: - if normalize: - d += fabs(val2) + 0.5 - else: - d += fabs(val2 - medians[col1]) + mads[col1] - else: - if npy_isnan(val2): - if normalize: - d += fabs(val1) + 0.5 + if npy_isnan(val2): + if normalize: + d += fabs(val1) + 0.5 + else: + d += fabs(val1 - medians[col2]) + mads[col2] else: - d += fabs(val1 - medians[col2]) + mads[col2] - else: - d += fabs(val1 - val2) - distances[col1, col2] = distances[col2, col1] = d + d += fabs(val1 - val2) + distances[col1, col2] = distances[col2, col1] = d return distances @@ -321,19 +363,23 @@ def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): nonzeros += 1 return float(nonzeros) / nonnans -def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): +def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, + callback): cdef: - int row, n_cols, n_rows + int row, n_cols, n_rows, step np.ndarray[np.int8_t, ndim=1] flags n_rows, n_cols = x.shape[0], x.shape[1] flags = np.zeros(x.shape[0], dtype=np.int8) - with nogil: - for row in range(n_rows): - for col in range(n_cols): - if npy_isnan(x[row, col]): - flags[row] = 1 - break + step = max(n_cols // 100, 100) + for row_start in range(0, n_rows, step): + callback(row_start * 100 / n_rows) + for row in range(row_start, min(row_start + step, n_rows)): + with nogil: + for col in range(n_cols): + if npy_isnan(x[row, col]): + flags[row] = 1 + break return flags @@ -344,9 +390,11 @@ def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, np.ndarray[np.int8_t, ndim=1] nans1, np.ndarray[np.int8_t, ndim=1] nans2, np.ndarray[np.float64_t, ndim=1] ps, - char two_tables): + char two_tables, + callback, + next_callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step np.float64_t val1, val2, intersection, union int ival1, ival2 double [:, :] distances @@ -354,71 +402,75 @@ def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, n_rows1, n_cols = x1.shape[0], x2.shape[1] n_rows2 = x2.shape[0] distances = np.zeros((n_rows1, n_rows2), dtype=float) - with nogil: - for row1 in range(n_rows1): - if nans1[row1]: - for row2 in range(n_rows2 if two_tables else row1): - union = intersection = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - intersection += ps[col] ** 2 - union += 1 - (1 - ps[col]) ** 2 - elif val2 != 0: - intersection += ps[col] - union += 1 - else: - union += ps[col] - elif npy_isnan(val2): - if val1 != 0: - intersection += val1 * ps[col] - union += 1 - else: - union += ps[col] - else: - ival1 = nonzeros1[row1, col] - ival2 = nonzeros2[row2, col] - union += ival1 | ival2 - intersection += ival1 & ival2 - if union != 0: - distances[row1, row2] = 1 - intersection / union - else: - for row2 in range(n_rows2 if two_tables else row1): - union = intersection = 0 - # This case is slightly different since val1 can't be nan - if nans2[row2]: + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + if nans1[row1]: + for row2 in range(n_rows2 if two_tables else row1): + union = intersection = 0 for col in range(n_cols): - val2 = x2[row2, col] - if nonzeros1[row1, col] != 0: - union += 1 + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): if npy_isnan(val2): - intersection += ps[col] + intersection += ps[col] ** 2 + union += 1 - (1 - ps[col]) ** 2 elif val2 != 0: - intersection += 1 + intersection += ps[col] + union += 1 + else: + union += ps[col] elif npy_isnan(val2): - union += ps[col] - elif val2 != 0: - union += 1 - else: - for col in range(n_cols): - ival1 = nonzeros1[row1, col] - ival2 = nonzeros2[row2, col] - union += ival1 | ival2 - intersection += ival1 & ival2 - if union != 0: - distances[row1, row2] = 1 - intersection / union + if val1 != 0: + intersection += val1 * ps[col] + union += 1 + else: + union += ps[col] + else: + ival1 = nonzeros1[row1, col] + ival2 = nonzeros2[row2, col] + union += ival1 | ival2 + intersection += ival1 & ival2 + if union != 0: + distances[row1, row2] = 1 - intersection / union + else: + for row2 in range(n_rows2 if two_tables else row1): + union = intersection = 0 + # This case is slightly different since val1 can't be nan + if nans2[row2]: + for col in range(n_cols): + val2 = x2[row2, col] + if nonzeros1[row1, col] != 0: + union += 1 + if npy_isnan(val2): + intersection += ps[col] + elif val2 != 0: + intersection += 1 + elif npy_isnan(val2): + union += ps[col] + elif val2 != 0: + union += 1 + else: + for col in range(n_cols): + ival1 = nonzeros1[row1, col] + ival2 = nonzeros2[row2, col] + union += ival1 | ival2 + intersection += ival1 & ival2 + if union != 0: + distances[row1, row2] = 1 - intersection / union if not two_tables: - lower_to_symmetric(distances) + lower_to_symmetric(distances, next_callback) return distances def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, np.ndarray[np.float64_t, ndim=2] x, np.ndarray[np.int8_t, ndim=1] nans, - np.ndarray[np.float64_t, ndim=1] ps): + np.ndarray[np.float64_t, ndim=1] ps, + callback): cdef: - int n_rows, n_cols, col1, col2, row + int n_rows, n_cols, col1, col2, row, step double val1, val2, intersection, union np.int8_t ival1, ival2 int in_both, in_any, in1_unk2, unk1_in2, unk1_unk2, unk1_not2, not1_unk2 @@ -426,77 +478,80 @@ def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, n_rows, n_cols = x.shape[0], x.shape[1] distances = np.zeros((n_cols, n_cols), dtype=float) - with nogil: - for col1 in range(n_cols): - if nans[col1]: - for col2 in range(col1): - in_both = in_any = 0 - in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - for row in range(n_rows): - val1, val2 = x[row, col1], x[row, col2] - if npy_isnan(val1): - if npy_isnan(val2): - unk1_unk2 += 1 - elif val2 != 0: - unk1_in2 += 1 - else: - unk1_not2 += 1 - elif npy_isnan(val2): - if val1 != 0: - in1_unk2 += 1 - else: - not1_unk2 += 1 - else: - ival1 = nonzeros[row, col1] - ival2 = nonzeros[row, col2] - in_both += ival1 & ival2 - in_any += ival1 | ival2 - union = (in_any + unk1_in2 + in1_unk2 - + ps[col1] * unk1_not2 - + ps[col2] * not1_unk2 - + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - if union != 0: - intersection = (in_both - + ps[col1] * unk1_in2 + - + ps[col2] * in1_unk2 + - + ps[col1] * ps[col2] * unk1_unk2) - distances[col1, col2] = distances[col2, col1] = \ - 1 - intersection / union - else: - for col2 in range(col1): - if nans[col2]: + step = max(n_cols // 100, 100) + for col_start in range(0, n_cols, step): + callback(col_start * 100 / n_cols) + for col1 in range(col_start, min(col_start + step, n_cols)): + with nogil: + if nans[col1]: + for col2 in range(col1): in_both = in_any = 0 in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 for row in range(n_rows): - ival1 = nonzeros[row, col1] - val2 = x[row, col2] - if npy_isnan(val2): - if ival1: + val1, val2 = x[row, col1], x[row, col2] + if npy_isnan(val1): + if npy_isnan(val2): + unk1_unk2 += 1 + elif val2 != 0: + unk1_in2 += 1 + else: + unk1_not2 += 1 + elif npy_isnan(val2): + if val1 != 0: in1_unk2 += 1 else: not1_unk2 += 1 else: + ival1 = nonzeros[row, col1] ival2 = nonzeros[row, col2] in_both += ival1 & ival2 in_any += ival1 | ival2 - distances[col1, col2] = distances[col2, col1] = \ - 1 - float(in_both - + ps[col1] * unk1_in2 + - + ps[col2] * in1_unk2 + - + ps[col1] * ps[col2] * unk1_unk2) / \ - (in_any + unk1_in2 + in1_unk2 + - + ps[col1] * unk1_not2 - + ps[col2] * not1_unk2 - + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - else: - in_both = in_any = 0 - for row in range(n_rows): - ival1 = nonzeros[row, col1] - ival2 = nonzeros[row, col2] - in_both += ival1 & ival2 - in_any += ival1 | ival2 - if in_any != 0: + union = (in_any + unk1_in2 + in1_unk2 + + ps[col1] * unk1_not2 + + ps[col2] * not1_unk2 + + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + if union != 0: + intersection = (in_both + + ps[col1] * unk1_in2 + + + ps[col2] * in1_unk2 + + + ps[col1] * ps[col2] * unk1_unk2) + distances[col1, col2] = distances[col2, col1] = \ + 1 - intersection / union + else: + for col2 in range(col1): + if nans[col2]: + in_both = in_any = 0 + in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + for row in range(n_rows): + ival1 = nonzeros[row, col1] + val2 = x[row, col2] + if npy_isnan(val2): + if ival1: + in1_unk2 += 1 + else: + not1_unk2 += 1 + else: + ival2 = nonzeros[row, col2] + in_both += ival1 & ival2 + in_any += ival1 | ival2 distances[col1, col2] = distances[col2, col1] = \ - 1 - float(in_both) / in_any + 1 - float(in_both + + ps[col1] * unk1_in2 + + + ps[col2] * in1_unk2 + + + ps[col1] * ps[col2] * unk1_unk2) / \ + (in_any + unk1_in2 + in1_unk2 + + + ps[col1] * unk1_not2 + + ps[col2] * not1_unk2 + + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + else: + in_both = in_any = 0 + for row in range(n_rows): + ival1 = nonzeros[row, col1] + ival2 = nonzeros[row, col2] + in_both += ival1 & ival2 + in_any += ival1 | ival2 + if in_any != 0: + distances[col1, col2] = distances[col2, col1] = \ + 1 - float(in_both) / in_any return distances diff --git a/Orange/distance/base.py b/Orange/distance/base.py index 517955a1138..7205e1cbce9 100644 --- a/Orange/distance/base.py +++ b/Orange/distance/base.py @@ -116,6 +116,8 @@ class Distance: impute (bool): if `True` (default is `False`), nans in the computed distances are replaced with zeros, and infs with very large numbers. + callback (callable or None): + callback function Attributes: axis (int): @@ -162,10 +164,12 @@ class Distance: axis = 1 impute = False - def __new__(cls, e1=None, e2=None, axis=1, impute=False, **kwargs): + def __new__(cls, e1=None, e2=None, axis=1, impute=False, + callback=None, **kwargs): self = super().__new__(cls) self.axis = axis self.impute = impute + self.callback = callback # Ugly, but needed to allow allow setting subclass-specific parameters # (such as normalize) when `e1` is not `None` and the `__new__` in the # subclass is skipped @@ -225,11 +229,14 @@ class DistanceModel: impute (bool): if `True` (default is `False`), nans in the computed distances are replaced with zeros, and infs with very large numbers + callback (callable or None): + callback function """ - def __init__(self, axis, impute=False): + def __init__(self, axis, impute=False, callback=None): self._axis = axis self.impute = impute + self.callback = callback @property def axis(self): @@ -291,9 +298,10 @@ class FittedDistanceModel(DistanceModel): continuous (np.ndarray): bool array indicating continuous attributes normalize (bool): if `True` (default is `False`) continuous columns are normalized + callback (callable or None): callback function """ - def __init__(self, attributes, axis=1, impute=False): - super().__init__(axis, impute) + def __init__(self, attributes, axis=1, impute=False, callback=None): + super().__init__(axis, impute, callback) self.attributes = attributes self.discrete = None self.continuous = None @@ -464,7 +472,8 @@ def fit_rows(self, attributes, x, n_vals): continuous, discrete, offsets[:curr_cont], scales[:curr_cont], dist_missing2_cont[:curr_cont], - dist_missing_disc, dist_missing2_disc) + dist_missing_disc, dist_missing2_disc, + self.callback) @staticmethod def get_discrete_stats(column, n_bins): diff --git a/Orange/distance/distance.py b/Orange/distance/distance.py index e8156e5ce38..246d9e80037 100644 --- a/Orange/distance/distance.py +++ b/Orange/distance/distance.py @@ -1,3 +1,4 @@ +from typing import Callable import warnings from unittest.mock import patch @@ -16,6 +17,65 @@ SklDistance, _orange_to_numpy) +def _safe_sparse_dot(a: np.ndarray, b: np.ndarray, + dense_output: bool = False, step: int = 100, + callback: Callable = None) -> np.ndarray: + if sp.issparse(a) or sp.issparse(b): + return safe_sparse_dot(a, b, dense_output) + else: + return _interruptible_dot(a, b, step, callback) + + +def _interruptible_dot(a: np.ndarray, b: np.ndarray, step: int = 100, + callback: Callable = None) -> np.ndarray: + if callback is None: + callback = lambda x: x + + if not isinstance(a, np.ndarray): + a = np.array(a) + if not isinstance(b, np.ndarray): + b = np.array(b) + if a.ndim < 2 or b.ndim < 2: + return np.dot(a, b) + + c = np.zeros((a.shape[0], b.shape[1]), dtype=float) + n_cols = b.shape[1] + for col in range(0, n_cols, step): + callback(col * 100 / n_cols) + c[:, col: col + step] = np.dot(a, b[:, col: col + step]) + return c + + +def _interruptible_sqrt(a: np.ndarray, step: int = 100, + callback: Callable = None) -> np.ndarray: + if callback is None: + callback = lambda x: x + + if not isinstance(a, np.ndarray): + a = np.array(a) + if a.ndim < 2: + return np.sqrt(a) + new_a = np.zeros(a.shape, dtype=float) + n_rows = len(a) + for row in range(0, n_rows, step): + callback(row * 100 / n_rows) + new_a[row: row + step, :] = np.sqrt(a[row: row + step, :]) + return new_a + + +class StepwiseCallbacks: + def __init__(self, callback, weights): + self.step_counter = -1 + self.callback = callback + self.weights = weights + + def next(self): + self.step_counter += 1 + base = sum(self.weights[:self.step_counter]) + step = self.weights[self.step_counter] / sum(self.weights) + return lambda i: self.callback and self.callback(base + i * step) + + class EuclideanRowsModel(FittedDistanceModel): """ Model for computation of Euclidean distances between rows. @@ -26,8 +86,8 @@ class EuclideanRowsModel(FittedDistanceModel): def __init__(self, attributes, impute, normalize, continuous, discrete, means, stdvars, dist_missing2_cont, - dist_missing_disc, dist_missing2_disc): - super().__init__(attributes, 1, impute) + dist_missing_disc, dist_missing2_disc, callback): + super().__init__(attributes, 1, impute, callback) self.normalize = normalize self.continuous = continuous self.discrete = discrete @@ -48,6 +108,8 @@ def compute_distances(self, x1, x2=None): - calls a function in Cython that adds the contributions of discrete columns """ + callbacks = StepwiseCallbacks(self.callback, [20, 10, 50, 5, 15]) + if self.continuous.any(): data1, data2 = self.continuous_columns( x1, x2, self.means, np.sqrt(2 * self.vars)) @@ -58,7 +120,8 @@ def compute_distances(self, x1, x2=None): yy = row_norms(data2, squared=True)[np.newaxis, :] else: yy = xx.T - distances = safe_sparse_dot(data1, data2.T, dense_output=True) + distances = _safe_sparse_dot(data1, data2.T, dense_output=True, + callback=callbacks.next()) distances *= -2 distances += xx distances += yy @@ -70,7 +133,7 @@ def compute_distances(self, x1, x2=None): else _distance.fix_euclidean_rows fixer(distances, data1, data2, self.means, self.vars, self.dist_missing2_cont, - x2 is not None) + x2 is not None, callbacks.next()) else: distances = np.zeros((x1.shape[0], (x2 if x2 is not None else x1).shape[0])) @@ -79,11 +142,11 @@ def compute_distances(self, x1, x2=None): data1, data2 = self.discrete_columns(x1, x2) _distance.euclidean_rows_discrete( distances, data1, data2, self.dist_missing_disc, - self.dist_missing2_disc, x2 is not None) + self.dist_missing2_disc, x2 is not None, callbacks.next()) if x2 is None: - _distance.lower_to_symmetric(distances) - return np.sqrt(distances) + _distance.lower_to_symmetric(distances, callbacks.next()) + return _interruptible_sqrt(distances, callback=callbacks.next()) class EuclideanColumnsModel(FittedDistanceModel): @@ -93,8 +156,9 @@ class EuclideanColumnsModel(FittedDistanceModel): Means are used as offsets for normalization, and two deviations are used for scaling. """ - def __init__(self, attributes, impute, normalize, means, stdvars): - super().__init__(attributes, 0, impute) + def __init__(self, attributes, impute, normalize, means, stdvars, + callback=None): + super().__init__(attributes, 0, impute, callback) self.normalize = normalize self.means = means self.vars = stdvars @@ -108,13 +172,15 @@ def compute_distances(self, x1, x2=None): - calls a function in Cython that adds the contributions of discrete columns """ + callbacks = StepwiseCallbacks(self.callback, [40, 30, 30]) + if self.normalize: x1 = x1 - self.means x1 /= np.sqrt(2 * self.vars) - # adapted from sklearn.metric.euclidean_distances xx = row_norms(x1.T, squared=True)[:, np.newaxis] - distances = safe_sparse_dot(x1.T, x1, dense_output=True) + distances = _safe_sparse_dot(x1.T, x1, dense_output=True, + callback=callbacks.next()) distances *= -2 distances += xx distances += xx.T @@ -124,8 +190,8 @@ def compute_distances(self, x1, x2=None): fixer = _distance.fix_euclidean_cols_normalized if self.normalize \ else _distance.fix_euclidean_cols - fixer(distances, x1, self.means, self.vars) - return np.sqrt(distances) + fixer(distances, x1, self.means, self.vars, callbacks.next()) + return _interruptible_sqrt(distances, callback=callbacks.next()) class Euclidean(FittedDistance): @@ -135,9 +201,11 @@ class Euclidean(FittedDistance): fallback = SklDistance('euclidean') rows_model_type = EuclideanRowsModel - def __new__(cls, e1=None, e2=None, axis=1, impute=False, normalize=False): + def __new__(cls, e1=None, e2=None, axis=1, impute=False, normalize=False, + callback=None): # pylint: disable=arguments-differ - return super().__new__(cls, e1, e2, axis, impute, normalize=normalize) + return super().__new__(cls, e1, e2, axis, impute, callback, + normalize=normalize) def get_continuous_stats(self, column): """ @@ -180,7 +248,8 @@ def nowarn(msg, cat, *args, **kwargs): if self.normalize and not stdvars.all(): raise ValueError("some columns are constant") return EuclideanColumnsModel( - attributes, self.impute, self.normalize, means, stdvars) + attributes, self.impute, self.normalize, means, stdvars, + self.callback) class ManhattanRowsModel(FittedDistanceModel): @@ -193,8 +262,8 @@ class ManhattanRowsModel(FittedDistanceModel): def __init__(self, attributes, impute, normalize, continuous, discrete, medians, mads, dist_missing2_cont, - dist_missing_disc, dist_missing2_disc): - super().__init__(attributes, 1, impute) + dist_missing_disc, dist_missing2_disc, callback=None): + super().__init__(attributes, 1, impute, callback) self.normalize = normalize self.continuous = continuous self.discrete = discrete @@ -213,19 +282,21 @@ def compute_distances(self, x1, x2): - adds the contributions of discrete columns using the same function as the Euclidean distance """ + callbacks = StepwiseCallbacks(self.callback, [5, 5, 60, 30]) + if self.continuous.any(): data1, data2 = self.continuous_columns( x1, x2, self.medians, 2 * self.mads) distances = _distance.manhattan_rows_cont( - data1, data2, x2 is not None) + data1, data2, x2 is not None, callbacks.next()) if self.normalize: _distance.fix_manhattan_rows_normalized( - distances, data1, data2, x2 is not None) + distances, data1, data2, x2 is not None, callbacks.next()) else: _distance.fix_manhattan_rows( distances, data1, data2, self.medians, self.mads, self.dist_missing2_cont, - x2 is not None) + x2 is not None, callbacks.next()) else: distances = np.zeros((x1.shape[0], (x2 if x2 is not None else x1).shape[0])) @@ -235,10 +306,10 @@ def compute_distances(self, x1, x2): # For discrete attributes, Euclidean is same as Manhattan _distance.euclidean_rows_discrete( distances, data1, data2, self.dist_missing_disc, - self.dist_missing2_disc, x2 is not None) + self.dist_missing2_disc, x2 is not None, callbacks.next()) if x2 is None: - _distance.lower_to_symmetric(distances) + _distance.lower_to_symmetric(distances, callbacks.next()) return distances @@ -250,8 +321,9 @@ class ManhattanColumnsModel(FittedDistanceModel): used for scaling. """ - def __init__(self, attributes, impute, normalize, medians, mads): - super().__init__(attributes, 0, impute) + def __init__(self, attributes, impute, normalize, medians, mads, + callback=None): + super().__init__(attributes, 0, impute, callback) self.normalize = normalize self.medians = medians self.mads = mads @@ -261,7 +333,9 @@ def compute_distances(self, x1, x2=None): x1 = x1 - self.medians x1 /= 2 x1 /= self.mads - return _distance.manhattan_cols(x1, self.medians, self.mads, self.normalize) + callback = self.callback or (lambda x: x) + return _distance.manhattan_cols(x1, self.medians, self.mads, + self.normalize, callback) class Manhattan(FittedDistance): @@ -271,9 +345,11 @@ class Manhattan(FittedDistance): fallback = SklDistance('manhattan') rows_model_type = ManhattanRowsModel - def __new__(cls, e1=None, e2=None, axis=1, impute=False, normalize=False): + def __new__(cls, e1=None, e2=None, axis=1, impute=False, normalize=False, + callback=None): # pylint: disable=arguments-differ - return super().__new__(cls, e1, e2, axis, impute, normalize=normalize) + return super().__new__(cls, e1, e2, axis, impute, callback, + normalize=normalize) def get_continuous_stats(self, column): """ @@ -310,7 +386,8 @@ def fit_cols(self, attributes, x, n_vals): "some columns have zero absolute distance from median, " "or no values") return ManhattanColumnsModel( - attributes, self.impute, self.normalize, medians, mads) + attributes, self.impute, self.normalize, medians, mads, + self.callback) class Cosine(FittedDistance): @@ -336,7 +413,7 @@ def fit_rows(self, attributes, x, n_vals): means = util.nanmean(x, axis=0) means = np.nan_to_num(means) return self.CosineModel(attributes, self.axis, self.impute, - discrete, means) + discrete, means, self.callback) fit_cols = fit_rows @@ -347,8 +424,8 @@ def get_continuous_stats(self, column): class CosineModel(FittedDistanceModel): """Model for computation of cosine distances across rows and columns. All non-zero discrete values are treated as 1.""" - def __init__(self, attributes, axis, impute, discrete, means): - super().__init__(attributes, axis, impute) + def __init__(self, attributes, axis, impute, discrete, means, callback): + super().__init__(attributes, axis, impute, callback) self.discrete = discrete self.means = means @@ -375,7 +452,7 @@ def prepare_data(x): data1 = prepare_data(x1) data2 = data1 if x2 is None else prepare_data(x2) - dist = safe_sparse_dot(data1, data2.T) + dist = _safe_sparse_dot(data1, data2.T, callback=self.callback) np.clip(dist, -1, 1, out=dist) if x2 is None: diag = np.diag_indices_from(dist) @@ -388,8 +465,8 @@ class JaccardModel(FittedDistanceModel): Model for computation of cosine distances across rows and columns. All non-zero values are treated as 1. """ - def __init__(self, attributes, axis, impute, ps): - super().__init__(attributes, axis, impute) + def __init__(self, attributes, axis, impute, ps, callback): + super().__init__(attributes, axis, impute, callback) self.ps = ps def compute_distances(self, x1, x2): @@ -412,25 +489,30 @@ def _compute_dense(self, x1, x2): # view is false positive, pylint: disable=no-member nonzeros1 = np.not_equal(x1, 0).view(np.int8) if self.axis == 1: - nans1 = _distance.any_nan_row(x1) + weights = [5, 45, 50] if x2 is None else [5, 5, 45, 45] + callbacks = StepwiseCallbacks(self.callback, weights) + + nans1 = _distance.any_nan_row(x1, callbacks.next()) if x2 is None: nonzeros2, nans2 = nonzeros1, nans1 else: nonzeros2 = np.not_equal(x2, 0).view(np.int8) - nans2 = _distance.any_nan_row(x2) + nans2 = _distance.any_nan_row(x2, callbacks.next()) return _distance.jaccard_rows( nonzeros1, nonzeros2, x1, x1 if x2 is None else x2, nans1, nans2, - self.ps, - x2 is not None) + self.ps, x2 is not None, + callbacks.next(), callbacks.next() + ) else: - nans1 = _distance.any_nan_row(x1.T) + callbacks = StepwiseCallbacks(self.callback, [10, 90]) + nans1 = _distance.any_nan_row(x1.T, callbacks.next()) return _distance.jaccard_cols( - nonzeros1, x1, nans1, self.ps) + nonzeros1, x1, nans1, self.ps, callbacks.next()) - @staticmethod - def _compute_sparse(x1, x2=None): + def _compute_sparse(self, x1, x2=None): + callback = self.callback or (lambda x: x) symmetric = x2 is None if symmetric: x2 = x1 @@ -441,6 +523,7 @@ def _compute_sparse(x1, x2=None): n, m = x1.shape[0], x2.shape[0] matrix = np.zeros((n, m)) for i in range(n): + callback(i * 100 / n) xi_ind = set(x1[i].indices) for j in range(i if symmetric else m): union = len(xi_ind.union(x2[j].indices)) @@ -470,7 +553,8 @@ def fit_rows(self, attributes, x, n_vals): ps = np.fromiter( (_distance.p_nonzero(x[:, col]) for col in range(len(n_vals))), dtype=np.double, count=len(n_vals)) - return JaccardModel(attributes, self.axis, self.impute, ps) + return JaccardModel(attributes, self.axis, self.impute, + ps, self.callback) fit_cols = fit_rows diff --git a/Orange/distance/tests/test_distance.py b/Orange/distance/tests/test_distance.py index 43afd555738..6fefdd7595c 100644 --- a/Orange/distance/tests/test_distance.py +++ b/Orange/distance/tests/test_distance.py @@ -934,5 +934,51 @@ def test_hamming_row_secondary_data(self): [1, 2 / 3]]) +class TestHelperFunctions(unittest.TestCase): + # pylint: disable=protected-access, no-self-use + def test_interruptable_dot(self): + dot = distance.distance._interruptible_dot + k, m, n = 20, 30, 40 + a = np.random.randint(10, size=(m, n)) + b = np.random.randint(10, size=(n, k)) + + c = dot(a, b, step=10) + np.testing.assert_array_equal(c, np.dot(a, b)) + + def test_interruptable_dot_list(self): + dot = distance.distance._interruptible_dot + a = [[1, 2, 3], [1, 2, 3]] + b = [3, 2, 1] + c = dot(a, b, step=10) + np.testing.assert_array_equal(c, np.dot(a, b)) + + def test_interruptable_dot_scalar(self): + dot = distance.distance._interruptible_dot + a = 2 + b = 3 + c = dot(a, b, step=10) + np.testing.assert_array_equal(c, np.dot(a, b)) + + def test_interruptable_sqrt(self): + sqrt_ = distance.distance._interruptible_sqrt + n = 100 + a = np.random.randint(10, size=(n, n)) + + new_a = sqrt_(a, step=10) + np.testing.assert_array_equal(new_a, np.sqrt(a)) + + def test_interruptable_sqrt_list(self): + sqrt_ = distance.distance._interruptible_sqrt + l = [1, 2, 3] + new_l = sqrt_(l, step=10) + np.testing.assert_array_equal(new_l, np.sqrt(l)) + + def test_interruptable_sqrt_scalar(self): + sqrt_ = distance.distance._interruptible_sqrt + i = 9 + new_i = sqrt_(i, step=10) + np.testing.assert_array_equal(new_i, np.sqrt(i)) + + if __name__ == "__main__": unittest.main() diff --git a/Orange/widgets/unsupervised/owdistances.py b/Orange/widgets/unsupervised/owdistances.py index 153cd78b56f..15f17040bdd 100644 --- a/Orange/widgets/unsupervised/owdistances.py +++ b/Orange/widgets/unsupervised/owdistances.py @@ -5,7 +5,9 @@ import Orange.data import Orange.misc from Orange import distance -from Orange.widgets import gui, settings +from Orange.widgets import gui +from Orange.widgets.settings import Setting +from Orange.widgets.utils.concurrent import TaskState, ConcurrentWidgetMixin from Orange.widgets.utils.sql import check_sql_input from Orange.widgets.utils.widgetpreview import WidgetPreview from Orange.widgets.widget import OWWidget, Msg, Input, Output @@ -26,7 +28,30 @@ ] -class OWDistances(OWWidget): +class InterruptException(Exception): + pass + + +class DistanceRunner: + @staticmethod + def run(data: Orange.data.Table, metric: distance, normalized_dist: bool, + axis: int, state: TaskState) -> Orange.misc.DistMatrix: + if data is None: + return None + + def callback(i: float) -> bool: + state.set_progress_value(i) + if state.is_interruption_requested(): + raise InterruptException + + state.set_status("Calculating...") + kwargs = {"axis": 1 - axis, "impute": True, "callback": callback} + if metric.supports_normalization and normalized_dist: + kwargs["normalize"] = True + return metric(data, **kwargs) + + +class OWDistances(OWWidget, ConcurrentWidgetMixin): name = "Distances" description = "Compute a matrix of pairwise distances." icon = "icons/Distance.svg" @@ -40,14 +65,14 @@ class Outputs: settings_version = 2 - axis = settings.Setting(0) # type: int - metric_idx = settings.Setting(0) # type: int + axis = Setting(0) # type: int + metric_idx = Setting(0) # type: int #: Use normalized distances if the metric supports it. #: The default is `True`, expect when restoring from old pre v2 settings #: (see `migrate_settings`). - normalized_dist = settings.Setting(True) # type: bool - autocommit = settings.Setting(True) # type: bool + normalized_dist = Setting(True) # type: bool + autocommit = Setting(True) # type: bool want_main_area = False buttons_area_orientation = Qt.Vertical @@ -65,13 +90,15 @@ class Warning(OWWidget.Warning): imputing_data = Msg("Missing values were imputed") def __init__(self): - super().__init__() + OWWidget.__init__(self) + ConcurrentWidgetMixin.__init__(self) self.data = None - gui.radioButtons(self.controlArea, self, "axis", ["Rows", "Columns"], - box="Distances between", callback=self._invalidate - ) + gui.radioButtons( + self.controlArea, self, "axis", ["Rows", "Columns"], + box="Distances between", callback=self._invalidate + ) box = gui.widgetBox(self.controlArea, "Distance Metric") self.metrics_combo = gui.comboBox( box, self, "metric_idx", @@ -93,6 +120,7 @@ def __init__(self): @Inputs.data @check_sql_input def set_data(self, data): + self.cancel() self.data = data self.refresh_metrics() self.unconditional_commit() @@ -106,8 +134,7 @@ def refresh_metrics(self): def commit(self): # pylint: disable=invalid-sequence-index metric = METRICS[self.metric_idx][1] - dist = self.compute_distances(metric, self.data) - self.Outputs.distances.send(dist) + self.compute_distances(metric, self.data) def compute_distances(self, metric, data): def _check_sparse(): @@ -152,22 +179,36 @@ def _fix_missing(): return True self.clear_messages() - if data is None: - return None - for check in (_check_sparse, - _fix_discrete, _fix_missing, _fix_nonbinary): - if not check(): - return None - try: - if metric.supports_normalization and self.normalized_dist: - return metric(data, axis=1 - self.axis, impute=True, - normalize=True) - else: - return metric(data, axis=1 - self.axis, impute=True) - except ValueError as e: - self.Error.distances_value_error(e) - except MemoryError: + if data is not None: + for check in (_check_sparse, _fix_discrete, + _fix_missing, _fix_nonbinary): + if not check(): + data = None + break + + self.start(DistanceRunner.run, data, metric, + self.normalized_dist, self.axis) + + def on_partial_result(self, _): + pass + + def on_done(self, result: Orange.misc.DistMatrix): + assert isinstance(result, Orange.misc.DistMatrix) or result is None + self.Outputs.distances.send(result) + + def on_exception(self, ex): + if isinstance(ex, ValueError): + self.Error.distances_value_error(ex) + elif isinstance(ex, MemoryError): self.Error.distances_memory_error() + elif isinstance(ex, InterruptException): + pass + else: + raise ex + + def onDeleteWidget(self): + self.shutdown() + super().onDeleteWidget() def _invalidate(self): self.commit() diff --git a/Orange/widgets/unsupervised/tests/test_owdistances.py b/Orange/widgets/unsupervised/tests/test_owdistances.py index 2362a6bbadc..d508d74167b 100644 --- a/Orange/widgets/unsupervised/tests/test_owdistances.py +++ b/Orange/widgets/unsupervised/tests/test_owdistances.py @@ -1,15 +1,70 @@ # Test methods with long descriptive names can omit docstrings # pylint: disable=missing-docstring +import unittest from unittest.mock import Mock import numpy as np -from Orange.data import Table, Domain from Orange import distance -from Orange.widgets.unsupervised.owdistances import OWDistances, METRICS +from Orange.data import Table, Domain +from Orange.misc import DistMatrix +from Orange.widgets.unsupervised.owdistances import OWDistances, METRICS, \ + DistanceRunner from Orange.widgets.tests.base import WidgetTest +class TestDistanceRunner(unittest.TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.iris = Table("iris")[::5] + cls.iris.X[0, 2] = np.nan + cls.iris.X[1, 3] = np.nan + cls.iris.X[2, 1] = np.nan + cls.zoo = Table("zoo")[::5] + cls.zoo.X[0, 2] = np.nan + cls.zoo.X[1, 3] = np.nan + cls.zoo.X[2, 1] = np.nan + + def test_run(self): + state = Mock() + state.is_interruption_requested = Mock(return_value=False) + for name, metric in METRICS: + data = self.iris + if not metric.supports_missing or name == "Bhattacharyya": + data = distance.impute(data) + elif name == "Jaccard": + data = self.zoo + + # between rows, normalized + dist1 = DistanceRunner.run(data, metric, True, 0, state) + dist2 = metric(data, axis=1, impute=True, normalize=True) + self.assertDistMatrixEqual(dist1, dist2) + + # between rows, not normalized + dist1 = DistanceRunner.run(data, metric, False, 0, state) + dist2 = metric(data, axis=1, impute=True, normalize=False) + self.assertDistMatrixEqual(dist1, dist2) + + # between columns, normalized + dist1 = DistanceRunner.run(data, metric, True, 1, state) + dist2 = metric(data, axis=0, impute=True, normalize=True) + self.assertDistMatrixEqual(dist1, dist2) + + # between columns, not normalized + dist1 = DistanceRunner.run(data, metric, False, 1, state) + dist2 = metric(data, axis=0, impute=True, normalize=False) + self.assertDistMatrixEqual(dist1, dist2) + + def assertDistMatrixEqual(self, dist1, dist2): + self.assertIsInstance(dist1, DistMatrix) + self.assertIsInstance(dist2, DistMatrix) + self.assertEqual(dist1.axis, dist2.axis) + self.assertEqual(dist1.row_items, dist2.row_items) + self.assertEqual(dist1.col_items, dist2.col_items) + np.testing.assert_array_almost_equal(dist1, dist2) + + class TestOWDistances(WidgetTest): @classmethod def setUpClass(cls): @@ -27,14 +82,14 @@ def test_distance_combo(self): for i, (_, metric) in enumerate(METRICS): self.widget.metrics_combo.activated.emit(i) self.widget.metrics_combo.setCurrentIndex(i) - self.send_signal(self.widget.Inputs.data, self.iris) + self.wait_until_stop_blocking() if metric.supports_normalization: expected = metric(self.iris, normalize=self.widget.normalized_dist) else: expected = metric(self.iris) if metric is not distance.Jaccard: - np.testing.assert_array_equal( + np.testing.assert_array_almost_equal( expected, self.get_output(self.widget.Outputs.distances)) def test_error_message(self): @@ -42,8 +97,10 @@ def test_error_message(self): data is removed from input""" self.widget.metric_idx = 2 self.send_signal(self.widget.Inputs.data, self.iris) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_continuous_features.is_shown()) self.send_signal(self.widget.Inputs.data, self.titanic) + self.wait_until_stop_blocking() self.assertTrue(self.widget.Error.no_continuous_features.is_shown()) self.send_signal(self.widget.Inputs.data, None) self.assertFalse(self.widget.Error.no_continuous_features.is_shown()) @@ -53,32 +110,39 @@ def test_jaccard_messages(self): if name == "Jaccard": break self.send_signal(self.widget.Inputs.data, self.iris) + self.wait_until_stop_blocking() self.assertTrue(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, None) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, self.titanic) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertTrue(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, None) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, self.titanic) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertTrue(self.widget.Warning.ignoring_nonbinary.is_shown()) dom = self.titanic.domain dom = Domain(dom.attributes[1:], dom.class_var) self.send_signal(self.widget.Inputs.data, self.titanic.transform(dom)) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, Table("heart_disease")) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_discrete.is_shown()) @@ -93,10 +157,12 @@ def test_too_big_array(self): mock = Mock(side_effect=ValueError) self.widget.compute_distances(mock, self.iris) + self.wait_until_stop_blocking() self.assertTrue(self.widget.Error.distances_value_error.is_shown()) mock = Mock(side_effect=MemoryError) self.widget.compute_distances(mock, self.iris) + self.wait_until_stop_blocking() self.assertEqual(len(self.widget.Error.active), 1) self.assertTrue(self.widget.Error.distances_memory_error.is_shown()) @@ -110,5 +176,10 @@ def test_negative_values_bhattacharyya(self): if metric == distance.Bhattacharyya: break self.send_signal(self.widget.Inputs.data, self.iris) + self.wait_until_stop_blocking() self.assertTrue(self.widget.Error.distances_value_error.is_shown()) self.iris.X[0, 0] *= -1 + + +if __name__ == "__main__": + unittest.main()