25#ifndef PY_SSIZE_T_CLEAN
26#define PY_SSIZE_T_CLEAN
30 #error Python headers needed to compile C extensions, please install development version of Python.
31#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
32 #error Cython requires Python 2.6+ or Python 3.3+.
34#define CYTHON_ABI "0_29_28"
35#define CYTHON_HEX_VERSION 0x001D1CF0
36#define CYTHON_FUTURE_DIVISION 0
39 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
41#if !defined(WIN32) && !defined(MS_WINDOWS)
53 #define DL_IMPORT(t) t
56 #define DL_EXPORT(t) t
60 #if PY_VERSION_HEX >= 0x02070000
61 #define HAVE_LONG_LONG
65 #define PY_LONG_LONG LONG_LONG
68 #define Py_HUGE_VAL HUGE_VAL
71 #define CYTHON_COMPILING_IN_PYPY 1
72 #define CYTHON_COMPILING_IN_PYSTON 0
73 #define CYTHON_COMPILING_IN_CPYTHON 0
74 #undef CYTHON_USE_TYPE_SLOTS
75 #define CYTHON_USE_TYPE_SLOTS 0
76 #undef CYTHON_USE_PYTYPE_LOOKUP
77 #define CYTHON_USE_PYTYPE_LOOKUP 0
78 #if PY_VERSION_HEX < 0x03050000
79 #undef CYTHON_USE_ASYNC_SLOTS
80 #define CYTHON_USE_ASYNC_SLOTS 0
81 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
82 #define CYTHON_USE_ASYNC_SLOTS 1
84 #undef CYTHON_USE_PYLIST_INTERNALS
85 #define CYTHON_USE_PYLIST_INTERNALS 0
86 #undef CYTHON_USE_UNICODE_INTERNALS
87 #define CYTHON_USE_UNICODE_INTERNALS 0
88 #undef CYTHON_USE_UNICODE_WRITER
89 #define CYTHON_USE_UNICODE_WRITER 0
90 #undef CYTHON_USE_PYLONG_INTERNALS
91 #define CYTHON_USE_PYLONG_INTERNALS 0
92 #undef CYTHON_AVOID_BORROWED_REFS
93 #define CYTHON_AVOID_BORROWED_REFS 1
94 #undef CYTHON_ASSUME_SAFE_MACROS
95 #define CYTHON_ASSUME_SAFE_MACROS 0
96 #undef CYTHON_UNPACK_METHODS
97 #define CYTHON_UNPACK_METHODS 0
98 #undef CYTHON_FAST_THREAD_STATE
99 #define CYTHON_FAST_THREAD_STATE 0
100 #undef CYTHON_FAST_PYCALL
101 #define CYTHON_FAST_PYCALL 0
102 #undef CYTHON_PEP489_MULTI_PHASE_INIT
103 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
104 #undef CYTHON_USE_TP_FINALIZE
105 #define CYTHON_USE_TP_FINALIZE 0
106 #undef CYTHON_USE_DICT_VERSIONS
107 #define CYTHON_USE_DICT_VERSIONS 0
108 #undef CYTHON_USE_EXC_INFO_STACK
109 #define CYTHON_USE_EXC_INFO_STACK 0
110#elif defined(PYSTON_VERSION)
111 #define CYTHON_COMPILING_IN_PYPY 0
112 #define CYTHON_COMPILING_IN_PYSTON 1
113 #define CYTHON_COMPILING_IN_CPYTHON 0
114 #ifndef CYTHON_USE_TYPE_SLOTS
115 #define CYTHON_USE_TYPE_SLOTS 1
117 #undef CYTHON_USE_PYTYPE_LOOKUP
118 #define CYTHON_USE_PYTYPE_LOOKUP 0
119 #undef CYTHON_USE_ASYNC_SLOTS
120 #define CYTHON_USE_ASYNC_SLOTS 0
121 #undef CYTHON_USE_PYLIST_INTERNALS
122 #define CYTHON_USE_PYLIST_INTERNALS 0
123 #ifndef CYTHON_USE_UNICODE_INTERNALS
124 #define CYTHON_USE_UNICODE_INTERNALS 1
126 #undef CYTHON_USE_UNICODE_WRITER
127 #define CYTHON_USE_UNICODE_WRITER 0
128 #undef CYTHON_USE_PYLONG_INTERNALS
129 #define CYTHON_USE_PYLONG_INTERNALS 0
130 #ifndef CYTHON_AVOID_BORROWED_REFS
131 #define CYTHON_AVOID_BORROWED_REFS 0
133 #ifndef CYTHON_ASSUME_SAFE_MACROS
134 #define CYTHON_ASSUME_SAFE_MACROS 1
136 #ifndef CYTHON_UNPACK_METHODS
137 #define CYTHON_UNPACK_METHODS 1
139 #undef CYTHON_FAST_THREAD_STATE
140 #define CYTHON_FAST_THREAD_STATE 0
141 #undef CYTHON_FAST_PYCALL
142 #define CYTHON_FAST_PYCALL 0
143 #undef CYTHON_PEP489_MULTI_PHASE_INIT
144 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
145 #undef CYTHON_USE_TP_FINALIZE
146 #define CYTHON_USE_TP_FINALIZE 0
147 #undef CYTHON_USE_DICT_VERSIONS
148 #define CYTHON_USE_DICT_VERSIONS 0
149 #undef CYTHON_USE_EXC_INFO_STACK
150 #define CYTHON_USE_EXC_INFO_STACK 0
152 #define CYTHON_COMPILING_IN_PYPY 0
153 #define CYTHON_COMPILING_IN_PYSTON 0
154 #define CYTHON_COMPILING_IN_CPYTHON 1
155 #ifndef CYTHON_USE_TYPE_SLOTS
156 #define CYTHON_USE_TYPE_SLOTS 1
158 #if PY_VERSION_HEX < 0x02070000
159 #undef CYTHON_USE_PYTYPE_LOOKUP
160 #define CYTHON_USE_PYTYPE_LOOKUP 0
161 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
162 #define CYTHON_USE_PYTYPE_LOOKUP 1
164 #if PY_MAJOR_VERSION < 3
165 #undef CYTHON_USE_ASYNC_SLOTS
166 #define CYTHON_USE_ASYNC_SLOTS 0
167 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
168 #define CYTHON_USE_ASYNC_SLOTS 1
170 #if PY_VERSION_HEX < 0x02070000
171 #undef CYTHON_USE_PYLONG_INTERNALS
172 #define CYTHON_USE_PYLONG_INTERNALS 0
173 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
174 #define CYTHON_USE_PYLONG_INTERNALS 1
176 #ifndef CYTHON_USE_PYLIST_INTERNALS
177 #define CYTHON_USE_PYLIST_INTERNALS 1
179 #ifndef CYTHON_USE_UNICODE_INTERNALS
180 #define CYTHON_USE_UNICODE_INTERNALS 1
182 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
183 #undef CYTHON_USE_UNICODE_WRITER
184 #define CYTHON_USE_UNICODE_WRITER 0
185 #elif !defined(CYTHON_USE_UNICODE_WRITER)
186 #define CYTHON_USE_UNICODE_WRITER 1
188 #ifndef CYTHON_AVOID_BORROWED_REFS
189 #define CYTHON_AVOID_BORROWED_REFS 0
191 #ifndef CYTHON_ASSUME_SAFE_MACROS
192 #define CYTHON_ASSUME_SAFE_MACROS 1
194 #ifndef CYTHON_UNPACK_METHODS
195 #define CYTHON_UNPACK_METHODS 1
197 #if PY_VERSION_HEX >= 0x030B00A4
198 #undef CYTHON_FAST_THREAD_STATE
199 #define CYTHON_FAST_THREAD_STATE 0
200 #elif !defined(CYTHON_FAST_THREAD_STATE)
201 #define CYTHON_FAST_THREAD_STATE 1
203 #ifndef CYTHON_FAST_PYCALL
204 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1)
206 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
207 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
209 #ifndef CYTHON_USE_TP_FINALIZE
210 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
212 #ifndef CYTHON_USE_DICT_VERSIONS
213 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
215 #if PY_VERSION_HEX >= 0x030B00A4
216 #undef CYTHON_USE_EXC_INFO_STACK
217 #define CYTHON_USE_EXC_INFO_STACK 0
218 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
219 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
222#if !defined(CYTHON_FAST_PYCCALL)
223#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
225#if CYTHON_USE_PYLONG_INTERNALS
226 #if PY_MAJOR_VERSION < 3
227 #include "longintrepr.h"
233 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
236#ifndef __has_attribute
237 #define __has_attribute(x) 0
239#ifndef __has_cpp_attribute
240 #define __has_cpp_attribute(x) 0
242#ifndef CYTHON_RESTRICT
243 #if defined(__GNUC__)
244 #define CYTHON_RESTRICT __restrict__
245 #elif defined(_MSC_VER) && _MSC_VER >= 1400
246 #define CYTHON_RESTRICT __restrict
247 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
248 #define CYTHON_RESTRICT restrict
250 #define CYTHON_RESTRICT
254# if defined(__GNUC__)
255# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
256# define CYTHON_UNUSED __attribute__ ((__unused__))
258# define CYTHON_UNUSED
260# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
261# define CYTHON_UNUSED __attribute__ ((__unused__))
263# define CYTHON_UNUSED
266#ifndef CYTHON_MAYBE_UNUSED_VAR
267# if defined(__cplusplus)
268 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
270# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
273#ifndef CYTHON_NCP_UNUSED
274# if CYTHON_COMPILING_IN_CPYTHON
275# define CYTHON_NCP_UNUSED
277# define CYTHON_NCP_UNUSED CYTHON_UNUSED
280#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
282 #ifndef _MSC_STDINT_H_
284 typedef unsigned char uint8_t;
285 typedef unsigned int uint32_t;
287 typedef unsigned __int8 uint8_t;
288 typedef unsigned __int32 uint32_t;
294#ifndef CYTHON_FALLTHROUGH
295 #if defined(__cplusplus) && __cplusplus >= 201103L
296 #if __has_cpp_attribute(fallthrough)
297 #define CYTHON_FALLTHROUGH [[fallthrough]]
298 #elif __has_cpp_attribute(clang::fallthrough)
299 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
300 #elif __has_cpp_attribute(gnu::fallthrough)
301 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
304 #ifndef CYTHON_FALLTHROUGH
305 #if __has_attribute(fallthrough)
306 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
308 #define CYTHON_FALLTHROUGH
311 #if defined(__clang__ ) && defined(__apple_build_version__)
312 #if __apple_build_version__ < 7000000
313 #undef CYTHON_FALLTHROUGH
314 #define CYTHON_FALLTHROUGH
320 #if defined(__clang__)
321 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
322 #elif defined(__GNUC__)
323 #define CYTHON_INLINE __inline__
324 #elif defined(_MSC_VER)
325 #define CYTHON_INLINE __inline
326 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
327 #define CYTHON_INLINE inline
329 #define CYTHON_INLINE
333#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
334 #define Py_OptimizeFlag 0
336#define __PYX_BUILD_PY_SSIZE_T "n"
337#define CYTHON_FORMAT_SSIZE_T "z"
338#if PY_MAJOR_VERSION < 3
339 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
340 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
341 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
342 #define __Pyx_DefaultClassType PyClass_Type
344 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
345 #define __Pyx_DefaultClassType PyType_Type
346#if PY_VERSION_HEX >= 0x030B00A1
347 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(
int a,
int k,
int l,
int s,
int f,
348 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
349 PyObject *fv, PyObject *cell, PyObject* fn,
350 PyObject *name,
int fline, PyObject *lnos) {
351 PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
352 PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
353 const char *fn_cstr=NULL;
354 const char *name_cstr=NULL;
355 PyCodeObject* co=NULL;
356 PyObject *
type, *value, *traceback;
357 PyErr_Fetch(&type, &value, &traceback);
358 if (!(kwds=PyDict_New()))
goto end;
359 if (!(argcount=PyLong_FromLong(a)))
goto end;
360 if (PyDict_SetItemString(kwds,
"co_argcount", argcount) != 0)
goto end;
361 if (!(posonlyargcount=PyLong_FromLong(0)))
goto end;
362 if (PyDict_SetItemString(kwds,
"co_posonlyargcount", posonlyargcount) != 0)
goto end;
363 if (!(kwonlyargcount=PyLong_FromLong(k)))
goto end;
364 if (PyDict_SetItemString(kwds,
"co_kwonlyargcount", kwonlyargcount) != 0)
goto end;
365 if (!(nlocals=PyLong_FromLong(l)))
goto end;
366 if (PyDict_SetItemString(kwds,
"co_nlocals", nlocals) != 0)
goto end;
367 if (!(stacksize=PyLong_FromLong(s)))
goto end;
368 if (PyDict_SetItemString(kwds,
"co_stacksize", stacksize) != 0)
goto end;
369 if (!(flags=PyLong_FromLong(f)))
goto end;
370 if (PyDict_SetItemString(kwds,
"co_flags", flags) != 0)
goto end;
371 if (PyDict_SetItemString(kwds,
"co_code", code) != 0)
goto end;
372 if (PyDict_SetItemString(kwds,
"co_consts", c) != 0)
goto end;
373 if (PyDict_SetItemString(kwds,
"co_names", n) != 0)
goto end;
374 if (PyDict_SetItemString(kwds,
"co_varnames", v) != 0)
goto end;
375 if (PyDict_SetItemString(kwds,
"co_freevars", fv) != 0)
goto end;
376 if (PyDict_SetItemString(kwds,
"co_cellvars", cell) != 0)
goto end;
377 if (PyDict_SetItemString(kwds,
"co_linetable", lnos) != 0)
goto end;
378 if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL)))
goto end;
379 if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL)))
goto end;
380 if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline)))
goto end;
381 if (!(replace = PyObject_GetAttrString((PyObject*)co,
"replace")))
goto cleanup_code_too;
382 if (!(empty = PyTuple_New(0)))
goto cleanup_code_too;
383 if (!(call_result = PyObject_Call(replace, empty, kwds)))
goto cleanup_code_too;
384 Py_XDECREF((PyObject*)co);
385 co = (PyCodeObject*)call_result;
389 Py_XDECREF((PyObject*)co);
394 Py_XDECREF(argcount);
395 Py_XDECREF(posonlyargcount);
396 Py_XDECREF(kwonlyargcount);
398 Py_XDECREF(stacksize);
400 Py_XDECREF(call_result);
403 PyErr_Restore(type, value, traceback);
408 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
409 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
411 #define __Pyx_DefaultClassType PyType_Type
413#ifndef Py_TPFLAGS_CHECKTYPES
414 #define Py_TPFLAGS_CHECKTYPES 0
416#ifndef Py_TPFLAGS_HAVE_INDEX
417 #define Py_TPFLAGS_HAVE_INDEX 0
419#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
420 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
422#ifndef Py_TPFLAGS_HAVE_FINALIZE
423 #define Py_TPFLAGS_HAVE_FINALIZE 0
425#ifndef METH_STACKLESS
426 #define METH_STACKLESS 0
428#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
429 #ifndef METH_FASTCALL
430 #define METH_FASTCALL 0x80
432 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *
const *
args, Py_ssize_t
nargs);
433 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *
const *
args,
434 Py_ssize_t
nargs, PyObject *kwnames);
436 #define __Pyx_PyCFunctionFast _PyCFunctionFast
437 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
439#if CYTHON_FAST_PYCCALL
440#define __Pyx_PyFastCFunction_Check(func)\
441 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
443#define __Pyx_PyFastCFunction_Check(func) 0
445#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
446 #define PyObject_Malloc(s) PyMem_Malloc(s)
447 #define PyObject_Free(p) PyMem_Free(p)
448 #define PyObject_Realloc(p) PyMem_Realloc(p)
450#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
451 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
452 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
453 #define PyMem_RawFree(p) PyMem_Free(p)
455#if CYTHON_COMPILING_IN_PYSTON
456 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
457 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
459 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
460 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
462#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
463 #define __Pyx_PyThreadState_Current PyThreadState_GET()
464#elif PY_VERSION_HEX >= 0x03060000
465 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
466#elif PY_VERSION_HEX >= 0x03000000
467 #define __Pyx_PyThreadState_Current PyThreadState_GET()
469 #define __Pyx_PyThreadState_Current _PyThreadState_Current
471#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
473#define Py_tss_NEEDS_INIT 0
475static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
476 *key = PyThread_create_key();
479static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
480 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
481 *key = Py_tss_NEEDS_INIT;
484static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
487static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
488 return *key != Py_tss_NEEDS_INIT;
490static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
491 PyThread_delete_key(*key);
492 *key = Py_tss_NEEDS_INIT;
494static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
495 return PyThread_set_key_value(*key, value);
497static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
498 return PyThread_get_key_value(*key);
501#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
502#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
504#define __Pyx_PyDict_NewPresized(n) PyDict_New()
506#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
507 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
508 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
510 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
511 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
513#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
514#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
516#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
518#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
519 #define CYTHON_PEP393_ENABLED 1
520 #if defined(PyUnicode_IS_READY)
521 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
522 0 : _PyUnicode_Ready((PyObject *)(op)))
524 #define __Pyx_PyUnicode_READY(op) (0)
526 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
527 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
528 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
529 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
530 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
531 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
532 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
533 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
534 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
535 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
537 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
540 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
543 #define CYTHON_PEP393_ENABLED 0
544 #define PyUnicode_1BYTE_KIND 1
545 #define PyUnicode_2BYTE_KIND 2
546 #define PyUnicode_4BYTE_KIND 4
547 #define __Pyx_PyUnicode_READY(op) (0)
548 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
549 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
550 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
551 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
552 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
553 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
554 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
555 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
557#if CYTHON_COMPILING_IN_PYPY
558 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
559 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
561 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
562 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
563 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
565#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
566 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
568#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
569 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
571#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
572 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
574#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))
575#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
576#if PY_MAJOR_VERSION >= 3
577 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
579 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
581#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
582 #define PyObject_ASCII(o) PyObject_Repr(o)
584#if PY_MAJOR_VERSION >= 3
585 #define PyBaseString_Type PyUnicode_Type
586 #define PyStringObject PyUnicodeObject
587 #define PyString_Type PyUnicode_Type
588 #define PyString_Check PyUnicode_Check
589 #define PyString_CheckExact PyUnicode_CheckExact
590#ifndef PyObject_Unicode
591 #define PyObject_Unicode PyObject_Str
594#if PY_MAJOR_VERSION >= 3
595 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
596 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
598 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
599 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
601#ifndef PySet_CheckExact
602 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
604#if PY_VERSION_HEX >= 0x030900A4
605 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
606 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
608 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
609 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
611#if CYTHON_ASSUME_SAFE_MACROS
612 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
614 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
616#if PY_MAJOR_VERSION >= 3
617 #define PyIntObject PyLongObject
618 #define PyInt_Type PyLong_Type
619 #define PyInt_Check(op) PyLong_Check(op)
620 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
621 #define PyInt_FromString PyLong_FromString
622 #define PyInt_FromUnicode PyLong_FromUnicode
623 #define PyInt_FromLong PyLong_FromLong
624 #define PyInt_FromSize_t PyLong_FromSize_t
625 #define PyInt_FromSsize_t PyLong_FromSsize_t
626 #define PyInt_AsLong PyLong_AsLong
627 #define PyInt_AS_LONG PyLong_AS_LONG
628 #define PyInt_AsSsize_t PyLong_AsSsize_t
629 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
630 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
631 #define PyNumber_Int PyNumber_Long
633#if PY_MAJOR_VERSION >= 3
634 #define PyBoolObject PyLongObject
636#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
637 #ifndef PyUnicode_InternFromString
638 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
641#if PY_VERSION_HEX < 0x030200A4
642 typedef long Py_hash_t;
643 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
644 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
646 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
647 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
649#if PY_MAJOR_VERSION >= 3
650 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
652 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
654#if CYTHON_USE_ASYNC_SLOTS
655 #if PY_VERSION_HEX >= 0x030500B1
656 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
657 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
659 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
662 #define __Pyx_PyType_AsAsync(obj) NULL
664#ifndef __Pyx_PyAsyncMethodsStruct
669 } __Pyx_PyAsyncMethodsStruct;
672#if defined(WIN32) || defined(MS_WINDOWS)
673 #define _USE_MATH_DEFINES
677#define __PYX_NAN() ((float) NAN)
679static CYTHON_INLINE
float __PYX_NAN() {
681 memset(&value, 0xFF,
sizeof(value));
685#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
686#define __Pyx_truncl trunc
688#define __Pyx_truncl truncl
691#define __PYX_MARK_ERR_POS(f_index, lineno) \
692 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
693#define __PYX_ERR(f_index, lineno, Ln_error) \
694 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
696#ifndef __PYX_EXTERN_C
698 #define __PYX_EXTERN_C extern "C"
700 #define __PYX_EXTERN_C extern
704#define __PYX_HAVE__roc_cy
705#define __PYX_HAVE_API__roc_cy
709#include "numpy/arrayobject.h"
710#include "numpy/ndarrayobject.h"
711#include "numpy/ndarraytypes.h"
712#include "numpy/arrayscalars.h"
713#include "numpy/ufuncobject.h"
724#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
725#define CYTHON_WITHOUT_ASSERTIONS
728typedef struct {PyObject **p;
const char *s;
const Py_ssize_t n;
const char* encoding;
729 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
731#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
732#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
733#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
734#define __PYX_DEFAULT_STRING_ENCODING ""
735#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
736#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
737#define __Pyx_uchar_cast(c) ((unsigned char)c)
738#define __Pyx_long_cast(x) ((long)x)
739#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
740 (sizeof(type) < sizeof(Py_ssize_t)) ||\
741 (sizeof(type) > sizeof(Py_ssize_t) &&\
742 likely(v < (type)PY_SSIZE_T_MAX ||\
743 v == (type)PY_SSIZE_T_MAX) &&\
744 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
745 v == (type)PY_SSIZE_T_MIN))) ||\
746 (sizeof(type) == sizeof(Py_ssize_t) &&\
747 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
748 v == (type)PY_SSIZE_T_MAX))) )
749static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
750 return (
size_t) i < (size_t) limit;
752#if defined (__cplusplus) && __cplusplus >= 201103L
754 #define __Pyx_sst_abs(value) std::abs(value)
755#elif SIZEOF_INT >= SIZEOF_SIZE_T
756 #define __Pyx_sst_abs(value) abs(value)
757#elif SIZEOF_LONG >= SIZEOF_SIZE_T
758 #define __Pyx_sst_abs(value) labs(value)
759#elif defined (_MSC_VER)
760 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
761#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
762 #define __Pyx_sst_abs(value) llabs(value)
763#elif defined (__GNUC__)
764 #define __Pyx_sst_abs(value) __builtin_llabs(value)
766 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
768static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
769static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
770#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
771#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
772#define __Pyx_PyBytes_FromString PyBytes_FromString
773#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
774static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
775#if PY_MAJOR_VERSION < 3
776 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
777 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
779 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
780 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
782#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
783#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
784#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
785#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
786#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
787#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
788#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
789#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
790#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
791#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
792#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
793#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
794#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
795#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
796#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
797#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
798static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *u) {
799 const Py_UNICODE *u_end = u;
801 return (
size_t)(u_end - u - 1);
803#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
804#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
805#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
806#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
807#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
808static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
809static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
810static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
811static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
812#define __Pyx_PySequence_Tuple(obj)\
813 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
814static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
815static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
816static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
817#if CYTHON_ASSUME_SAFE_MACROS
818#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
820#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
822#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
823#if PY_MAJOR_VERSION >= 3
824#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
826#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
828#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
829#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
830static int __Pyx_sys_getdefaultencoding_not_ascii;
831static int __Pyx_init_sys_getdefaultencoding_params(
void) {
833 PyObject* default_encoding = NULL;
834 PyObject* ascii_chars_u = NULL;
835 PyObject* ascii_chars_b = NULL;
836 const char* default_encoding_c;
837 sys = PyImport_ImportModule(
"sys");
839 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
841 if (!default_encoding)
goto bad;
842 default_encoding_c = PyBytes_AsString(default_encoding);
843 if (!default_encoding_c)
goto bad;
844 if (strcmp(default_encoding_c,
"ascii") == 0) {
845 __Pyx_sys_getdefaultencoding_not_ascii = 0;
847 char ascii_chars[128];
849 for (c = 0; c < 128; c++) {
852 __Pyx_sys_getdefaultencoding_not_ascii = 1;
853 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
854 if (!ascii_chars_u)
goto bad;
855 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
856 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
859 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
863 Py_DECREF(ascii_chars_u);
864 Py_DECREF(ascii_chars_b);
866 Py_DECREF(default_encoding);
869 Py_XDECREF(default_encoding);
870 Py_XDECREF(ascii_chars_u);
871 Py_XDECREF(ascii_chars_b);
875#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
876#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
878#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
879#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
880static char* __PYX_DEFAULT_STRING_ENCODING;
881static int __Pyx_init_sys_getdefaultencoding_params(
void) {
883 PyObject* default_encoding = NULL;
884 char* default_encoding_c;
885 sys = PyImport_ImportModule(
"sys");
887 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
889 if (!default_encoding)
goto bad;
890 default_encoding_c = PyBytes_AsString(default_encoding);
891 if (!default_encoding_c)
goto bad;
892 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
893 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
894 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
895 Py_DECREF(default_encoding);
898 Py_XDECREF(default_encoding);
906#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
907 #define likely(x) __builtin_expect(!!(x), 1)
908 #define unlikely(x) __builtin_expect(!!(x), 0)
910 #define likely(x) (x)
911 #define unlikely(x) (x)
913static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
915static PyObject *__pyx_m = NULL;
916static PyObject *__pyx_d;
917static PyObject *__pyx_b;
918static PyObject *__pyx_cython_runtime = NULL;
919static PyObject *__pyx_empty_tuple;
920static PyObject *__pyx_empty_bytes;
921static PyObject *__pyx_empty_unicode;
922static int __pyx_lineno;
923static int __pyx_clineno = 0;
924static const char * __pyx_cfilenm= __FILE__;
925static const char *__pyx_filename;
928#if !defined(CYTHON_CCOMPLEX)
929 #if defined(__cplusplus)
930 #define CYTHON_CCOMPLEX 1
931 #elif defined(_Complex_I)
932 #define CYTHON_CCOMPLEX 1
934 #define CYTHON_CCOMPLEX 0
944#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
946 #define _Complex_I 1.0fj
950static const char *__pyx_f[] = {
957struct __pyx_memoryview_obj;
959 struct __pyx_memoryview_obj *memview;
962 Py_ssize_t strides[8];
963 Py_ssize_t suboffsets[8];
965#define __Pyx_MemoryView_Len(m) (m.shape[0])
969#ifndef CYTHON_ATOMICS
970 #define CYTHON_ATOMICS 1
972#define __pyx_atomic_int_type int
973#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
974 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
976 #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
977 #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
978 #ifdef __PYX_DEBUG_ATOMICS
979 #warning "Using GNU atomics"
981#elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
983 #undef __pyx_atomic_int_type
984 #define __pyx_atomic_int_type LONG
985 #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
986 #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
987 #ifdef __PYX_DEBUG_ATOMICS
988 #pragma message ("Using MSVC atomics")
990#elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
991 #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
992 #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
993 #ifdef __PYX_DEBUG_ATOMICS
994 #warning "Using Intel atomics"
997 #undef CYTHON_ATOMICS
998 #define CYTHON_ATOMICS 0
999 #ifdef __PYX_DEBUG_ATOMICS
1000 #warning "Not using atomics"
1003typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
1005 #define __pyx_add_acquisition_count(memview)\
1006 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
1007 #define __pyx_sub_acquisition_count(memview)\
1008 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
1010 #define __pyx_add_acquisition_count(memview)\
1011 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1012 #define __pyx_sub_acquisition_count(memview)\
1013 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1017#ifndef __PYX_FORCE_INIT_THREADS
1018 #define __PYX_FORCE_INIT_THREADS 0
1022#define __Pyx_PyGILState_Ensure PyGILState_Ensure
1023#define __Pyx_PyGILState_Release PyGILState_Release
1024#define __Pyx_FastGIL_Remember()
1025#define __Pyx_FastGIL_Forget()
1026#define __Pyx_FastGilFuncInit()
1029#define IS_UNSIGNED(type) (((type) -1) > 0)
1030struct __Pyx_StructField_;
1031#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
1034 struct __Pyx_StructField_* fields;
1036 size_t arraysize[8];
1042typedef struct __Pyx_StructField_ {
1043 __Pyx_TypeInfo*
type;
1048 __Pyx_StructField* field;
1049 size_t parent_offset;
1050} __Pyx_BufFmt_StackElem;
1052 __Pyx_StructField root;
1053 __Pyx_BufFmt_StackElem* head;
1055 size_t new_count, enc_count;
1056 size_t struct_alignment;
1061 char is_valid_array;
1062} __Pyx_BufFmt_Context;
1072typedef npy_int8 __pyx_t_5numpy_int8_t;
1081typedef npy_int16 __pyx_t_5numpy_int16_t;
1090typedef npy_int32 __pyx_t_5numpy_int32_t;
1099typedef npy_int64 __pyx_t_5numpy_int64_t;
1108typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1117typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1126typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1135typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1144typedef npy_float32 __pyx_t_5numpy_float32_t;
1153typedef npy_float64 __pyx_t_5numpy_float64_t;
1162typedef npy_long __pyx_t_5numpy_int_t;
1171typedef npy_longlong __pyx_t_5numpy_long_t;
1180typedef npy_longlong __pyx_t_5numpy_longlong_t;
1189typedef npy_ulong __pyx_t_5numpy_uint_t;
1198typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1207typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1216typedef npy_intp __pyx_t_5numpy_intp_t;
1225typedef npy_uintp __pyx_t_5numpy_uintp_t;
1234typedef npy_double __pyx_t_5numpy_float_t;
1243typedef npy_double __pyx_t_5numpy_double_t;
1252typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1256 typedef ::std::complex< float > __pyx_t_float_complex;
1258 typedef float _Complex __pyx_t_float_complex;
1261 typedef struct {
float real, imag; } __pyx_t_float_complex;
1263static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1268 typedef ::std::complex< double > __pyx_t_double_complex;
1270 typedef double _Complex __pyx_t_double_complex;
1273 typedef struct {
double real, imag; } __pyx_t_double_complex;
1275static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1279struct __pyx_array_obj;
1280struct __pyx_MemviewEnum_obj;
1281struct __pyx_memoryview_obj;
1282struct __pyx_memoryviewslice_obj;
1291typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1300typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1309typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1318typedef npy_cdouble __pyx_t_5numpy_complex_t;
1327struct __pyx_array_obj {
1329 struct __pyx_vtabstruct_array *__pyx_vtab;
1335 Py_ssize_t *_strides;
1336 Py_ssize_t itemsize;
1339 void (*callback_free_data)(
void *);
1341 int dtype_is_object;
1352struct __pyx_MemviewEnum_obj {
1365struct __pyx_memoryview_obj {
1367 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1370 PyObject *_array_interface;
1371 PyThread_type_lock lock;
1372 __pyx_atomic_int acquisition_count[2];
1373 __pyx_atomic_int *acquisition_count_aligned_p;
1376 int dtype_is_object;
1377 __Pyx_TypeInfo *typeinfo;
1388struct __pyx_memoryviewslice_obj {
1389 struct __pyx_memoryview_obj __pyx_base;
1390 __Pyx_memviewslice from_slice;
1391 PyObject *from_object;
1392 PyObject *(*to_object_func)(
char *);
1393 int (*to_dtype_func)(
char *, PyObject *);
1406struct __pyx_vtabstruct_array {
1407 PyObject *(*get_memview)(
struct __pyx_array_obj *);
1409static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1420struct __pyx_vtabstruct_memoryview {
1421 char *(*get_item_pointer)(
struct __pyx_memoryview_obj *, PyObject *);
1422 PyObject *(*is_slice)(
struct __pyx_memoryview_obj *, PyObject *);
1423 PyObject *(*setitem_slice_assignment)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1424 PyObject *(*setitem_slice_assign_scalar)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *);
1425 PyObject *(*setitem_indexed)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1426 PyObject *(*convert_item_to_object)(
struct __pyx_memoryview_obj *,
char *);
1427 PyObject *(*assign_item_from_object)(
struct __pyx_memoryview_obj *,
char *, PyObject *);
1429static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1440struct __pyx_vtabstruct__memoryviewslice {
1441 struct __pyx_vtabstruct_memoryview __pyx_base;
1443static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1447#ifndef CYTHON_REFNANNY
1448 #define CYTHON_REFNANNY 0
1452 void (*INCREF)(
void*, PyObject*,
int);
1453 void (*DECREF)(
void*, PyObject*,
int);
1454 void (*GOTREF)(
void*, PyObject*,
int);
1455 void (*GIVEREF)(
void*, PyObject*,
int);
1456 void* (*SetupContext)(
const char*,
int,
const char*);
1457 void (*FinishContext)(
void**);
1458 } __Pyx_RefNannyAPIStruct;
1459 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1460 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1461 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1463 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1465 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1466 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1467 PyGILState_Release(__pyx_gilstate_save);\
1469 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1472 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1473 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1475 #define __Pyx_RefNannyFinishContext()\
1476 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1477 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1478 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1479 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1480 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1481 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1482 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1483 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1484 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1486 #define __Pyx_RefNannyDeclarations
1487 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1488 #define __Pyx_RefNannyFinishContext()
1489 #define __Pyx_INCREF(r) Py_INCREF(r)
1490 #define __Pyx_DECREF(r) Py_DECREF(r)
1491 #define __Pyx_GOTREF(r)
1492 #define __Pyx_GIVEREF(r)
1493 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1494 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1495 #define __Pyx_XGOTREF(r)
1496 #define __Pyx_XGIVEREF(r)
1498#define __Pyx_XDECREF_SET(r, v) do {\
1499 PyObject *tmp = (PyObject *) r;\
1500 r = v; __Pyx_XDECREF(tmp);\
1502#define __Pyx_DECREF_SET(r, v) do {\
1503 PyObject *tmp = (PyObject *) r;\
1504 r = v; __Pyx_DECREF(tmp);\
1506#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1507#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1510#if CYTHON_USE_TYPE_SLOTS
1511static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1513#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1517static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1520#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1521#define __Pyx_MEMVIEW_DIRECT 1
1522#define __Pyx_MEMVIEW_PTR 2
1523#define __Pyx_MEMVIEW_FULL 4
1524#define __Pyx_MEMVIEW_CONTIG 8
1525#define __Pyx_MEMVIEW_STRIDED 16
1526#define __Pyx_MEMVIEW_FOLLOW 32
1527#define __Pyx_IS_C_CONTIG 1
1528#define __Pyx_IS_F_CONTIG 2
1529static int __Pyx_init_memviewslice(
1530 struct __pyx_memoryview_obj *memview,
1532 __Pyx_memviewslice *memviewslice,
1533 int memview_is_new_reference);
1534static CYTHON_INLINE
int __pyx_add_acquisition_count_locked(
1535 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1536static CYTHON_INLINE
int __pyx_sub_acquisition_count_locked(
1537 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1538#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1539#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1540#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1541#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1542static CYTHON_INLINE
void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1543static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1546#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1547#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1548#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1549#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1550 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1551 (cache_var) = (value);
1552#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1553 static PY_UINT64_T __pyx_dict_version = 0;\
1554 static PyObject *__pyx_dict_cached_value = NULL;\
1555 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1556 (VAR) = __pyx_dict_cached_value;\
1558 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1559 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1562static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1563static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1564static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1566#define __PYX_GET_DICT_VERSION(dict) (0)
1567#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1568#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1572#if CYTHON_USE_DICT_VERSIONS
1573#define __Pyx_GetModuleGlobalName(var, name) {\
1574 static PY_UINT64_T __pyx_dict_version = 0;\
1575 static PyObject *__pyx_dict_cached_value = NULL;\
1576 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1577 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1578 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1580#define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1581 PY_UINT64_T __pyx_dict_version;\
1582 PyObject *__pyx_dict_cached_value;\
1583 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1585static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1587#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1588#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1589static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1593#if CYTHON_COMPILING_IN_CPYTHON
1594static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1596#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1600#if CYTHON_FAST_PYCCALL
1601static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1603#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1607#if CYTHON_FAST_PYCALL
1608#define __Pyx_PyFunction_FastCall(func, args, nargs)\
1609 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1610#if 1 || PY_VERSION_HEX < 0x030600B1
1611static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1613#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1615#define __Pyx_BUILD_ASSERT_EXPR(cond)\
1616 (sizeof(char [1 - 2*!(cond)]) - 1)
1617#ifndef Py_MEMBER_SIZE
1618#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1620#if CYTHON_FAST_PYCALL
1621 static size_t __pyx_pyframe_localsplus_offset = 0;
1622 #include "frameobject.h"
1623 #define __Pxy_PyFrame_Initialize_Offsets()\
1624 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1625 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1626 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1627 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1632static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1635#if CYTHON_COMPILING_IN_CPYTHON
1636static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1640static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1643#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1644 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1645 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1646 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1647 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1648#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1649 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1650 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1651 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1652static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1653 int wraparound,
int boundscheck);
1654#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1655 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1656 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1657 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1658static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1659 int wraparound,
int boundscheck);
1660static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1661static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1662 int is_list,
int wraparound,
int boundscheck);
1665#if CYTHON_USE_TYPE_SLOTS
1666static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1668#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1672#if !CYTHON_COMPILING_IN_PYPY
1673static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2,
long intval,
int inplace,
int zerodivision_check);
1675#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1676 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1680static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
1681 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1684static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
1687static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1688 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1689 const char* function_name);
1692static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname);
1695#if CYTHON_USE_EXC_INFO_STACK
1696static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1700#if CYTHON_FAST_THREAD_STATE
1701#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1702#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1703#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1705#define __Pyx_PyThreadState_declare
1706#define __Pyx_PyThreadState_assign
1707#define __Pyx_PyErr_Occurred() PyErr_Occurred()
1711#if CYTHON_FAST_THREAD_STATE
1712#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1713static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1714#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1715static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1717#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1718#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1722#if CYTHON_FAST_THREAD_STATE
1723#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1724static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1726#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1730#if CYTHON_FAST_THREAD_STATE
1731#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1732static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1734static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1738#if CYTHON_FAST_THREAD_STATE
1739#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1740#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1741#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1742#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1743#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1744static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1745static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1746#if CYTHON_COMPILING_IN_CPYTHON
1747#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1749#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1752#define __Pyx_PyErr_Clear() PyErr_Clear()
1753#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1754#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1755#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1756#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1757#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1758#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1759#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1763static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1766#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1767 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1768 __Pyx__ArgTypeTest(obj, type, name, exact))
1769static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact);
1775static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
1778static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
1781#if PY_MAJOR_VERSION >= 3
1782#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1784#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1788#define UNARY_NEG_WOULD_OVERFLOW(x)\
1789 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1791static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1792static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *);
1794static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1797static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(
const char *s, Py_ssize_t size,
const char *errors) {
1799 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1801static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(
const char *s, Py_ssize_t size,
const char *errors) {
1803 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1805static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(
const char *s, Py_ssize_t size,
const char *errors) {
1807 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1811static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1812 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1813 const char* encoding,
const char* errors,
1814 PyObject* (*decode_func)(
const char *s, Py_ssize_t size,
const char *errors));
1817static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1820static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1823static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1826static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void);
1829static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1832#if CYTHON_FAST_THREAD_STATE
1833#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1834static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1836static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1840static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
1843#if CYTHON_COMPILING_IN_CPYTHON
1844#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1845static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1846static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1847static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1849#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1850#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1851#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1853#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1855static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1857#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1858static CYTHON_INLINE
int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1859 PyListObject* L = (PyListObject*) list;
1860 Py_ssize_t len = Py_SIZE(list);
1861 if (likely(L->allocated > len)) {
1863 PyList_SET_ITEM(list, len, x);
1864 __Pyx_SET_SIZE(list, len + 1);
1867 return PyList_Append(list, x);
1870#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1874static CYTHON_INLINE
int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1875#if CYTHON_COMPILING_IN_CPYTHON
1876 PyObject* none = _PyList_Extend((PyListObject*)L, v);
1877 if (unlikely(!none))
1882 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1887#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1888static CYTHON_INLINE
int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1889 PyListObject* L = (PyListObject*) list;
1890 Py_ssize_t len = Py_SIZE(list);
1891 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1893 PyList_SET_ITEM(list, len, x);
1894 __Pyx_SET_SIZE(list, len + 1);
1897 return PyList_Append(list, x);
1900#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1904static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1907static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *, PyObject *);
1910#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1911static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1913#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1917#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1918static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1920#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1924static int __Pyx_SetVtable(PyObject *dict,
void *vtable);
1927static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1930static int __Pyx_setup_reduce(PyObject* type_obj);
1933#ifndef __PYX_HAVE_RT_ImportType_proto
1934#define __PYX_HAVE_RT_ImportType_proto
1935enum __Pyx_ImportType_CheckSize {
1936 __Pyx_ImportType_CheckSize_Error = 0,
1937 __Pyx_ImportType_CheckSize_Warn = 1,
1938 __Pyx_ImportType_CheckSize_Ignore = 2
1940static PyTypeObject *__Pyx_ImportType(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
enum __Pyx_ImportType_CheckSize check_size);
1944#ifdef CYTHON_CLINE_IN_TRACEBACK
1945#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1947static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
1952 PyCodeObject* code_object;
1954} __Pyx_CodeObjectCacheEntry;
1955struct __Pyx_CodeObjectCache {
1958 __Pyx_CodeObjectCacheEntry* entries;
1960static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1961static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
1962static PyCodeObject *__pyx_find_code_object(
int code_line);
1963static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
1966static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
1967 int py_line,
const char *filename);
1969#if PY_MAJOR_VERSION < 3
1970 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
1971 static void __Pyx_ReleaseBuffer(Py_buffer *view);
1973 #define __Pyx_GetBuffer PyObject_GetBuffer
1974 #define __Pyx_ReleaseBuffer PyBuffer_Release
1980 Py_ssize_t shape, strides, suboffsets;
1987 __Pyx_Buffer *rcbuffer;
1989 __Pyx_Buf_DimInfo diminfo[8];
1993static int __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim);
1996static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
1997 __Pyx_memviewslice *slice2,
1998 int ndim,
size_t itemsize);
2001static CYTHON_INLINE PyObject *__pyx_capsule_create(
void *p,
const char *sig);
2004static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void);
2007static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts);
2008static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2009 __Pyx_BufFmt_StackElem* stack,
2010 __Pyx_TypeInfo* type);
2013static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2016static int __Pyx_ValidateAndInit_memviewslice(
2021 __Pyx_TypeInfo *dtype,
2022 __Pyx_BufFmt_StackElem stack[],
2023 __Pyx_memviewslice *memviewslice,
2024 PyObject *original_obj);
2027static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *,
int writable_flag);
2030static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_long(PyObject *,
int writable_flag);
2035 #define __Pyx_CREAL(z) ((z).real())
2036 #define __Pyx_CIMAG(z) ((z).imag())
2038 #define __Pyx_CREAL(z) (__real__(z))
2039 #define __Pyx_CIMAG(z) (__imag__(z))
2042 #define __Pyx_CREAL(z) ((z).real)
2043 #define __Pyx_CIMAG(z) ((z).imag)
2045#if defined(__cplusplus) && CYTHON_CCOMPLEX\
2046 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2047 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2048 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2050 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2051 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2056 #define __Pyx_c_eq_float(a, b) ((a)==(b))
2057 #define __Pyx_c_sum_float(a, b) ((a)+(b))
2058 #define __Pyx_c_diff_float(a, b) ((a)-(b))
2059 #define __Pyx_c_prod_float(a, b) ((a)*(b))
2060 #define __Pyx_c_quot_float(a, b) ((a)/(b))
2061 #define __Pyx_c_neg_float(a) (-(a))
2063 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2064 #define __Pyx_c_conj_float(z) (::std::conj(z))
2066 #define __Pyx_c_abs_float(z) (::std::abs(z))
2067 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2070 #define __Pyx_c_is_zero_float(z) ((z)==0)
2071 #define __Pyx_c_conj_float(z) (conjf(z))
2073 #define __Pyx_c_abs_float(z) (cabsf(z))
2074 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2078 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2079 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2080 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2081 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2082 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2083 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2084 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2085 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2087 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
2088 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2094 #define __Pyx_c_eq_double(a, b) ((a)==(b))
2095 #define __Pyx_c_sum_double(a, b) ((a)+(b))
2096 #define __Pyx_c_diff_double(a, b) ((a)-(b))
2097 #define __Pyx_c_prod_double(a, b) ((a)*(b))
2098 #define __Pyx_c_quot_double(a, b) ((a)/(b))
2099 #define __Pyx_c_neg_double(a) (-(a))
2101 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2102 #define __Pyx_c_conj_double(z) (::std::conj(z))
2104 #define __Pyx_c_abs_double(z) (::std::abs(z))
2105 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2108 #define __Pyx_c_is_zero_double(z) ((z)==0)
2109 #define __Pyx_c_conj_double(z) (conj(z))
2111 #define __Pyx_c_abs_double(z) (cabs(z))
2112 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2116 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2117 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2118 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2119 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2120 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2121 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2122 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2123 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2125 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
2126 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2131static CYTHON_INLINE PyObject *__pyx_memview_get_float(
const char *itemp);
2132static CYTHON_INLINE
int __pyx_memview_set_float(
const char *itemp, PyObject *obj);
2135#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2136#define __Pyx_HAS_GCC_DIAGNOSTIC
2140static CYTHON_INLINE PyObject *__pyx_memview_get_long(
const char *itemp);
2141static CYTHON_INLINE
int __pyx_memview_set_long(
const char *itemp, PyObject *obj);
2144static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_long(PyObject *,
int writable_flag);
2147static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *,
int writable_flag);
2150static __Pyx_memviewslice
2151__pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
2152 const char *mode,
int ndim,
2153 size_t sizeof_dtype,
int contig_flag,
2154 int dtype_is_object);
2157static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
2160static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
2163static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
2166static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
2169static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
2172static int __Pyx_check_binary_version(
void);
2175static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2177static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self);
2178static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2179static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj);
2180static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src);
2181static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value);
2182static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2183static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp);
2184static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2185static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp);
2186static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2201static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2214static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2215static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2216static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2217static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2218static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2219static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2220static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2221static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2222static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2223static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2224static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2225static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2226static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2227static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2228static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2231static PyTypeObject *__pyx_array_type = 0;
2232static PyTypeObject *__pyx_MemviewEnum_type = 0;
2233static PyTypeObject *__pyx_memoryview_type = 0;
2234static PyTypeObject *__pyx_memoryviewslice_type = 0;
2235static PyObject *
generic = 0;
2236static PyObject *strided = 0;
2237static PyObject *indirect = 0;
2238static PyObject *contiguous = 0;
2239static PyObject *indirect_contiguous = 0;
2240static int __pyx_memoryview_thread_locks_used;
2241static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2242static PyObject *__pyx_f_6roc_cy_evaluate_roc_cy(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice,
int __pyx_skip_dispatch);
2243static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t,
char *,
char *,
char *);
2244static void *__pyx_align_pointer(
void *,
size_t);
2245static PyObject *__pyx_memoryview_new(PyObject *,
int,
int, __Pyx_TypeInfo *);
2246static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *);
2247static PyObject *_unellipsify(PyObject *,
int);
2248static PyObject *assert_direct_dimensions(Py_ssize_t *,
int);
2249static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *, PyObject *);
2250static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int,
int);
2251static char *__pyx_pybuffer_index(Py_buffer *,
char *, Py_ssize_t, Py_ssize_t);
2252static int __pyx_memslice_transpose(__Pyx_memviewslice *);
2253static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice,
int, PyObject *(*)(
char *),
int (*)(
char *, PyObject *),
int);
2254static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2255static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2256static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *);
2257static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2258static Py_ssize_t abs_py_ssize_t(Py_ssize_t);
2259static char __pyx_get_best_slice_order(__Pyx_memviewslice *,
int);
2260static void _copy_strided_to_strided(
char *, Py_ssize_t *,
char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *,
int,
size_t);
2261static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *,
int,
size_t);
2262static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *,
int);
2263static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t,
int,
char);
2264static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *,
char,
int);
2265static int __pyx_memoryview_err_extents(
int, Py_ssize_t, Py_ssize_t);
2266static int __pyx_memoryview_err_dim(PyObject *,
char *,
int);
2267static int __pyx_memoryview_err(PyObject *,
char *);
2268static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice,
int,
int,
int);
2269static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *,
int,
int);
2270static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *,
int,
int,
int);
2271static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2272static void __pyx_memoryview_refcount_objects_in_slice(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2273static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *,
int,
size_t,
void *,
int);
2274static void __pyx_memoryview__slice_assign_scalar(
char *, Py_ssize_t *, Py_ssize_t *,
int,
size_t,
void *);
2275static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *, PyObject *);
2276static __Pyx_TypeInfo __Pyx_TypeInfo_float = {
"float", NULL,
sizeof(float), { 0 }, 0,
'R', 0, 0 };
2277static __Pyx_TypeInfo __Pyx_TypeInfo_long = {
"long", NULL,
sizeof(long), { 0 }, 0, IS_UNSIGNED(
long) ?
'U' :
'I', IS_UNSIGNED(
long), 0 };
2278#define __Pyx_MODULE_NAME "roc_cy"
2279extern int __pyx_module_is_main_roc_cy;
2280int __pyx_module_is_main_roc_cy = 0;
2283static PyObject *__pyx_builtin_range;
2284static PyObject *__pyx_builtin_ImportError;
2285static PyObject *__pyx_builtin_ValueError;
2286static PyObject *__pyx_builtin_MemoryError;
2287static PyObject *__pyx_builtin_enumerate;
2288static PyObject *__pyx_builtin_TypeError;
2289static PyObject *__pyx_builtin_Ellipsis;
2290static PyObject *__pyx_builtin_id;
2291static PyObject *__pyx_builtin_IndexError;
2292static const char __pyx_k_O[] =
"O";
2293static const char __pyx_k_c[] =
"c";
2294static const char __pyx_k_k[] =
"k";
2295static const char __pyx_k_id[] =
"id";
2296static const char __pyx_k_np[] =
"np";
2297static const char __pyx_k_add[] =
"add";
2298static const char __pyx_k_new[] =
"__new__";
2299static const char __pyx_k_obj[] =
"obj";
2300static const char __pyx_k_base[] =
"base";
2301static const char __pyx_k_dict[] =
"__dict__";
2302static const char __pyx_k_main[] =
"__main__";
2303static const char __pyx_k_mode[] =
"mode";
2304static const char __pyx_k_name[] =
"name";
2305static const char __pyx_k_ndim[] =
"ndim";
2306static const char __pyx_k_ones[] =
"ones";
2307static const char __pyx_k_pack[] =
"pack";
2308static const char __pyx_k_size[] =
"size";
2309static const char __pyx_k_step[] =
"step";
2310static const char __pyx_k_stop[] =
"stop";
2311static const char __pyx_k_test[] =
"__test__";
2312static const char __pyx_k_ASCII[] =
"ASCII";
2313static const char __pyx_k_class[] =
"__class__";
2314static const char __pyx_k_dtype[] =
"dtype";
2315static const char __pyx_k_error[] =
"error";
2316static const char __pyx_k_faiss[] =
"faiss";
2317static const char __pyx_k_flags[] =
"flags";
2318static const char __pyx_k_int64[] =
"int64";
2319static const char __pyx_k_numpy[] =
"numpy";
2320static const char __pyx_k_range[] =
"range";
2321static const char __pyx_k_shape[] =
"shape";
2322static const char __pyx_k_start[] =
"start";
2323static const char __pyx_k_zeros[] =
"zeros";
2324static const char __pyx_k_astype[] =
"astype";
2325static const char __pyx_k_encode[] =
"encode";
2326static const char __pyx_k_format[] =
"format";
2327static const char __pyx_k_g_pids[] =
"g_pids";
2328static const char __pyx_k_hstack[] =
"hstack";
2329static const char __pyx_k_import[] =
"__import__";
2330static const char __pyx_k_name_2[] =
"__name__";
2331static const char __pyx_k_pickle[] =
"pickle";
2332static const char __pyx_k_q_pids[] =
"q_pids";
2333static const char __pyx_k_reduce[] =
"__reduce__";
2334static const char __pyx_k_search[] =
"search";
2335static const char __pyx_k_struct[] =
"struct";
2336static const char __pyx_k_unpack[] =
"unpack";
2337static const char __pyx_k_update[] =
"update";
2338static const char __pyx_k_asarray[] =
"asarray";
2339static const char __pyx_k_distmat[] =
"distmat";
2340static const char __pyx_k_float32[] =
"float32";
2341static const char __pyx_k_fortran[] =
"fortran";
2342static const char __pyx_k_g_feats[] =
"g_feats";
2343static const char __pyx_k_memview[] =
"memview";
2344static const char __pyx_k_newaxis[] =
"newaxis";
2345static const char __pyx_k_q_feats[] =
"q_feats";
2346static const char __pyx_k_Ellipsis[] =
"Ellipsis";
2347static const char __pyx_k_g_camids[] =
"g_camids";
2348static const char __pyx_k_getstate[] =
"__getstate__";
2349static const char __pyx_k_itemsize[] =
"itemsize";
2350static const char __pyx_k_pyx_type[] =
"__pyx_type";
2351static const char __pyx_k_q_camids[] =
"q_camids";
2352static const char __pyx_k_setstate[] =
"__setstate__";
2353static const char __pyx_k_TypeError[] =
"TypeError";
2354static const char __pyx_k_enumerate[] =
"enumerate";
2355static const char __pyx_k_pyx_state[] =
"__pyx_state";
2356static const char __pyx_k_reduce_ex[] =
"__reduce_ex__";
2357static const char __pyx_k_IndexError[] =
"IndexError";
2358static const char __pyx_k_ValueError[] =
"ValueError";
2359static const char __pyx_k_pyx_result[] =
"__pyx_result";
2360static const char __pyx_k_pyx_vtable[] =
"__pyx_vtable__";
2361static const char __pyx_k_ImportError[] =
"ImportError";
2362static const char __pyx_k_IndexFlatL2[] =
"IndexFlatL2";
2363static const char __pyx_k_MemoryError[] =
"MemoryError";
2364static const char __pyx_k_PickleError[] =
"PickleError";
2365static const char __pyx_k_pyx_checksum[] =
"__pyx_checksum";
2366static const char __pyx_k_stringsource[] =
"stringsource";
2367static const char __pyx_k_pyx_getbuffer[] =
"__pyx_getbuffer";
2368static const char __pyx_k_reduce_cython[] =
"__reduce_cython__";
2369static const char __pyx_k_View_MemoryView[] =
"View.MemoryView";
2370static const char __pyx_k_allocate_buffer[] =
"allocate_buffer";
2371static const char __pyx_k_dtype_is_object[] =
"dtype_is_object";
2372static const char __pyx_k_pyx_PickleError[] =
"__pyx_PickleError";
2373static const char __pyx_k_setstate_cython[] =
"__setstate_cython__";
2374static const char __pyx_k_pyx_unpickle_Enum[] =
"__pyx_unpickle_Enum";
2375static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
2376static const char __pyx_k_strided_and_direct[] =
"<strided and direct>";
2377static const char __pyx_k_strided_and_indirect[] =
"<strided and indirect>";
2378static const char __pyx_k_contiguous_and_direct[] =
"<contiguous and direct>";
2379static const char __pyx_k_MemoryView_of_r_object[] =
"<MemoryView of %r object>";
2380static const char __pyx_k_MemoryView_of_r_at_0x_x[] =
"<MemoryView of %r at 0x%x>";
2381static const char __pyx_k_contiguous_and_indirect[] =
"<contiguous and indirect>";
2382static const char __pyx_k_Cannot_index_with_type_s[] =
"Cannot index with type '%s'";
2383static const char __pyx_k_Invalid_shape_in_axis_d_d[] =
"Invalid shape in axis %d: %d.";
2384static const char __pyx_k_itemsize_0_for_cython_array[] =
"itemsize <= 0 for cython.array";
2385static const char __pyx_k_unable_to_allocate_array_data[] =
"unable to allocate array data.";
2386static const char __pyx_k_strided_and_direct_or_indirect[] =
"<strided and direct or indirect>";
2387static const char __pyx_k_numpy_core_multiarray_failed_to[] =
"numpy.core.multiarray failed to import";
2388static const char __pyx_k_Buffer_view_does_not_expose_stri[] =
"Buffer view does not expose strides";
2389static const char __pyx_k_Can_only_create_a_buffer_that_is[] =
"Can only create a buffer that is contiguous in memory.";
2390static const char __pyx_k_Cannot_assign_to_read_only_memor[] =
"Cannot assign to read-only memoryview";
2391static const char __pyx_k_Cannot_create_writable_memory_vi[] =
"Cannot create writable memory view from read-only memoryview";
2392static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] =
"Empty shape tuple for cython.array";
2393static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] =
"Incompatible checksums (%s vs 0xb068931 = (name))";
2394static const char __pyx_k_Indirect_dimensions_not_supporte[] =
"Indirect dimensions not supported";
2395static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] =
"Invalid mode, expected 'c' or 'fortran', got %s";
2396static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] =
"Out of bounds on buffer access (axis %d)";
2397static const char __pyx_k_Unable_to_convert_item_to_object[] =
"Unable to convert item to object";
2398static const char __pyx_k_got_differing_extents_in_dimensi[] =
"got differing extents in dimension %d (got %d and %d)";
2399static const char __pyx_k_no_default___reduce___due_to_non[] =
"no default __reduce__ due to non-trivial __cinit__";
2400static const char __pyx_k_numpy_core_umath_failed_to_impor[] =
"numpy.core.umath failed to import";
2401static const char __pyx_k_unable_to_allocate_shape_and_str[] =
"unable to allocate shape and strides.";
2402static PyObject *__pyx_n_s_ASCII;
2403static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2404static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2405static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2406static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2407static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2408static PyObject *__pyx_n_s_Ellipsis;
2409static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2410static PyObject *__pyx_n_s_ImportError;
2411static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2412static PyObject *__pyx_n_s_IndexError;
2413static PyObject *__pyx_n_s_IndexFlatL2;
2414static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2415static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2416static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2417static PyObject *__pyx_n_s_MemoryError;
2418static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2419static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2420static PyObject *__pyx_n_b_O;
2421static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2422static PyObject *__pyx_n_s_PickleError;
2423static PyObject *__pyx_n_s_TypeError;
2424static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2425static PyObject *__pyx_n_s_ValueError;
2426static PyObject *__pyx_n_s_View_MemoryView;
2427static PyObject *__pyx_n_s_add;
2428static PyObject *__pyx_n_s_allocate_buffer;
2429static PyObject *__pyx_n_s_asarray;
2430static PyObject *__pyx_n_s_astype;
2431static PyObject *__pyx_n_s_base;
2432static PyObject *__pyx_n_s_c;
2433static PyObject *__pyx_n_u_c;
2434static PyObject *__pyx_n_s_class;
2435static PyObject *__pyx_n_s_cline_in_traceback;
2436static PyObject *__pyx_kp_s_contiguous_and_direct;
2437static PyObject *__pyx_kp_s_contiguous_and_indirect;
2438static PyObject *__pyx_n_s_dict;
2439static PyObject *__pyx_n_s_distmat;
2440static PyObject *__pyx_n_s_dtype;
2441static PyObject *__pyx_n_s_dtype_is_object;
2442static PyObject *__pyx_n_s_encode;
2443static PyObject *__pyx_n_s_enumerate;
2444static PyObject *__pyx_n_s_error;
2445static PyObject *__pyx_n_s_faiss;
2446static PyObject *__pyx_n_s_flags;
2447static PyObject *__pyx_n_s_float32;
2448static PyObject *__pyx_n_s_format;
2449static PyObject *__pyx_n_s_fortran;
2450static PyObject *__pyx_n_u_fortran;
2451static PyObject *__pyx_n_s_g_camids;
2452static PyObject *__pyx_n_s_g_feats;
2453static PyObject *__pyx_n_s_g_pids;
2454static PyObject *__pyx_n_s_getstate;
2455static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2456static PyObject *__pyx_n_s_hstack;
2457static PyObject *__pyx_n_s_id;
2458static PyObject *__pyx_n_s_import;
2459static PyObject *__pyx_n_s_int64;
2460static PyObject *__pyx_n_s_itemsize;
2461static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2462static PyObject *__pyx_n_s_k;
2463static PyObject *__pyx_n_s_main;
2464static PyObject *__pyx_n_s_memview;
2465static PyObject *__pyx_n_s_mode;
2466static PyObject *__pyx_n_s_name;
2467static PyObject *__pyx_n_s_name_2;
2468static PyObject *__pyx_n_s_ndim;
2469static PyObject *__pyx_n_s_new;
2470static PyObject *__pyx_n_s_newaxis;
2471static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2472static PyObject *__pyx_n_s_np;
2473static PyObject *__pyx_n_s_numpy;
2474static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2475static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2476static PyObject *__pyx_n_s_obj;
2477static PyObject *__pyx_n_s_ones;
2478static PyObject *__pyx_n_s_pack;
2479static PyObject *__pyx_n_s_pickle;
2480static PyObject *__pyx_n_s_pyx_PickleError;
2481static PyObject *__pyx_n_s_pyx_checksum;
2482static PyObject *__pyx_n_s_pyx_getbuffer;
2483static PyObject *__pyx_n_s_pyx_result;
2484static PyObject *__pyx_n_s_pyx_state;
2485static PyObject *__pyx_n_s_pyx_type;
2486static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2487static PyObject *__pyx_n_s_pyx_vtable;
2488static PyObject *__pyx_n_s_q_camids;
2489static PyObject *__pyx_n_s_q_feats;
2490static PyObject *__pyx_n_s_q_pids;
2491static PyObject *__pyx_n_s_range;
2492static PyObject *__pyx_n_s_reduce;
2493static PyObject *__pyx_n_s_reduce_cython;
2494static PyObject *__pyx_n_s_reduce_ex;
2495static PyObject *__pyx_n_s_search;
2496static PyObject *__pyx_n_s_setstate;
2497static PyObject *__pyx_n_s_setstate_cython;
2498static PyObject *__pyx_n_s_shape;
2499static PyObject *__pyx_n_s_size;
2500static PyObject *__pyx_n_s_start;
2501static PyObject *__pyx_n_s_step;
2502static PyObject *__pyx_n_s_stop;
2503static PyObject *__pyx_kp_s_strided_and_direct;
2504static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2505static PyObject *__pyx_kp_s_strided_and_indirect;
2506static PyObject *__pyx_kp_s_stringsource;
2507static PyObject *__pyx_n_s_struct;
2508static PyObject *__pyx_n_s_test;
2509static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2510static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2511static PyObject *__pyx_n_s_unpack;
2512static PyObject *__pyx_n_s_update;
2513static PyObject *__pyx_n_s_zeros;
2514static PyObject *__pyx_pf_6roc_cy_evaluate_roc_cy(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distmat, __Pyx_memviewslice __pyx_v_q_feats, __Pyx_memviewslice __pyx_v_g_feats, __Pyx_memviewslice __pyx_v_q_pids, __Pyx_memviewslice __pyx_v_g_pids, __Pyx_memviewslice __pyx_v_q_camids, __Pyx_memviewslice __pyx_v_g_camids);
2515static 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);
2516static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2517static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self);
2518static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self);
2519static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self);
2520static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr);
2521static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item);
2522static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
2523static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self);
2524static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2525static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name);
2526static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2527static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2528static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state);
2529static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object);
2530static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self);
2531static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2532static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2533static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2534static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2535static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2536static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2537static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2538static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2539static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2540static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2541static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2542static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2543static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self);
2544static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self);
2545static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self);
2546static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2547static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2548static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self);
2549static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self);
2550static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self);
2551static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2552static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2553static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2554static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2555static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2556static 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);
2557static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k);
2558static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k);
2559static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k);
2560static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k);
2561static PyObject *__pyx_int_0;
2562static PyObject *__pyx_int_1;
2563static PyObject *__pyx_int_184977713;
2564static PyObject *__pyx_int_neg_1;
2565static PyObject *__pyx_slice_;
2566static PyObject *__pyx_tuple__2;
2567static PyObject *__pyx_tuple__3;
2568static PyObject *__pyx_tuple__4;
2569static PyObject *__pyx_tuple__5;
2570static PyObject *__pyx_tuple__6;
2571static PyObject *__pyx_tuple__7;
2572static PyObject *__pyx_tuple__8;
2573static PyObject *__pyx_tuple__9;
2574static PyObject *__pyx_tuple__10;
2575static PyObject *__pyx_tuple__11;
2576static PyObject *__pyx_tuple__12;
2577static PyObject *__pyx_tuple__13;
2578static PyObject *__pyx_tuple__14;
2579static PyObject *__pyx_tuple__15;
2580static PyObject *__pyx_tuple__16;
2581static PyObject *__pyx_tuple__17;
2582static PyObject *__pyx_tuple__18;
2583static PyObject *__pyx_tuple__19;
2584static PyObject *__pyx_tuple__20;
2585static PyObject *__pyx_tuple__21;
2586static PyObject *__pyx_tuple__22;
2587static PyObject *__pyx_tuple__23;
2588static PyObject *__pyx_tuple__24;
2589static PyObject *__pyx_tuple__25;
2590static PyObject *__pyx_tuple__26;
2591static PyObject *__pyx_codeobj__27;
2602static PyObject *__pyx_pw_6roc_cy_1evaluate_roc_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2603static PyObject *__pyx_f_6roc_cy_evaluate_roc_cy(__Pyx_memviewslice __pyx_v_distmat, __Pyx_memviewslice __pyx_v_q_feats, __Pyx_memviewslice __pyx_v_g_feats, __Pyx_memviewslice __pyx_v_q_pids, __Pyx_memviewslice __pyx_v_g_pids, __Pyx_memviewslice __pyx_v_q_camids, __Pyx_memviewslice __pyx_v_g_camids, CYTHON_UNUSED
int __pyx_skip_dispatch) {
2607 __Pyx_memviewslice __pyx_v_indices = { 0, 0, { 0 }, { 0 }, { 0 } };
2608 PyObject *__pyx_v_index = 0;
2609 __Pyx_memviewslice __pyx_v_matches = { 0, 0, { 0 }, { 0 }, { 0 } };
2610 __Pyx_memviewslice __pyx_v_pos = { 0, 0, { 0 }, { 0 }, { 0 } };
2611 __Pyx_memviewslice __pyx_v_neg = { 0, 0, { 0 }, { 0 }, { 0 } };
2612 long __pyx_v_valid_pos;
2613 long __pyx_v_valid_neg;
2616 long __pyx_v_q_camid;
2618 __Pyx_memviewslice __pyx_v_order = { 0, 0, { 0 }, { 0 }, { 0 } };
2619 __Pyx_memviewslice __pyx_v_raw_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
2620 __Pyx_memviewslice __pyx_v_sort_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
2621 PyObject *__pyx_v_num_g_real = NULL;
2622 PyObject *__pyx_v_q_dist = NULL;
2623 PyObject *__pyx_v_valid_idx = NULL;
2624 __Pyx_memviewslice __pyx_v_scores = { 0, 0, { 0 }, { 0 }, { 0 } };
2625 __Pyx_memviewslice __pyx_v_labels = { 0, 0, { 0 }, { 0 }, { 0 } };
2626 PyObject *__pyx_r = NULL;
2627 __Pyx_RefNannyDeclarations
2628 PyObject *__pyx_t_1 = NULL;
2629 PyObject *__pyx_t_2 = NULL;
2630 PyObject *__pyx_t_3 = NULL;
2631 PyObject *__pyx_t_4 = NULL;
2632 PyObject *__pyx_t_5 = NULL;
2633 __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
2634 __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
2635 PyObject *__pyx_t_8 = NULL;
2636 __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
2637 __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
2641 Py_ssize_t __pyx_t_14;
2645 Py_ssize_t __pyx_t_18;
2646 Py_ssize_t __pyx_t_19;
2649 Py_ssize_t __pyx_t_22;
2650 PyObject *(*__pyx_t_23)(PyObject *);
2651 Py_ssize_t __pyx_t_24;
2654 PyObject *__pyx_t_27 = NULL;
2655 PyObject *__pyx_t_28 = NULL;
2656 int __pyx_lineno = 0;
2657 const char *__pyx_filename = NULL;
2658 int __pyx_clineno = 0;
2659 __Pyx_RefNannySetupContext(
"evaluate_roc_cy", 0);
2660 __PYX_INC_MEMVIEW(&__pyx_v_distmat, 1);
2661 __PYX_INC_MEMVIEW(&__pyx_v_q_feats, 1);
2662 __PYX_INC_MEMVIEW(&__pyx_v_g_feats, 1);
2663 __PYX_INC_MEMVIEW(&__pyx_v_q_pids, 1);
2664 __PYX_INC_MEMVIEW(&__pyx_v_g_pids, 1);
2665 __PYX_INC_MEMVIEW(&__pyx_v_q_camids, 1);
2666 __PYX_INC_MEMVIEW(&__pyx_v_g_camids, 1);
2675 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
2676 __Pyx_GOTREF(__pyx_t_1);
2677 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
2678 __Pyx_GOTREF(__pyx_t_2);
2679 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2680 __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_distmat, 2, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
2681 __Pyx_GOTREF(__pyx_t_1);
2682 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
2683 __Pyx_GOTREF(__pyx_t_3);
2684 __Pyx_GIVEREF(__pyx_t_1);
2685 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
2687 __pyx_t_1 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
2688 __Pyx_GOTREF(__pyx_t_1);
2689 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error)
2690 __Pyx_GOTREF(__pyx_t_4);
2691 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
2692 __Pyx_GOTREF(__pyx_t_5);
2693 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2694 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
2695 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2696 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
2697 __Pyx_GOTREF(__pyx_t_5);
2698 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2699 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2700 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2701 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_5, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 23, __pyx_L1_error)
2702 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2703 __PYX_XDEC_MEMVIEW(&__pyx_v_distmat, 1);
2704 __pyx_v_distmat = __pyx_t_6;
2705 __pyx_t_6.memview = NULL;
2706 __pyx_t_6.data = NULL;
2715 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
2716 __Pyx_GOTREF(__pyx_t_5);
2717 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
2718 __Pyx_GOTREF(__pyx_t_1);
2719 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2720 __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_q_feats, 2, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
2721 __Pyx_GOTREF(__pyx_t_5);
2722 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
2723 __Pyx_GOTREF(__pyx_t_3);
2724 __Pyx_GIVEREF(__pyx_t_5);
2725 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
2727 __pyx_t_5 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
2728 __Pyx_GOTREF(__pyx_t_5);
2729 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
2730 __Pyx_GOTREF(__pyx_t_2);
2731 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error)
2732 __Pyx_GOTREF(__pyx_t_4);
2733 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2734 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
2735 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2736 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error)
2737 __Pyx_GOTREF(__pyx_t_4);
2738 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2739 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2740 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2741 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_4, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 24, __pyx_L1_error)
2742 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2743 __PYX_XDEC_MEMVIEW(&__pyx_v_q_feats, 1);
2744 __pyx_v_q_feats = __pyx_t_6;
2745 __pyx_t_6.memview = NULL;
2746 __pyx_t_6.data = NULL;
2755 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error)
2756 __Pyx_GOTREF(__pyx_t_4);
2757 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error)
2758 __Pyx_GOTREF(__pyx_t_5);
2759 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2760 __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_g_feats, 2, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error)
2761 __Pyx_GOTREF(__pyx_t_4);
2762 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error)
2763 __Pyx_GOTREF(__pyx_t_3);
2764 __Pyx_GIVEREF(__pyx_t_4);
2765 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
2767 __pyx_t_4 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error)
2768 __Pyx_GOTREF(__pyx_t_4);
2769 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
2770 __Pyx_GOTREF(__pyx_t_1);
2771 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
2772 __Pyx_GOTREF(__pyx_t_2);
2773 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2774 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
2775 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2776 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
2777 __Pyx_GOTREF(__pyx_t_2);
2778 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2779 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2780 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2781 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_2, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 25, __pyx_L1_error)
2782 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2783 __PYX_XDEC_MEMVIEW(&__pyx_v_g_feats, 1);
2784 __pyx_v_g_feats = __pyx_t_6;
2785 __pyx_t_6.memview = NULL;
2786 __pyx_t_6.data = NULL;
2795 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
2796 __Pyx_GOTREF(__pyx_t_2);
2797 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error)
2798 __Pyx_GOTREF(__pyx_t_4);
2799 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2800 __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_q_pids, 1, (PyObject *(*)(
char *)) __pyx_memview_get_long, (
int (*)(
char *, PyObject *)) __pyx_memview_set_long, 0);;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
2801 __Pyx_GOTREF(__pyx_t_2);
2802 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
2803 __Pyx_GOTREF(__pyx_t_3);
2804 __Pyx_GIVEREF(__pyx_t_2);
2805 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
2807 __pyx_t_2 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
2808 __Pyx_GOTREF(__pyx_t_2);
2809 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error)
2810 __Pyx_GOTREF(__pyx_t_5);
2811 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
2812 __Pyx_GOTREF(__pyx_t_1);
2813 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2814 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
2815 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2816 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
2817 __Pyx_GOTREF(__pyx_t_1);
2818 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2819 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2820 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2821 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_1, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 26, __pyx_L1_error)
2822 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2823 __PYX_XDEC_MEMVIEW(&__pyx_v_q_pids, 1);
2824 __pyx_v_q_pids = __pyx_t_7;
2825 __pyx_t_7.memview = NULL;
2826 __pyx_t_7.data = NULL;
2835 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
2836 __Pyx_GOTREF(__pyx_t_1);
2837 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
2838 __Pyx_GOTREF(__pyx_t_2);
2839 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2840 __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_g_pids, 1, (PyObject *(*)(
char *)) __pyx_memview_get_long, (
int (*)(
char *, PyObject *)) __pyx_memview_set_long, 0);;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
2841 __Pyx_GOTREF(__pyx_t_1);
2842 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
2843 __Pyx_GOTREF(__pyx_t_3);
2844 __Pyx_GIVEREF(__pyx_t_1);
2845 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
2847 __pyx_t_1 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
2848 __Pyx_GOTREF(__pyx_t_1);
2849 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)
2850 __Pyx_GOTREF(__pyx_t_4);
2851 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error)
2852 __Pyx_GOTREF(__pyx_t_5);
2853 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2854 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
2855 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2856 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error)
2857 __Pyx_GOTREF(__pyx_t_5);
2858 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2859 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2860 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2861 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_5, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 27, __pyx_L1_error)
2862 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2863 __PYX_XDEC_MEMVIEW(&__pyx_v_g_pids, 1);
2864 __pyx_v_g_pids = __pyx_t_7;
2865 __pyx_t_7.memview = NULL;
2866 __pyx_t_7.data = NULL;
2875 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error)
2876 __Pyx_GOTREF(__pyx_t_5);
2877 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
2878 __Pyx_GOTREF(__pyx_t_1);
2879 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2880 __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_q_camids, 1, (PyObject *(*)(
char *)) __pyx_memview_get_long, (
int (*)(
char *, PyObject *)) __pyx_memview_set_long, 0);;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error)
2881 __Pyx_GOTREF(__pyx_t_5);
2882 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
2883 __Pyx_GOTREF(__pyx_t_3);
2884 __Pyx_GIVEREF(__pyx_t_5);
2885 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
2887 __pyx_t_5 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error)
2888 __Pyx_GOTREF(__pyx_t_5);
2889 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
2890 __Pyx_GOTREF(__pyx_t_2);
2891 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int64);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)
2892 __Pyx_GOTREF(__pyx_t_4);
2893 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2894 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
2895 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2896 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)
2897 __Pyx_GOTREF(__pyx_t_4);
2898 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2899 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2900 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2901 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_4, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 28, __pyx_L1_error)
2902 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2903 __PYX_XDEC_MEMVIEW(&__pyx_v_q_camids, 1);
2904 __pyx_v_q_camids = __pyx_t_7;
2905 __pyx_t_7.memview = NULL;
2906 __pyx_t_7.data = NULL;
2915 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
2916 __Pyx_GOTREF(__pyx_t_4);
2917 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L1_error)
2918 __Pyx_GOTREF(__pyx_t_5);
2919 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2920 __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_g_camids, 1, (PyObject *(*)(
char *)) __pyx_memview_get_long, (
int (*)(
char *, PyObject *)) __pyx_memview_set_long, 0);;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
2921 __Pyx_GOTREF(__pyx_t_4);
2922 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
2923 __Pyx_GOTREF(__pyx_t_3);
2924 __Pyx_GIVEREF(__pyx_t_4);
2925 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
2927 __pyx_t_4 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
2928 __Pyx_GOTREF(__pyx_t_4);
2929 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
2930 __Pyx_GOTREF(__pyx_t_1);
2931 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
2932 __Pyx_GOTREF(__pyx_t_2);
2933 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2934 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
2935 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2936 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
2937 __Pyx_GOTREF(__pyx_t_2);
2938 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2939 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2940 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2941 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_2, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 29, __pyx_L1_error)
2942 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2943 __PYX_XDEC_MEMVIEW(&__pyx_v_g_camids, 1);
2944 __pyx_v_g_camids = __pyx_t_7;
2945 __pyx_t_7.memview = NULL;
2946 __pyx_t_7.data = NULL;
2955 __pyx_v_num_q = (__pyx_v_distmat.shape[0]);
2964 __pyx_v_num_g = (__pyx_v_distmat.shape[1]);
2973 __pyx_v_dim = (__pyx_v_q_feats.shape[1]);
2982 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_faiss);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error)
2983 __Pyx_GOTREF(__pyx_t_4);
2984 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_IndexFlatL2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error)
2985 __Pyx_GOTREF(__pyx_t_3);
2986 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2987 __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_dim);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error)
2988 __Pyx_GOTREF(__pyx_t_4);
2990 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2991 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
2992 if (likely(__pyx_t_5)) {
2993 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2994 __Pyx_INCREF(__pyx_t_5);
2995 __Pyx_INCREF(function);
2996 __Pyx_DECREF_SET(__pyx_t_3, function);
2999 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
3000 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3001 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3002 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
3003 __Pyx_GOTREF(__pyx_t_2);
3004 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3005 __pyx_v_index = __pyx_t_2;
3015 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_add);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
3016 __Pyx_GOTREF(__pyx_t_3);
3017 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L1_error)
3018 __Pyx_GOTREF(__pyx_t_5);
3019 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
3020 __Pyx_GOTREF(__pyx_t_1);
3021 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3022 __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_g_feats, 2, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L1_error)
3023 __Pyx_GOTREF(__pyx_t_5);
3025 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3026 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
3027 if (likely(__pyx_t_8)) {
3028 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3029 __Pyx_INCREF(__pyx_t_8);
3030 __Pyx_INCREF(function);
3031 __Pyx_DECREF_SET(__pyx_t_1, function);
3034 __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
3035 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3036 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3037 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error)
3038 __Pyx_GOTREF(__pyx_t_4);
3039 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3041 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3042 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
3043 if (likely(__pyx_t_1)) {
3044 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3045 __Pyx_INCREF(__pyx_t_1);
3046 __Pyx_INCREF(function);
3047 __Pyx_DECREF_SET(__pyx_t_3, function);
3050 __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
3051 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3052 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3053 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
3054 __Pyx_GOTREF(__pyx_t_2);
3055 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3056 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3065 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_search);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
3066 __Pyx_GOTREF(__pyx_t_2);
3067 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error)
3068 __Pyx_GOTREF(__pyx_t_4);
3069 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
3070 __Pyx_GOTREF(__pyx_t_1);
3071 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3072 __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_q_feats, 2, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error)
3073 __Pyx_GOTREF(__pyx_t_4);
3075 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3076 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
3077 if (likely(__pyx_t_5)) {
3078 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3079 __Pyx_INCREF(__pyx_t_5);
3080 __Pyx_INCREF(function);
3081 __Pyx_DECREF_SET(__pyx_t_1, function);
3084 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
3085 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3086 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3087 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
3088 __Pyx_GOTREF(__pyx_t_3);
3089 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3090 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
3091 __Pyx_GOTREF(__pyx_t_1);
3092 __Pyx_GIVEREF(__pyx_t_3);
3093 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
3095 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
3096 __Pyx_GOTREF(__pyx_t_3);
3097 __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_num_g);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error)
3098 __Pyx_GOTREF(__pyx_t_4);
3099 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_k, __pyx_t_4) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
3100 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3101 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error)
3102 __Pyx_GOTREF(__pyx_t_4);
3103 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3104 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3105 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3106 __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
3107 __Pyx_GOTREF(__pyx_t_3);
3108 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3109 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_long(__pyx_t_3, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 39, __pyx_L1_error)
3110 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3111 __pyx_v_indices = __pyx_t_9;
3112 __pyx_t_9.memview = NULL;
3113 __pyx_t_9.data = NULL;
3122 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3123 __Pyx_GOTREF(__pyx_t_1);
3124 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
3125 __Pyx_GOTREF(__pyx_t_2);
3126 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3127 __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_g_pids, 1, (PyObject *(*)(
char *)) __pyx_memview_get_long, (
int (*)(
char *, PyObject *)) __pyx_memview_set_long, 0);;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3128 __Pyx_GOTREF(__pyx_t_1);
3130 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3131 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
3132 if (likely(__pyx_t_5)) {
3133 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3134 __Pyx_INCREF(__pyx_t_5);
3135 __Pyx_INCREF(function);
3136 __Pyx_DECREF_SET(__pyx_t_2, function);
3139 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
3140 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3141 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3142 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
3143 __Pyx_GOTREF(__pyx_t_4);
3144 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3145 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3146 __Pyx_GOTREF(__pyx_t_1);
3147 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
3148 __Pyx_GOTREF(__pyx_t_5);
3149 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3150 __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_indices, 2, (PyObject *(*)(
char *)) __pyx_memview_get_long, (
int (*)(
char *, PyObject *)) __pyx_memview_set_long, 0);;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3151 __Pyx_GOTREF(__pyx_t_1);
3153 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3154 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
3155 if (likely(__pyx_t_8)) {
3156 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3157 __Pyx_INCREF(__pyx_t_8);
3158 __Pyx_INCREF(function);
3159 __Pyx_DECREF_SET(__pyx_t_5, function);
3162 __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
3163 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3164 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3165 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
3166 __Pyx_GOTREF(__pyx_t_2);
3167 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3168 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_2);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
3169 __Pyx_GOTREF(__pyx_t_5);
3170 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3171 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3172 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
3173 __Pyx_GOTREF(__pyx_t_4);
3174 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3175 __Pyx_GOTREF(__pyx_t_1);
3176 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3177 __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_q_pids, 1, (PyObject *(*)(
char *)) __pyx_memview_get_long, (
int (*)(
char *, PyObject *)) __pyx_memview_set_long, 0);;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
3178 __Pyx_GOTREF(__pyx_t_4);
3180 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3181 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
3182 if (likely(__pyx_t_8)) {
3183 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3184 __Pyx_INCREF(__pyx_t_8);
3185 __Pyx_INCREF(function);
3186 __Pyx_DECREF_SET(__pyx_t_1, function);
3189 __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
3190 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3191 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3192 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
3193 __Pyx_GOTREF(__pyx_t_2);
3194 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3195 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3196 __Pyx_GOTREF(__pyx_t_1);
3197 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_newaxis);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
3198 __Pyx_GOTREF(__pyx_t_4);
3199 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3200 __pyx_t_1 = PyTuple_New(2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3201 __Pyx_GOTREF(__pyx_t_1);
3202 __Pyx_INCREF(__pyx_slice_);
3203 __Pyx_GIVEREF(__pyx_slice_);
3204 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice_);
3205 __Pyx_GIVEREF(__pyx_t_4);
3206 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
3208 __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
3209 __Pyx_GOTREF(__pyx_t_4);
3210 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3211 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3212 __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3213 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3214 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3215 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
3216 __Pyx_GOTREF(__pyx_t_4);
3217 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3218 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3219 __Pyx_GOTREF(__pyx_t_1);
3220 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
3221 __Pyx_GOTREF(__pyx_t_5);
3222 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3224 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
3225 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
3226 if (likely(__pyx_t_1)) {
3227 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
3228 __Pyx_INCREF(__pyx_t_1);
3229 __Pyx_INCREF(function);
3230 __Pyx_DECREF_SET(__pyx_t_4, function);
3233 __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
3234 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3235 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3236 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
3237 __Pyx_GOTREF(__pyx_t_3);
3238 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3239 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_long(__pyx_t_3, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 42, __pyx_L1_error)
3240 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3241 __pyx_v_matches = __pyx_t_9;
3242 __pyx_t_9.memview = NULL;
3243 __pyx_t_9.data = NULL;
3252 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
3253 __Pyx_GOTREF(__pyx_t_3);
3254 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
3255 __Pyx_GOTREF(__pyx_t_4);
3256 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3257 __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_num_q * __pyx_v_num_g));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
3258 __Pyx_GOTREF(__pyx_t_3);
3259 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error)
3260 __Pyx_GOTREF(__pyx_t_5);
3261 __Pyx_GIVEREF(__pyx_t_3);
3262 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
3264 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
3265 __Pyx_GOTREF(__pyx_t_3);
3266 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
3267 __Pyx_GOTREF(__pyx_t_1);
3268 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
3269 __Pyx_GOTREF(__pyx_t_2);
3270 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3271 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
3272 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3273 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
3274 __Pyx_GOTREF(__pyx_t_2);
3275 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3276 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3277 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3278 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
3279 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3280 __pyx_v_pos = __pyx_t_10;
3281 __pyx_t_10.memview = NULL;
3282 __pyx_t_10.data = NULL;
3291 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
3292 __Pyx_GOTREF(__pyx_t_2);
3293 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
3294 __Pyx_GOTREF(__pyx_t_3);
3295 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3296 __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_num_q * __pyx_v_num_g));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
3297 __Pyx_GOTREF(__pyx_t_2);
3298 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
3299 __Pyx_GOTREF(__pyx_t_5);
3300 __Pyx_GIVEREF(__pyx_t_2);
3301 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
3303 __pyx_t_2 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
3304 __Pyx_GOTREF(__pyx_t_2);
3305 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error)
3306 __Pyx_GOTREF(__pyx_t_4);
3307 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
3308 __Pyx_GOTREF(__pyx_t_1);
3309 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3310 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
3311 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3312 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
3313 __Pyx_GOTREF(__pyx_t_1);
3314 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3315 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3316 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3317 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 45, __pyx_L1_error)
3318 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3319 __pyx_v_neg = __pyx_t_10;
3320 __pyx_t_10.memview = NULL;
3321 __pyx_t_10.data = NULL;
3330 __pyx_v_valid_pos = 0;
3339 __pyx_v_valid_neg = 0;
3348 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
3349 __Pyx_GOTREF(__pyx_t_1);
3350 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
3351 __Pyx_GOTREF(__pyx_t_2);
3352 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3353 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_num_g);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
3354 __Pyx_GOTREF(__pyx_t_1);
3355 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 52, __pyx_L1_error)
3356 __Pyx_GOTREF(__pyx_t_5);
3357 __Pyx_GIVEREF(__pyx_t_1);
3358 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
3360 __pyx_t_1 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
3361 __Pyx_GOTREF(__pyx_t_1);
3362 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
3363 __Pyx_GOTREF(__pyx_t_3);
3364 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error)
3365 __Pyx_GOTREF(__pyx_t_4);
3366 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3367 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 52, __pyx_L1_error)
3368 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3369 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error)
3370 __Pyx_GOTREF(__pyx_t_4);
3371 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3372 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3373 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3374 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_4, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 52, __pyx_L1_error)
3375 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3376 __pyx_v_order = __pyx_t_7;
3377 __pyx_t_7.memview = NULL;
3378 __pyx_t_7.data = NULL;
3387 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
3388 __Pyx_GOTREF(__pyx_t_4);
3389 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
3390 __Pyx_GOTREF(__pyx_t_1);
3391 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3392 __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_num_g);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
3393 __Pyx_GOTREF(__pyx_t_4);
3394 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
3395 __Pyx_GOTREF(__pyx_t_5);
3396 __Pyx_GIVEREF(__pyx_t_4);
3397 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
3399 __pyx_t_4 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
3400 __Pyx_GOTREF(__pyx_t_4);
3401 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
3402 __Pyx_GOTREF(__pyx_t_2);
3403 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
3404 __Pyx_GOTREF(__pyx_t_3);
3405 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3406 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
3407 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3408 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
3409 __Pyx_GOTREF(__pyx_t_3);
3410 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3411 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3412 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3413 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 54, __pyx_L1_error)
3414 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3415 __pyx_v_raw_cmc = __pyx_t_10;
3416 __pyx_t_10.memview = NULL;
3417 __pyx_t_10.data = NULL;
3426 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
3427 __Pyx_GOTREF(__pyx_t_3);
3428 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error)
3429 __Pyx_GOTREF(__pyx_t_4);
3430 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3431 __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_num_g);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
3432 __Pyx_GOTREF(__pyx_t_3);
3433 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error)
3434 __Pyx_GOTREF(__pyx_t_5);
3435 __Pyx_GIVEREF(__pyx_t_3);
3436 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
3438 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
3439 __Pyx_GOTREF(__pyx_t_3);
3440 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
3441 __Pyx_GOTREF(__pyx_t_1);
3442 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
3443 __Pyx_GOTREF(__pyx_t_2);
3444 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3445 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
3446 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3447 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error)
3448 __Pyx_GOTREF(__pyx_t_2);
3449 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3450 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3451 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3452 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_2, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 55, __pyx_L1_error)
3453 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3454 __pyx_v_sort_idx = __pyx_t_7;
3455 __pyx_t_7.memview = NULL;
3456 __pyx_t_7.data = NULL;
3465 __pyx_t_11 = __pyx_v_num_q;
3466 __pyx_t_12 = __pyx_t_11;
3467 for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
3468 __pyx_v_q_idx = __pyx_t_13;
3477 __pyx_t_14 = __pyx_v_q_idx;
3478 __pyx_v_q_pid = (*((
long *) ( (__pyx_v_q_pids.data + __pyx_t_14 * __pyx_v_q_pids.strides[0]) )));
3487 __pyx_t_14 = __pyx_v_q_idx;
3488 __pyx_v_q_camid = (*((
long *) ( (__pyx_v_q_camids.data + __pyx_t_14 * __pyx_v_q_camids.strides[0]) )));
3497 __pyx_t_15 = __pyx_v_num_g;
3498 __pyx_t_16 = __pyx_t_15;
3499 for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
3500 __pyx_v_g_idx = __pyx_t_17;
3509 __pyx_t_14 = __pyx_v_q_idx;
3510 __pyx_t_18 = __pyx_v_g_idx;
3511 __pyx_t_19 = __pyx_v_g_idx;
3512 *((
long *) ( (__pyx_v_order.data + __pyx_t_19 * __pyx_v_order.strides[0]) )) = (*((
long *) ( (( (__pyx_v_indices.data + __pyx_t_14 * __pyx_v_indices.strides[0]) ) + __pyx_t_18 * __pyx_v_indices.strides[1]) )));
3522 __Pyx_INCREF(__pyx_int_0);
3523 __Pyx_XDECREF_SET(__pyx_v_num_g_real, __pyx_int_0);
3532 __pyx_t_15 = __pyx_v_num_g;
3533 __pyx_t_16 = __pyx_t_15;
3534 for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
3535 __pyx_v_g_idx = __pyx_t_17;
3544 __pyx_t_18 = __pyx_v_g_idx;
3545 __pyx_t_14 = (*((
long *) ( (__pyx_v_order.data + __pyx_t_18 * __pyx_v_order.strides[0]) )));
3546 __pyx_t_21 = (((*((
long *) ( (__pyx_v_g_pids.data + __pyx_t_14 * __pyx_v_g_pids.strides[0]) ))) != __pyx_v_q_pid) != 0);
3549 __pyx_t_20 = __pyx_t_21;
3550 goto __pyx_L10_bool_binop_done;
3552 __pyx_t_18 = __pyx_v_g_idx;
3553 __pyx_t_14 = (*((
long *) ( (__pyx_v_order.data + __pyx_t_18 * __pyx_v_order.strides[0]) )));
3554 __pyx_t_21 = (((*((
long *) ( (__pyx_v_g_camids.data + __pyx_t_14 * __pyx_v_g_camids.strides[0]) ))) != __pyx_v_q_camid) != 0);
3555 __pyx_t_20 = __pyx_t_21;
3556 __pyx_L10_bool_binop_done:;
3566 __pyx_t_18 = __pyx_v_q_idx;
3567 __pyx_t_14 = __pyx_v_g_idx;
3568 __pyx_t_22 = __Pyx_PyIndex_AsSsize_t(__pyx_v_num_g_real);
if (unlikely((__pyx_t_22 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L1_error)
3569 __pyx_t_19 = __pyx_t_22;
3570 *((
float *) ( (__pyx_v_raw_cmc.data + __pyx_t_19 * __pyx_v_raw_cmc.strides[0]) )) = (*((
long *) ( (( (__pyx_v_matches.data + __pyx_t_18 * __pyx_v_matches.strides[0]) ) + __pyx_t_14 * __pyx_v_matches.strides[1]) )));
3579 __pyx_t_14 = __pyx_v_g_idx;
3580 __pyx_t_22 = __Pyx_PyIndex_AsSsize_t(__pyx_v_num_g_real);
if (unlikely((__pyx_t_22 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
3581 __pyx_t_18 = __pyx_t_22;
3582 *((
long *) ( (__pyx_v_sort_idx.data + __pyx_t_18 * __pyx_v_sort_idx.strides[0]) )) = (*((
long *) ( (__pyx_v_order.data + __pyx_t_14 * __pyx_v_order.strides[0]) )));
3591 __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_num_g_real, __pyx_int_1, 1, 1, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
3592 __Pyx_GOTREF(__pyx_t_2);
3593 __Pyx_DECREF_SET(__pyx_v_num_g_real, __pyx_t_2);
3613 __pyx_t_10.data = __pyx_v_distmat.data;
3614 __pyx_t_10.memview = __pyx_v_distmat.memview;
3615 __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
3617 Py_ssize_t __pyx_tmp_idx = __pyx_v_q_idx;
3618 Py_ssize_t __pyx_tmp_stride = __pyx_v_distmat.strides[0];
3619 __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
3622__pyx_t_10.shape[0] = __pyx_v_distmat.shape[1];
3623__pyx_t_10.strides[0] = __pyx_v_distmat.strides[1];
3624 __pyx_t_10.suboffsets[0] = -1;
3626__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
3627 __Pyx_GOTREF(__pyx_t_2);
3628 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
3629 __pyx_t_10.memview = NULL;
3630 __pyx_t_10.data = NULL;
3631 __Pyx_XDECREF_SET(__pyx_v_q_dist, __pyx_t_2);
3641 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_g_real);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
3642 __Pyx_GOTREF(__pyx_t_2);
3643 if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
3644 __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_22 = 0;
3647 __pyx_t_22 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error)
3648 __Pyx_GOTREF(__pyx_t_3);
3649 __pyx_t_23 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 77, __pyx_L1_error)
3651 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3653 if (likely(!__pyx_t_23)) {
3654 if (likely(PyList_CheckExact(__pyx_t_3))) {
3655 if (__pyx_t_22 >= PyList_GET_SIZE(__pyx_t_3))
break;
3656 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3657 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_22); __Pyx_INCREF(__pyx_t_2); __pyx_t_22++;
if (unlikely(0 < 0)) __PYX_ERR(0, 77, __pyx_L1_error)
3659 __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_22); __pyx_t_22++;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
3660 __Pyx_GOTREF(__pyx_t_2);
3663 if (__pyx_t_22 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
3664 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3665 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_22); __Pyx_INCREF(__pyx_t_2); __pyx_t_22++;
if (unlikely(0 < 0)) __PYX_ERR(0, 77, __pyx_L1_error)
3667 __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_22); __pyx_t_22++;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
3668 __Pyx_GOTREF(__pyx_t_2);
3672 __pyx_t_2 = __pyx_t_23(__pyx_t_3);
3673 if (unlikely(!__pyx_t_2)) {
3674 PyObject* exc_type = PyErr_Occurred();
3676 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3677 else __PYX_ERR(0, 77, __pyx_L1_error)
3681 __Pyx_GOTREF(__pyx_t_2);
3683 __Pyx_XDECREF_SET(__pyx_v_valid_idx, __pyx_t_2);
3693 __pyx_t_24 = __Pyx_PyIndex_AsSsize_t(__pyx_v_valid_idx);
if (unlikely((__pyx_t_24 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
3694 __pyx_t_14 = __pyx_t_24;
3695 __pyx_t_20 = (((*((
float *) ( (__pyx_v_raw_cmc.data + __pyx_t_14 * __pyx_v_raw_cmc.strides[0]) ))) == 1.0) != 0);
3705 __pyx_t_24 = __Pyx_PyIndex_AsSsize_t(__pyx_v_valid_idx);
if (unlikely((__pyx_t_24 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
3706 __pyx_t_14 = __pyx_t_24;
3707 __pyx_t_15 = (*((
long *) ( (__pyx_v_sort_idx.data + __pyx_t_14 * __pyx_v_sort_idx.strides[0]) )));
3708 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_q_dist, __pyx_t_15,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
3709 __Pyx_GOTREF(__pyx_t_2);
3710 __pyx_t_25 = __pyx_PyFloat_AsFloat(__pyx_t_2);
if (unlikely((__pyx_t_25 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
3711 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3712 __pyx_t_14 = __pyx_v_valid_pos;
3713 *((
float *) ( (__pyx_v_pos.data + __pyx_t_14 * __pyx_v_pos.strides[0]) )) = __pyx_t_25;
3722 __pyx_v_valid_pos = (__pyx_v_valid_pos + 1);
3741 __pyx_t_24 = __Pyx_PyIndex_AsSsize_t(__pyx_v_valid_idx);
if (unlikely((__pyx_t_24 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error)
3742 __pyx_t_14 = __pyx_t_24;
3743 __pyx_t_20 = (((*((
float *) ( (__pyx_v_raw_cmc.data + __pyx_t_14 * __pyx_v_raw_cmc.strides[0]) ))) == 0.0) != 0);
3753 __pyx_t_24 = __Pyx_PyIndex_AsSsize_t(__pyx_v_valid_idx);
if (unlikely((__pyx_t_24 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
3754 __pyx_t_14 = __pyx_t_24;
3755 __pyx_t_15 = (*((
long *) ( (__pyx_v_sort_idx.data + __pyx_t_14 * __pyx_v_sort_idx.strides[0]) )));
3756 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_q_dist, __pyx_t_15,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
3757 __Pyx_GOTREF(__pyx_t_2);
3758 __pyx_t_25 = __pyx_PyFloat_AsFloat(__pyx_t_2);
if (unlikely((__pyx_t_25 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
3759 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3760 __pyx_t_14 = __pyx_v_valid_neg;
3761 *((
float *) ( (__pyx_v_neg.data + __pyx_t_14 * __pyx_v_neg.strides[0]) )) = __pyx_t_25;
3770 __pyx_v_valid_neg = (__pyx_v_valid_neg + 1);
3790 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3800 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
3801 __Pyx_GOTREF(__pyx_t_2);
3802 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_hstack);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error)
3803 __Pyx_GOTREF(__pyx_t_5);
3804 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3805 __pyx_t_10.data = __pyx_v_pos.data;
3806 __pyx_t_10.memview = __pyx_v_pos.memview;
3807 __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
3809 if (unlikely(__pyx_memoryview_slice_memviewslice(
3811 __pyx_v_pos.shape[0], __pyx_v_pos.strides[0], __pyx_v_pos.suboffsets[0],
3823 __PYX_ERR(0, 85, __pyx_L1_error)
3826__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
3827 __Pyx_GOTREF(__pyx_t_2);
3828 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
3829 __pyx_t_10.memview = NULL;
3830 __pyx_t_10.data = NULL;
3831 __pyx_t_10.data = __pyx_v_neg.data;
3832 __pyx_t_10.memview = __pyx_v_neg.memview;
3833 __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
3835 if (unlikely(__pyx_memoryview_slice_memviewslice(
3837 __pyx_v_neg.shape[0], __pyx_v_neg.strides[0], __pyx_v_neg.suboffsets[0],
3849 __PYX_ERR(0, 85, __pyx_L1_error)
3852__pyx_t_4 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error)
3853 __Pyx_GOTREF(__pyx_t_4);
3854 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
3855 __pyx_t_10.memview = NULL;
3856 __pyx_t_10.data = NULL;
3857 __pyx_t_1 = PyTuple_New(2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
3858 __Pyx_GOTREF(__pyx_t_1);
3859 __Pyx_GIVEREF(__pyx_t_2);
3860 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
3861 __Pyx_GIVEREF(__pyx_t_4);
3862 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
3866 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3867 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
3868 if (likely(__pyx_t_4)) {
3869 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3870 __Pyx_INCREF(__pyx_t_4);
3871 __Pyx_INCREF(function);
3872 __Pyx_DECREF_SET(__pyx_t_5, function);
3875 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
3876 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3877 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3878 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error)
3879 __Pyx_GOTREF(__pyx_t_3);
3880 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3881 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 85, __pyx_L1_error)
3882 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3883 __pyx_v_scores = __pyx_t_10;
3884 __pyx_t_10.memview = NULL;
3885 __pyx_t_10.data = NULL;
3894 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
3895 __Pyx_GOTREF(__pyx_t_5);
3896 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_hstack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
3897 __Pyx_GOTREF(__pyx_t_1);
3898 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3899 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
3900 __Pyx_GOTREF(__pyx_t_5);
3901 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error)
3902 __Pyx_GOTREF(__pyx_t_4);
3903 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3904 __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_valid_pos);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
3905 __Pyx_GOTREF(__pyx_t_5);
3906 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
3907 __Pyx_GOTREF(__pyx_t_2);
3908 __Pyx_GIVEREF(__pyx_t_5);
3909 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
3911 __pyx_t_5 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
3912 __Pyx_GOTREF(__pyx_t_5);
3913 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error)
3914 __Pyx_GOTREF(__pyx_t_8);
3915 __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float32);
if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 86, __pyx_L1_error)
3916 __Pyx_GOTREF(__pyx_t_27);
3917 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3918 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_27) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
3919 __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
3920 __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_5);
if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 86, __pyx_L1_error)
3921 __Pyx_GOTREF(__pyx_t_27);
3922 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3923 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3924 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3933 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
3934 __Pyx_GOTREF(__pyx_t_5);
3935 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ones);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
3936 __Pyx_GOTREF(__pyx_t_2);
3937 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3938 __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_valid_neg);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
3939 __Pyx_GOTREF(__pyx_t_5);
3940 __pyx_t_4 = PyTuple_New(1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error)
3941 __Pyx_GOTREF(__pyx_t_4);
3942 __Pyx_GIVEREF(__pyx_t_5);
3943 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
3945 __pyx_t_5 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
3946 __Pyx_GOTREF(__pyx_t_5);
3947 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L1_error)
3948 __Pyx_GOTREF(__pyx_t_8);
3949 __pyx_t_28 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float32);
if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 87, __pyx_L1_error)
3950 __Pyx_GOTREF(__pyx_t_28);
3951 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3952 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_28) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
3953 __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
3954 __pyx_t_28 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_5);
if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 87, __pyx_L1_error)
3955 __Pyx_GOTREF(__pyx_t_28);
3956 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3957 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3958 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3967 __pyx_t_5 = PyTuple_New(2);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
3968 __Pyx_GOTREF(__pyx_t_5);
3969 __Pyx_GIVEREF(__pyx_t_27);
3970 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_27);
3971 __Pyx_GIVEREF(__pyx_t_28);
3972 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_28);
3976 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3977 __pyx_t_28 = PyMethod_GET_SELF(__pyx_t_1);
3978 if (likely(__pyx_t_28)) {
3979 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3980 __Pyx_INCREF(__pyx_t_28);
3981 __Pyx_INCREF(function);
3982 __Pyx_DECREF_SET(__pyx_t_1, function);
3985 __pyx_t_3 = (__pyx_t_28) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_28, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
3986 __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
3987 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3988 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
3989 __Pyx_GOTREF(__pyx_t_3);
3990 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3991 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 86, __pyx_L1_error)
3992 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3993 __pyx_v_labels = __pyx_t_10;
3994 __pyx_t_10.memview = NULL;
3995 __pyx_t_10.data = NULL;
4004 __Pyx_XDECREF(__pyx_r);
4005 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
4006 __Pyx_GOTREF(__pyx_t_1);
4007 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error)
4008 __Pyx_GOTREF(__pyx_t_5);
4009 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4010 __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_scores, 1, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
4011 __Pyx_GOTREF(__pyx_t_1);
4013 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4014 __pyx_t_28 = PyMethod_GET_SELF(__pyx_t_5);
4015 if (likely(__pyx_t_28)) {
4016 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4017 __Pyx_INCREF(__pyx_t_28);
4018 __Pyx_INCREF(function);
4019 __Pyx_DECREF_SET(__pyx_t_5, function);
4022 __pyx_t_3 = (__pyx_t_28) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_28, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
4023 __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0;
4024 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4025 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
4026 __Pyx_GOTREF(__pyx_t_3);
4027 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4028 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
4029 __Pyx_GOTREF(__pyx_t_1);
4030 __pyx_t_28 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray);
if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 88, __pyx_L1_error)
4031 __Pyx_GOTREF(__pyx_t_28);
4032 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4033 __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_labels, 1, (PyObject *(*)(
char *)) __pyx_memview_get_float, (
int (*)(
char *, PyObject *)) __pyx_memview_set_float, 0);;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
4034 __Pyx_GOTREF(__pyx_t_1);
4036 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_28))) {
4037 __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_28);
4038 if (likely(__pyx_t_27)) {
4039 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_28);
4040 __Pyx_INCREF(__pyx_t_27);
4041 __Pyx_INCREF(function);
4042 __Pyx_DECREF_SET(__pyx_t_28, function);
4045 __pyx_t_5 = (__pyx_t_27) ? __Pyx_PyObject_Call2Args(__pyx_t_28, __pyx_t_27, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_28, __pyx_t_1);
4046 __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
4047 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4048 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error)
4049 __Pyx_GOTREF(__pyx_t_5);
4050 __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
4051 __pyx_t_28 = PyTuple_New(2);
if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 88, __pyx_L1_error)
4052 __Pyx_GOTREF(__pyx_t_28);
4053 __Pyx_GIVEREF(__pyx_t_3);
4054 PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_3);
4055 __Pyx_GIVEREF(__pyx_t_5);
4056 PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_5);
4059 __pyx_r = __pyx_t_28;
4073 __Pyx_XDECREF(__pyx_t_1);
4074 __Pyx_XDECREF(__pyx_t_2);
4075 __Pyx_XDECREF(__pyx_t_3);
4076 __Pyx_XDECREF(__pyx_t_4);
4077 __Pyx_XDECREF(__pyx_t_5);
4078 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4079 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
4080 __Pyx_XDECREF(__pyx_t_8);
4081 __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
4082 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
4083 __Pyx_XDECREF(__pyx_t_27);
4084 __Pyx_XDECREF(__pyx_t_28);
4085 __Pyx_AddTraceback(
"roc_cy.evaluate_roc_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
4088 __PYX_XDEC_MEMVIEW(&__pyx_v_indices, 1);
4089 __Pyx_XDECREF(__pyx_v_index);
4090 __PYX_XDEC_MEMVIEW(&__pyx_v_matches, 1);
4091 __PYX_XDEC_MEMVIEW(&__pyx_v_pos, 1);
4092 __PYX_XDEC_MEMVIEW(&__pyx_v_neg, 1);
4093 __PYX_XDEC_MEMVIEW(&__pyx_v_order, 1);
4094 __PYX_XDEC_MEMVIEW(&__pyx_v_raw_cmc, 1);
4095 __PYX_XDEC_MEMVIEW(&__pyx_v_sort_idx, 1);
4096 __Pyx_XDECREF(__pyx_v_num_g_real);
4097 __Pyx_XDECREF(__pyx_v_q_dist);
4098 __Pyx_XDECREF(__pyx_v_valid_idx);
4099 __PYX_XDEC_MEMVIEW(&__pyx_v_scores, 1);
4100 __PYX_XDEC_MEMVIEW(&__pyx_v_labels, 1);
4101 __PYX_XDEC_MEMVIEW(&__pyx_v_distmat, 1);
4102 __PYX_XDEC_MEMVIEW(&__pyx_v_q_feats, 1);
4103 __PYX_XDEC_MEMVIEW(&__pyx_v_g_feats, 1);
4104 __PYX_XDEC_MEMVIEW(&__pyx_v_q_pids, 1);
4105 __PYX_XDEC_MEMVIEW(&__pyx_v_g_pids, 1);
4106 __PYX_XDEC_MEMVIEW(&__pyx_v_q_camids, 1);
4107 __PYX_XDEC_MEMVIEW(&__pyx_v_g_camids, 1);
4108 __Pyx_XGIVEREF(__pyx_r);
4109 __Pyx_RefNannyFinishContext();
4114static PyObject *__pyx_pw_6roc_cy_1evaluate_roc_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4115static PyObject *__pyx_pw_6roc_cy_1evaluate_roc_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4116 __Pyx_memviewslice __pyx_v_distmat = { 0, 0, { 0 }, { 0 }, { 0 } };
4117 __Pyx_memviewslice __pyx_v_q_feats = { 0, 0, { 0 }, { 0 }, { 0 } };
4118 __Pyx_memviewslice __pyx_v_g_feats = { 0, 0, { 0 }, { 0 }, { 0 } };
4119 __Pyx_memviewslice __pyx_v_q_pids = { 0, 0, { 0 }, { 0 }, { 0 } };
4120 __Pyx_memviewslice __pyx_v_g_pids = { 0, 0, { 0 }, { 0 }, { 0 } };
4121 __Pyx_memviewslice __pyx_v_q_camids = { 0, 0, { 0 }, { 0 }, { 0 } };
4122 __Pyx_memviewslice __pyx_v_g_camids = { 0, 0, { 0 }, { 0 }, { 0 } };
4123 int __pyx_lineno = 0;
4124 const char *__pyx_filename = NULL;
4125 int __pyx_clineno = 0;
4126 PyObject *__pyx_r = 0;
4127 __Pyx_RefNannyDeclarations
4128 __Pyx_RefNannySetupContext(
"evaluate_roc_cy (wrapper)", 0);
4130 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distmat,&__pyx_n_s_q_feats,&__pyx_n_s_g_feats,&__pyx_n_s_q_pids,&__pyx_n_s_g_pids,&__pyx_n_s_q_camids,&__pyx_n_s_g_camids,0};
4131 PyObject* values[7] = {0,0,0,0,0,0,0};
4132 if (unlikely(__pyx_kwds)) {
4134 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4136 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4138 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4140 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4142 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4144 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4146 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4148 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4151 default:
goto __pyx_L5_argtuple_error;
4153 kw_args = PyDict_Size(__pyx_kwds);
4156 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distmat)) != 0)) kw_args--;
4157 else goto __pyx_L5_argtuple_error;
4160 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_feats)) != 0)) kw_args--;
4162 __Pyx_RaiseArgtupleInvalid(
"evaluate_roc_cy", 1, 7, 7, 1); __PYX_ERR(0, 20, __pyx_L3_error)
4166 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_feats)) != 0)) kw_args--;
4168 __Pyx_RaiseArgtupleInvalid(
"evaluate_roc_cy", 1, 7, 7, 2); __PYX_ERR(0, 20, __pyx_L3_error)
4172 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_pids)) != 0)) kw_args--;
4174 __Pyx_RaiseArgtupleInvalid(
"evaluate_roc_cy", 1, 7, 7, 3); __PYX_ERR(0, 20, __pyx_L3_error)
4178 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_pids)) != 0)) kw_args--;
4180 __Pyx_RaiseArgtupleInvalid(
"evaluate_roc_cy", 1, 7, 7, 4); __PYX_ERR(0, 20, __pyx_L3_error)
4184 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_camids)) != 0)) kw_args--;
4186 __Pyx_RaiseArgtupleInvalid(
"evaluate_roc_cy", 1, 7, 7, 5); __PYX_ERR(0, 20, __pyx_L3_error)
4190 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_camids)) != 0)) kw_args--;
4192 __Pyx_RaiseArgtupleInvalid(
"evaluate_roc_cy", 1, 7, 7, 6); __PYX_ERR(0, 20, __pyx_L3_error)
4195 if (unlikely(kw_args > 0)) {
4196 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"evaluate_roc_cy") < 0)) __PYX_ERR(0, 20, __pyx_L3_error)
4198 }
else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
4199 goto __pyx_L5_argtuple_error;
4201 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4202 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4203 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4204 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4205 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4206 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4207 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4209 __pyx_v_distmat = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_distmat.memview)) __PYX_ERR(0, 20, __pyx_L3_error)
4210 __pyx_v_q_feats = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_q_feats.memview)) __PYX_ERR(0, 20, __pyx_L3_error)
4211 __pyx_v_g_feats = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_g_feats.memview)) __PYX_ERR(0, 20, __pyx_L3_error)
4212 __pyx_v_q_pids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[3], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_q_pids.memview)) __PYX_ERR(0, 20, __pyx_L3_error)
4213 __pyx_v_g_pids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[4], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_g_pids.memview)) __PYX_ERR(0, 20, __pyx_L3_error)
4214 __pyx_v_q_camids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[5], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_q_camids.memview)) __PYX_ERR(0, 21, __pyx_L3_error)
4215 __pyx_v_g_camids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[6], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_g_camids.memview)) __PYX_ERR(0, 21, __pyx_L3_error)
4217 goto __pyx_L4_argument_unpacking_done;
4218 __pyx_L5_argtuple_error:;
4219 __Pyx_RaiseArgtupleInvalid(
"evaluate_roc_cy", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 20, __pyx_L3_error)
4221 __Pyx_AddTraceback(
"roc_cy.evaluate_roc_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
4222 __Pyx_RefNannyFinishContext();
4224 __pyx_L4_argument_unpacking_done:;
4225 __pyx_r = __pyx_pf_6roc_cy_evaluate_roc_cy(__pyx_self, __pyx_v_distmat, __pyx_v_q_feats, __pyx_v_g_feats, __pyx_v_q_pids, __pyx_v_g_pids, __pyx_v_q_camids, __pyx_v_g_camids);
4228 __Pyx_RefNannyFinishContext();
4232static PyObject *__pyx_pf_6roc_cy_evaluate_roc_cy(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distmat, __Pyx_memviewslice __pyx_v_q_feats, __Pyx_memviewslice __pyx_v_g_feats, __Pyx_memviewslice __pyx_v_q_pids, __Pyx_memviewslice __pyx_v_g_pids, __Pyx_memviewslice __pyx_v_q_camids, __Pyx_memviewslice __pyx_v_g_camids) {
4233 PyObject *__pyx_r = NULL;
4234 __Pyx_RefNannyDeclarations
4235 PyObject *__pyx_t_1 = NULL;
4236 int __pyx_lineno = 0;
4237 const char *__pyx_filename = NULL;
4238 int __pyx_clineno = 0;
4239 __Pyx_RefNannySetupContext(
"evaluate_roc_cy", 0);
4240 __Pyx_XDECREF(__pyx_r);
4241 if (unlikely(!__pyx_v_distmat.memview)) { __Pyx_RaiseUnboundLocalError(
"distmat"); __PYX_ERR(0, 20, __pyx_L1_error) }
4242 if (unlikely(!__pyx_v_q_feats.memview)) { __Pyx_RaiseUnboundLocalError(
"q_feats"); __PYX_ERR(0, 20, __pyx_L1_error) }
4243 if (unlikely(!__pyx_v_g_feats.memview)) { __Pyx_RaiseUnboundLocalError(
"g_feats"); __PYX_ERR(0, 20, __pyx_L1_error) }
4244 if (unlikely(!__pyx_v_q_pids.memview)) { __Pyx_RaiseUnboundLocalError(
"q_pids"); __PYX_ERR(0, 20, __pyx_L1_error) }
4245 if (unlikely(!__pyx_v_g_pids.memview)) { __Pyx_RaiseUnboundLocalError(
"g_pids"); __PYX_ERR(0, 20, __pyx_L1_error) }
4246 if (unlikely(!__pyx_v_q_camids.memview)) { __Pyx_RaiseUnboundLocalError(
"q_camids"); __PYX_ERR(0, 20, __pyx_L1_error) }
4247 if (unlikely(!__pyx_v_g_camids.memview)) { __Pyx_RaiseUnboundLocalError(
"g_camids"); __PYX_ERR(0, 20, __pyx_L1_error) }
4248 __pyx_t_1 = __pyx_f_6roc_cy_evaluate_roc_cy(__pyx_v_distmat, __pyx_v_q_feats, __pyx_v_g_feats, __pyx_v_q_pids, __pyx_v_g_pids, __pyx_v_q_camids, __pyx_v_g_camids, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
4249 __Pyx_GOTREF(__pyx_t_1);
4250 __pyx_r = __pyx_t_1;
4256 __Pyx_XDECREF(__pyx_t_1);
4257 __Pyx_AddTraceback(
"roc_cy.evaluate_roc_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
4260 __PYX_XDEC_MEMVIEW(&__pyx_v_distmat, 1);
4261 __PYX_XDEC_MEMVIEW(&__pyx_v_q_feats, 1);
4262 __PYX_XDEC_MEMVIEW(&__pyx_v_g_feats, 1);
4263 __PYX_XDEC_MEMVIEW(&__pyx_v_q_pids, 1);
4264 __PYX_XDEC_MEMVIEW(&__pyx_v_g_pids, 1);
4265 __PYX_XDEC_MEMVIEW(&__pyx_v_q_camids, 1);
4266 __PYX_XDEC_MEMVIEW(&__pyx_v_g_camids, 1);
4267 __Pyx_XGIVEREF(__pyx_r);
4268 __Pyx_RefNannyFinishContext();
4280static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
4281 PyObject *__pyx_r = NULL;
4282 __Pyx_RefNannyDeclarations
4283 PyObject *__pyx_t_1 = NULL;
4284 int __pyx_lineno = 0;
4285 const char *__pyx_filename = NULL;
4286 int __pyx_clineno = 0;
4287 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew1", 0);
4296 __Pyx_XDECREF(__pyx_r);
4297 __pyx_t_1 = PyArray_MultiIterNew(1, ((
void *)__pyx_v_a));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
4298 __Pyx_GOTREF(__pyx_t_1);
4299 __pyx_r = __pyx_t_1;
4313 __Pyx_XDECREF(__pyx_t_1);
4314 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
4317 __Pyx_XGIVEREF(__pyx_r);
4318 __Pyx_RefNannyFinishContext();
4330static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
4331 PyObject *__pyx_r = NULL;
4332 __Pyx_RefNannyDeclarations
4333 PyObject *__pyx_t_1 = NULL;
4334 int __pyx_lineno = 0;
4335 const char *__pyx_filename = NULL;
4336 int __pyx_clineno = 0;
4337 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew2", 0);
4346 __Pyx_XDECREF(__pyx_r);
4347 __pyx_t_1 = PyArray_MultiIterNew(2, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
4348 __Pyx_GOTREF(__pyx_t_1);
4349 __pyx_r = __pyx_t_1;
4363 __Pyx_XDECREF(__pyx_t_1);
4364 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
4367 __Pyx_XGIVEREF(__pyx_r);
4368 __Pyx_RefNannyFinishContext();
4380static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
4381 PyObject *__pyx_r = NULL;
4382 __Pyx_RefNannyDeclarations
4383 PyObject *__pyx_t_1 = NULL;
4384 int __pyx_lineno = 0;
4385 const char *__pyx_filename = NULL;
4386 int __pyx_clineno = 0;
4387 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew3", 0);
4396 __Pyx_XDECREF(__pyx_r);
4397 __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, 742, __pyx_L1_error)
4398 __Pyx_GOTREF(__pyx_t_1);
4399 __pyx_r = __pyx_t_1;
4413 __Pyx_XDECREF(__pyx_t_1);
4414 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
4417 __Pyx_XGIVEREF(__pyx_r);
4418 __Pyx_RefNannyFinishContext();
4430static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
4431 PyObject *__pyx_r = NULL;
4432 __Pyx_RefNannyDeclarations
4433 PyObject *__pyx_t_1 = NULL;
4434 int __pyx_lineno = 0;
4435 const char *__pyx_filename = NULL;
4436 int __pyx_clineno = 0;
4437 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew4", 0);
4446 __Pyx_XDECREF(__pyx_r);
4447 __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, 745, __pyx_L1_error)
4448 __Pyx_GOTREF(__pyx_t_1);
4449 __pyx_r = __pyx_t_1;
4463 __Pyx_XDECREF(__pyx_t_1);
4464 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
4467 __Pyx_XGIVEREF(__pyx_r);
4468 __Pyx_RefNannyFinishContext();
4480static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
4481 PyObject *__pyx_r = NULL;
4482 __Pyx_RefNannyDeclarations
4483 PyObject *__pyx_t_1 = NULL;
4484 int __pyx_lineno = 0;
4485 const char *__pyx_filename = NULL;
4486 int __pyx_clineno = 0;
4487 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew5", 0);
4496 __Pyx_XDECREF(__pyx_r);
4497 __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, 748, __pyx_L1_error)
4498 __Pyx_GOTREF(__pyx_t_1);
4499 __pyx_r = __pyx_t_1;
4513 __Pyx_XDECREF(__pyx_t_1);
4514 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
4517 __Pyx_XGIVEREF(__pyx_r);
4518 __Pyx_RefNannyFinishContext();
4530static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
4531 PyObject *__pyx_r = NULL;
4532 __Pyx_RefNannyDeclarations
4534 __Pyx_RefNannySetupContext(
"PyDataType_SHAPE", 0);
4543 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
4553 __Pyx_XDECREF(__pyx_r);
4554 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
4555 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
4575 __Pyx_XDECREF(__pyx_r);
4576 __Pyx_INCREF(__pyx_empty_tuple);
4577 __pyx_r = __pyx_empty_tuple;
4591 __Pyx_XGIVEREF(__pyx_r);
4592 __Pyx_RefNannyFinishContext();
4604static CYTHON_INLINE
void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
4605 __Pyx_RefNannyDeclarations
4606 __Pyx_RefNannySetupContext(
"set_array_base", 0);
4615 Py_INCREF(__pyx_v_base);
4624 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
4635 __Pyx_RefNannyFinishContext();
4646static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
4647 PyObject *__pyx_v_base;
4648 PyObject *__pyx_r = NULL;
4649 __Pyx_RefNannyDeclarations
4651 __Pyx_RefNannySetupContext(
"get_array_base", 0);
4660 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
4669 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
4679 __Pyx_XDECREF(__pyx_r);
4680 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4699 __Pyx_XDECREF(__pyx_r);
4700 __Pyx_INCREF(((PyObject *)__pyx_v_base));
4701 __pyx_r = ((PyObject *)__pyx_v_base);
4714 __Pyx_XGIVEREF(__pyx_r);
4715 __Pyx_RefNannyFinishContext();
4727static CYTHON_INLINE
int __pyx_f_5numpy_import_array(
void) {
4729 __Pyx_RefNannyDeclarations
4730 PyObject *__pyx_t_1 = NULL;
4731 PyObject *__pyx_t_2 = NULL;
4732 PyObject *__pyx_t_3 = NULL;
4734 PyObject *__pyx_t_5 = NULL;
4735 PyObject *__pyx_t_6 = NULL;
4736 PyObject *__pyx_t_7 = NULL;
4737 PyObject *__pyx_t_8 = NULL;
4738 int __pyx_lineno = 0;
4739 const char *__pyx_filename = NULL;
4740 int __pyx_clineno = 0;
4741 __Pyx_RefNannySetupContext(
"import_array", 0);
4751 __Pyx_PyThreadState_declare
4752 __Pyx_PyThreadState_assign
4753 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4754 __Pyx_XGOTREF(__pyx_t_1);
4755 __Pyx_XGOTREF(__pyx_t_2);
4756 __Pyx_XGOTREF(__pyx_t_3);
4766 __pyx_t_4 = _import_array();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
4776 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4777 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4778 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4779 goto __pyx_L8_try_end;
4789 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4791 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4792 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
4793 __Pyx_GOTREF(__pyx_t_5);
4794 __Pyx_GOTREF(__pyx_t_6);
4795 __Pyx_GOTREF(__pyx_t_7);
4804 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
4805 __Pyx_GOTREF(__pyx_t_8);
4806 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4807 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4808 __PYX_ERR(1, 945, __pyx_L5_except_error)
4810 goto __pyx_L5_except_error;
4811 __pyx_L5_except_error:;
4820 __Pyx_XGIVEREF(__pyx_t_1);
4821 __Pyx_XGIVEREF(__pyx_t_2);
4822 __Pyx_XGIVEREF(__pyx_t_3);
4823 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4824 goto __pyx_L1_error;
4840 __Pyx_XDECREF(__pyx_t_5);
4841 __Pyx_XDECREF(__pyx_t_6);
4842 __Pyx_XDECREF(__pyx_t_7);
4843 __Pyx_XDECREF(__pyx_t_8);
4844 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
4847 __Pyx_RefNannyFinishContext();
4859static CYTHON_INLINE
int __pyx_f_5numpy_import_umath(
void) {
4861 __Pyx_RefNannyDeclarations
4862 PyObject *__pyx_t_1 = NULL;
4863 PyObject *__pyx_t_2 = NULL;
4864 PyObject *__pyx_t_3 = NULL;
4866 PyObject *__pyx_t_5 = NULL;
4867 PyObject *__pyx_t_6 = NULL;
4868 PyObject *__pyx_t_7 = NULL;
4869 PyObject *__pyx_t_8 = NULL;
4870 int __pyx_lineno = 0;
4871 const char *__pyx_filename = NULL;
4872 int __pyx_clineno = 0;
4873 __Pyx_RefNannySetupContext(
"import_umath", 0);
4883 __Pyx_PyThreadState_declare
4884 __Pyx_PyThreadState_assign
4885 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
4886 __Pyx_XGOTREF(__pyx_t_1);
4887 __Pyx_XGOTREF(__pyx_t_2);
4888 __Pyx_XGOTREF(__pyx_t_3);
4898 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
4908 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4909 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4910 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4911 goto __pyx_L8_try_end;
4921 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4923 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4924 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
4925 __Pyx_GOTREF(__pyx_t_5);
4926 __Pyx_GOTREF(__pyx_t_6);
4927 __Pyx_GOTREF(__pyx_t_7);
4936 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
4937 __Pyx_GOTREF(__pyx_t_8);
4938 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
4939 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4940 __PYX_ERR(1, 951, __pyx_L5_except_error)
4942 goto __pyx_L5_except_error;
4943 __pyx_L5_except_error:;
4952 __Pyx_XGIVEREF(__pyx_t_1);
4953 __Pyx_XGIVEREF(__pyx_t_2);
4954 __Pyx_XGIVEREF(__pyx_t_3);
4955 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4956 goto __pyx_L1_error;
4972 __Pyx_XDECREF(__pyx_t_5);
4973 __Pyx_XDECREF(__pyx_t_6);
4974 __Pyx_XDECREF(__pyx_t_7);
4975 __Pyx_XDECREF(__pyx_t_8);
4976 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
4979 __Pyx_RefNannyFinishContext();
4991static CYTHON_INLINE
int __pyx_f_5numpy_import_ufunc(
void) {
4993 __Pyx_RefNannyDeclarations
4994 PyObject *__pyx_t_1 = NULL;
4995 PyObject *__pyx_t_2 = NULL;
4996 PyObject *__pyx_t_3 = NULL;
4998 PyObject *__pyx_t_5 = NULL;
4999 PyObject *__pyx_t_6 = NULL;
5000 PyObject *__pyx_t_7 = NULL;
5001 PyObject *__pyx_t_8 = NULL;
5002 int __pyx_lineno = 0;
5003 const char *__pyx_filename = NULL;
5004 int __pyx_clineno = 0;
5005 __Pyx_RefNannySetupContext(
"import_ufunc", 0);
5015 __Pyx_PyThreadState_declare
5016 __Pyx_PyThreadState_assign
5017 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
5018 __Pyx_XGOTREF(__pyx_t_1);
5019 __Pyx_XGOTREF(__pyx_t_2);
5020 __Pyx_XGOTREF(__pyx_t_3);
5030 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
5040 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5041 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5042 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5043 goto __pyx_L8_try_end;
5053 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
5055 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5056 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
5057 __Pyx_GOTREF(__pyx_t_5);
5058 __Pyx_GOTREF(__pyx_t_6);
5059 __Pyx_GOTREF(__pyx_t_7);
5068 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
5069 __Pyx_GOTREF(__pyx_t_8);
5070 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
5071 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5072 __PYX_ERR(1, 957, __pyx_L5_except_error)
5074 goto __pyx_L5_except_error;
5075 __pyx_L5_except_error:;
5084 __Pyx_XGIVEREF(__pyx_t_1);
5085 __Pyx_XGIVEREF(__pyx_t_2);
5086 __Pyx_XGIVEREF(__pyx_t_3);
5087 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
5088 goto __pyx_L1_error;
5104 __Pyx_XDECREF(__pyx_t_5);
5105 __Pyx_XDECREF(__pyx_t_6);
5106 __Pyx_XDECREF(__pyx_t_7);
5107 __Pyx_XDECREF(__pyx_t_8);
5108 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5111 __Pyx_RefNannyFinishContext();
5123static CYTHON_INLINE
int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
5125 __Pyx_RefNannyDeclarations
5126 __Pyx_RefNannySetupContext(
"is_timedelta64_object", 0);
5135 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
5148 __Pyx_RefNannyFinishContext();
5160static CYTHON_INLINE
int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
5162 __Pyx_RefNannyDeclarations
5163 __Pyx_RefNannySetupContext(
"is_datetime64_object", 0);
5172 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
5185 __Pyx_RefNannyFinishContext();
5197static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
5198 npy_datetime __pyx_r;
5207 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
5231static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
5232 npy_timedelta __pyx_r;
5241 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
5265static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
5266 NPY_DATETIMEUNIT __pyx_r;
5273 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
5298static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5299static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5300 PyObject *__pyx_v_shape = 0;
5301 Py_ssize_t __pyx_v_itemsize;
5302 PyObject *__pyx_v_format = 0;
5303 PyObject *__pyx_v_mode = 0;
5304 int __pyx_v_allocate_buffer;
5305 int __pyx_lineno = 0;
5306 const char *__pyx_filename = NULL;
5307 int __pyx_clineno = 0;
5309 __Pyx_RefNannyDeclarations
5310 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
5312 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
5313 PyObject* values[5] = {0,0,0,0,0};
5314 values[3] = ((PyObject *)__pyx_n_s_c);
5315 if (unlikely(__pyx_kwds)) {
5317 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5319 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5321 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5323 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5325 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5327 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5330 default:
goto __pyx_L5_argtuple_error;
5332 kw_args = PyDict_Size(__pyx_kwds);
5335 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
5336 else goto __pyx_L5_argtuple_error;
5339 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
5341 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
5345 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
5347 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
5352 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
5353 if (value) { values[3] = value; kw_args--; }
5358 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
5359 if (value) { values[4] = value; kw_args--; }
5362 if (unlikely(kw_args > 0)) {
5363 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
5366 switch (PyTuple_GET_SIZE(__pyx_args)) {
5367 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5369 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5371 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5372 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5373 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5375 default:
goto __pyx_L5_argtuple_error;
5378 __pyx_v_shape = ((PyObject*)values[0]);
5379 __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)
5380 __pyx_v_format = values[2];
5381 __pyx_v_mode = values[3];
5383 __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)
5393 __pyx_v_allocate_buffer = ((
int)1);
5396 goto __pyx_L4_argument_unpacking_done;
5397 __pyx_L5_argtuple_error:;
5398 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
5400 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5401 __Pyx_RefNannyFinishContext();
5403 __pyx_L4_argument_unpacking_done:;
5404 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1,
"shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
5405 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
5406 PyErr_Format(PyExc_TypeError,
"Argument '%.200s' must not be None",
"format"); __PYX_ERR(2, 122, __pyx_L1_error)
5408 __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);
5423 __Pyx_RefNannyFinishContext();
5427static 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) {
5429 Py_ssize_t __pyx_v_i;
5430 Py_ssize_t __pyx_v_dim;
5431 PyObject **__pyx_v_p;
5434 __Pyx_RefNannyDeclarations
5435 Py_ssize_t __pyx_t_1;
5437 PyObject *__pyx_t_3 = NULL;
5439 PyObject *__pyx_t_5 = NULL;
5440 PyObject *__pyx_t_6 = NULL;
5443 Py_ssize_t __pyx_t_9;
5444 PyObject *__pyx_t_10 = NULL;
5445 Py_ssize_t __pyx_t_11;
5446 int __pyx_lineno = 0;
5447 const char *__pyx_filename = NULL;
5448 int __pyx_clineno = 0;
5449 __Pyx_RefNannySetupContext(
"__cinit__", 0);
5450 __Pyx_INCREF(__pyx_v_format);
5459 if (unlikely(__pyx_v_shape == Py_None)) {
5460 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
5461 __PYX_ERR(2, 129, __pyx_L1_error)
5463 __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)
5464 __pyx_v_self->ndim = ((
int)__pyx_t_1);
5473 __pyx_v_self->itemsize = __pyx_v_itemsize;
5482 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
5483 if (unlikely(__pyx_t_2)) {
5492 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
5493 __Pyx_GOTREF(__pyx_t_3);
5494 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5495 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5496 __PYX_ERR(2, 133, __pyx_L1_error)
5514 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
5515 if (unlikely(__pyx_t_2)) {
5524 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
5525 __Pyx_GOTREF(__pyx_t_3);
5526 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5527 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5528 __PYX_ERR(2, 136, __pyx_L1_error)
5546 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
5547 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
5557 __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)
5558 __Pyx_GOTREF(__pyx_t_5);
5560 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5561 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5562 if (likely(__pyx_t_6)) {
5563 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5564 __Pyx_INCREF(__pyx_t_6);
5565 __Pyx_INCREF(function);
5566 __Pyx_DECREF_SET(__pyx_t_5, function);
5569 __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);
5570 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5571 if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
5572 __Pyx_GOTREF(__pyx_t_3);
5573 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5574 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
5593 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)
5594 __pyx_t_3 = __pyx_v_format;
5595 __Pyx_INCREF(__pyx_t_3);
5596 __Pyx_GIVEREF(__pyx_t_3);
5597 __Pyx_GOTREF(__pyx_v_self->_format);
5598 __Pyx_DECREF(__pyx_v_self->_format);
5599 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
5609 if (unlikely(__pyx_v_self->_format == Py_None)) {
5610 PyErr_SetString(PyExc_TypeError,
"expected bytes, NoneType found");
5611 __PYX_ERR(2, 141, __pyx_L1_error)
5613 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format);
if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
5614 __pyx_v_self->format = __pyx_t_7;
5623 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
5632 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
5641 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
5642 if (unlikely(__pyx_t_4)) {
5651 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
5652 __Pyx_GOTREF(__pyx_t_3);
5653 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5654 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5655 __PYX_ERR(2, 148, __pyx_L1_error)
5674 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
5676 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
5677 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5678 __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)
5680 __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)
5681 __Pyx_GOTREF(__pyx_t_5);
5683 __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)
5684 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5685 __pyx_v_dim = __pyx_t_9;
5686 __pyx_v_idx = __pyx_t_8;
5687 __pyx_t_8 = (__pyx_t_8 + 1);
5696 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
5697 if (unlikely(__pyx_t_4)) {
5706 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
5707 __Pyx_GOTREF(__pyx_t_5);
5708 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
5709 __Pyx_GOTREF(__pyx_t_6);
5710 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
5711 __Pyx_GOTREF(__pyx_t_10);
5712 __Pyx_GIVEREF(__pyx_t_5);
5713 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
5714 __Pyx_GIVEREF(__pyx_t_6);
5715 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
5718 __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)
5719 __Pyx_GOTREF(__pyx_t_6);
5720 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5721 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
5722 __Pyx_GOTREF(__pyx_t_10);
5723 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5724 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5725 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5726 __PYX_ERR(2, 153, __pyx_L1_error)
5744 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
5754 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5763 __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)
5773 __pyx_v_order =
'F';
5782 __Pyx_INCREF(__pyx_n_u_fortran);
5783 __Pyx_GIVEREF(__pyx_n_u_fortran);
5784 __Pyx_GOTREF(__pyx_v_self->mode);
5785 __Pyx_DECREF(__pyx_v_self->mode);
5786 __pyx_v_self->mode = __pyx_n_u_fortran;
5805 __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)
5806 if (likely(__pyx_t_4)) {
5815 __pyx_v_order =
'C';
5824 __Pyx_INCREF(__pyx_n_u_c);
5825 __Pyx_GIVEREF(__pyx_n_u_c);
5826 __Pyx_GOTREF(__pyx_v_self->mode);
5827 __Pyx_DECREF(__pyx_v_self->mode);
5828 __pyx_v_self->mode = __pyx_n_u_c;
5848 __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)
5849 __Pyx_GOTREF(__pyx_t_3);
5850 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
5851 __Pyx_GOTREF(__pyx_t_10);
5852 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5853 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5854 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5855 __PYX_ERR(2, 164, __pyx_L1_error)
5866 __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);
5875 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
5884 __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)
5885 __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)
5886 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5887 __pyx_v_self->dtype_is_object = __pyx_t_4;
5896 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
5906 __pyx_v_self->data = ((
char *)malloc(__pyx_v_self->len));
5915 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
5916 if (unlikely(__pyx_t_4)) {
5925 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__7, NULL);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
5926 __Pyx_GOTREF(__pyx_t_10);
5927 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5928 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5929 __PYX_ERR(2, 176, __pyx_L1_error)
5947 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
5957 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
5966 if (unlikely(__pyx_v_itemsize == 0)) {
5967 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
5968 __PYX_ERR(2, 180, __pyx_L1_error)
5970 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))) {
5971 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
5972 __PYX_ERR(2, 180, __pyx_L1_error)
5974 __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
5975 __pyx_t_9 = __pyx_t_1;
5976 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
5977 __pyx_v_i = __pyx_t_11;
5986 (__pyx_v_p[__pyx_v_i]) = Py_None;
6028 __Pyx_XDECREF(__pyx_t_3);
6029 __Pyx_XDECREF(__pyx_t_5);
6030 __Pyx_XDECREF(__pyx_t_6);
6031 __Pyx_XDECREF(__pyx_t_10);
6032 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6035 __Pyx_XDECREF(__pyx_v_format);
6036 __Pyx_RefNannyFinishContext();
6049static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
6050static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
6052 __Pyx_RefNannyDeclarations
6053 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
6054 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((
struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
6057 __Pyx_RefNannyFinishContext();
6061static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
6062 int __pyx_v_bufmode;
6064 __Pyx_RefNannyDeclarations
6067 PyObject *__pyx_t_3 = NULL;
6069 Py_ssize_t __pyx_t_5;
6071 Py_ssize_t *__pyx_t_7;
6072 int __pyx_lineno = 0;
6073 const char *__pyx_filename = NULL;
6074 int __pyx_clineno = 0;
6075 if (__pyx_v_info == NULL) {
6076 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
6079 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
6080 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
6081 __Pyx_GIVEREF(__pyx_v_info->obj);
6090 __pyx_v_bufmode = -1;
6099 __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)
6100 __pyx_t_2 = (__pyx_t_1 != 0);
6110 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6129 __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)
6130 __pyx_t_1 = (__pyx_t_2 != 0);
6140 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6159 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
6160 if (unlikely(__pyx_t_1)) {
6169 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
6170 __Pyx_GOTREF(__pyx_t_3);
6171 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6172 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6173 __PYX_ERR(2, 192, __pyx_L1_error)
6191 __pyx_t_4 = __pyx_v_self->data;
6192 __pyx_v_info->buf = __pyx_t_4;
6201 __pyx_t_5 = __pyx_v_self->len;
6202 __pyx_v_info->len = __pyx_t_5;
6211 __pyx_t_6 = __pyx_v_self->ndim;
6212 __pyx_v_info->ndim = __pyx_t_6;
6221 __pyx_t_7 = __pyx_v_self->_shape;
6222 __pyx_v_info->shape = __pyx_t_7;
6231 __pyx_t_7 = __pyx_v_self->_strides;
6232 __pyx_v_info->strides = __pyx_t_7;
6241 __pyx_v_info->suboffsets = NULL;
6250 __pyx_t_5 = __pyx_v_self->itemsize;
6251 __pyx_v_info->itemsize = __pyx_t_5;
6260 __pyx_v_info->readonly = 0;
6269 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
6279 __pyx_t_4 = __pyx_v_self->format;
6280 __pyx_v_info->format = __pyx_t_4;
6300 __pyx_v_info->format = NULL;
6311 __Pyx_INCREF(((PyObject *)__pyx_v_self));
6312 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6313 __Pyx_GOTREF(__pyx_v_info->obj);
6314 __Pyx_DECREF(__pyx_v_info->obj);
6315 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
6329 __Pyx_XDECREF(__pyx_t_3);
6330 __Pyx_AddTraceback(
"View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6332 if (__pyx_v_info->obj != NULL) {
6333 __Pyx_GOTREF(__pyx_v_info->obj);
6334 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6338 if (__pyx_v_info->obj == Py_None) {
6339 __Pyx_GOTREF(__pyx_v_info->obj);
6340 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6343 __Pyx_RefNannyFinishContext();
6356static void __pyx_array___dealloc__(PyObject *__pyx_v_self);
6357static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
6358 __Pyx_RefNannyDeclarations
6359 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
6360 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((
struct __pyx_array_obj *)__pyx_v_self));
6363 __Pyx_RefNannyFinishContext();
6366static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self) {
6367 __Pyx_RefNannyDeclarations
6369 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
6378 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
6388 __pyx_v_self->callback_free_data(__pyx_v_self->data);
6407 __pyx_t_1 = (__pyx_v_self->free_data != 0);
6417 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
6427 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
6445 free(__pyx_v_self->data);
6464 PyObject_Free(__pyx_v_self->_shape);
6475 __Pyx_RefNannyFinishContext();
6487static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self);
6488static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
6489 PyObject *__pyx_r = 0;
6490 __Pyx_RefNannyDeclarations
6491 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
6492 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((
struct __pyx_array_obj *)__pyx_v_self));
6495 __Pyx_RefNannyFinishContext();
6499static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self) {
6500 PyObject *__pyx_r = NULL;
6501 __Pyx_RefNannyDeclarations
6502 PyObject *__pyx_t_1 = NULL;
6503 int __pyx_lineno = 0;
6504 const char *__pyx_filename = NULL;
6505 int __pyx_clineno = 0;
6506 __Pyx_RefNannySetupContext(
"__get__", 0);
6515 __Pyx_XDECREF(__pyx_r);
6516 __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)
6517 __Pyx_GOTREF(__pyx_t_1);
6518 __pyx_r = __pyx_t_1;
6532 __Pyx_XDECREF(__pyx_t_1);
6533 __Pyx_AddTraceback(
"View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6536 __Pyx_XGIVEREF(__pyx_r);
6537 __Pyx_RefNannyFinishContext();
6549static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self) {
6551 PyObject *__pyx_r = NULL;
6552 __Pyx_RefNannyDeclarations
6553 PyObject *__pyx_t_1 = NULL;
6554 PyObject *__pyx_t_2 = NULL;
6555 PyObject *__pyx_t_3 = NULL;
6556 int __pyx_lineno = 0;
6557 const char *__pyx_filename = NULL;
6558 int __pyx_clineno = 0;
6559 __Pyx_RefNannySetupContext(
"get_memview", 0);
6568 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
6577 __Pyx_XDECREF(__pyx_r);
6578 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
6579 __Pyx_GOTREF(__pyx_t_1);
6580 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
6581 __Pyx_GOTREF(__pyx_t_2);
6582 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
6583 __Pyx_GOTREF(__pyx_t_3);
6584 __Pyx_INCREF(((PyObject *)__pyx_v_self));
6585 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6586 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
6587 __Pyx_GIVEREF(__pyx_t_1);
6588 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
6589 __Pyx_GIVEREF(__pyx_t_2);
6590 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
6593 __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)
6594 __Pyx_GOTREF(__pyx_t_2);
6595 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6596 __pyx_r = __pyx_t_2;
6610 __Pyx_XDECREF(__pyx_t_1);
6611 __Pyx_XDECREF(__pyx_t_2);
6612 __Pyx_XDECREF(__pyx_t_3);
6613 __Pyx_AddTraceback(
"View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
6616 __Pyx_XGIVEREF(__pyx_r);
6617 __Pyx_RefNannyFinishContext();
6630static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self);
6631static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
6633 __Pyx_RefNannyDeclarations
6634 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
6635 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((
struct __pyx_array_obj *)__pyx_v_self));
6638 __Pyx_RefNannyFinishContext();
6642static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self) {
6644 __Pyx_RefNannyDeclarations
6645 __Pyx_RefNannySetupContext(
"__len__", 0);
6654 __pyx_r = (__pyx_v_self->_shape[0]);
6667 __Pyx_RefNannyFinishContext();
6680static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr);
6681static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
6682 PyObject *__pyx_r = 0;
6683 __Pyx_RefNannyDeclarations
6684 __Pyx_RefNannySetupContext(
"__getattr__ (wrapper)", 0);
6685 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
6688 __Pyx_RefNannyFinishContext();
6692static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
6693 PyObject *__pyx_r = NULL;
6694 __Pyx_RefNannyDeclarations
6695 PyObject *__pyx_t_1 = NULL;
6696 PyObject *__pyx_t_2 = NULL;
6697 int __pyx_lineno = 0;
6698 const char *__pyx_filename = NULL;
6699 int __pyx_clineno = 0;
6700 __Pyx_RefNannySetupContext(
"__getattr__", 0);
6709 __Pyx_XDECREF(__pyx_r);
6710 __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)
6711 __Pyx_GOTREF(__pyx_t_1);
6712 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
6713 __Pyx_GOTREF(__pyx_t_2);
6714 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6715 __pyx_r = __pyx_t_2;
6729 __Pyx_XDECREF(__pyx_t_1);
6730 __Pyx_XDECREF(__pyx_t_2);
6731 __Pyx_AddTraceback(
"View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6734 __Pyx_XGIVEREF(__pyx_r);
6735 __Pyx_RefNannyFinishContext();
6748static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item);
6749static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
6750 PyObject *__pyx_r = 0;
6751 __Pyx_RefNannyDeclarations
6752 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
6753 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
6756 __Pyx_RefNannyFinishContext();
6760static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
6761 PyObject *__pyx_r = NULL;
6762 __Pyx_RefNannyDeclarations
6763 PyObject *__pyx_t_1 = NULL;
6764 PyObject *__pyx_t_2 = NULL;
6765 int __pyx_lineno = 0;
6766 const char *__pyx_filename = NULL;
6767 int __pyx_clineno = 0;
6768 __Pyx_RefNannySetupContext(
"__getitem__", 0);
6777 __Pyx_XDECREF(__pyx_r);
6778 __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)
6779 __Pyx_GOTREF(__pyx_t_1);
6780 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
6781 __Pyx_GOTREF(__pyx_t_2);
6782 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6783 __pyx_r = __pyx_t_2;
6797 __Pyx_XDECREF(__pyx_t_1);
6798 __Pyx_XDECREF(__pyx_t_2);
6799 __Pyx_AddTraceback(
"View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6802 __Pyx_XGIVEREF(__pyx_r);
6803 __Pyx_RefNannyFinishContext();
6816static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
6817static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
6819 __Pyx_RefNannyDeclarations
6820 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
6821 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
6824 __Pyx_RefNannyFinishContext();
6828static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
6830 __Pyx_RefNannyDeclarations
6831 PyObject *__pyx_t_1 = NULL;
6832 int __pyx_lineno = 0;
6833 const char *__pyx_filename = NULL;
6834 int __pyx_clineno = 0;
6835 __Pyx_RefNannySetupContext(
"__setitem__", 0);
6844 __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)
6845 __Pyx_GOTREF(__pyx_t_1);
6846 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
6847 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6861 __Pyx_XDECREF(__pyx_t_1);
6862 __Pyx_AddTraceback(
"View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6865 __Pyx_RefNannyFinishContext();
6876static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
6877static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6878 PyObject *__pyx_r = 0;
6879 __Pyx_RefNannyDeclarations
6880 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
6881 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((
struct __pyx_array_obj *)__pyx_v_self));
6884 __Pyx_RefNannyFinishContext();
6888static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self) {
6889 PyObject *__pyx_r = NULL;
6890 __Pyx_RefNannyDeclarations
6891 PyObject *__pyx_t_1 = NULL;
6892 int __pyx_lineno = 0;
6893 const char *__pyx_filename = NULL;
6894 int __pyx_clineno = 0;
6895 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
6903 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
6904 __Pyx_GOTREF(__pyx_t_1);
6905 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6906 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6907 __PYX_ERR(2, 2, __pyx_L1_error)
6917 __Pyx_XDECREF(__pyx_t_1);
6918 __Pyx_AddTraceback(
"View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6920 __Pyx_XGIVEREF(__pyx_r);
6921 __Pyx_RefNannyFinishContext();
6933static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
6934static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
6935 PyObject *__pyx_r = 0;
6936 __Pyx_RefNannyDeclarations
6937 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
6938 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
6941 __Pyx_RefNannyFinishContext();
6945static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
6946 PyObject *__pyx_r = NULL;
6947 __Pyx_RefNannyDeclarations
6948 PyObject *__pyx_t_1 = NULL;
6949 int __pyx_lineno = 0;
6950 const char *__pyx_filename = NULL;
6951 int __pyx_clineno = 0;
6952 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
6959 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
6960 __Pyx_GOTREF(__pyx_t_1);
6961 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6962 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6963 __PYX_ERR(2, 4, __pyx_L1_error)
6974 __Pyx_XDECREF(__pyx_t_1);
6975 __Pyx_AddTraceback(
"View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6977 __Pyx_XGIVEREF(__pyx_r);
6978 __Pyx_RefNannyFinishContext();
6990static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize,
char *__pyx_v_format,
char *__pyx_v_mode,
char *__pyx_v_buf) {
6991 struct __pyx_array_obj *__pyx_v_result = 0;
6992 struct __pyx_array_obj *__pyx_r = NULL;
6993 __Pyx_RefNannyDeclarations
6995 PyObject *__pyx_t_2 = NULL;
6996 PyObject *__pyx_t_3 = NULL;
6997 PyObject *__pyx_t_4 = NULL;
6998 PyObject *__pyx_t_5 = NULL;
6999 int __pyx_lineno = 0;
7000 const char *__pyx_filename = NULL;
7001 int __pyx_clineno = 0;
7002 __Pyx_RefNannySetupContext(
"array_cwrapper", 0);
7011 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
7021 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
7022 __Pyx_GOTREF(__pyx_t_2);
7023 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
7024 __Pyx_GOTREF(__pyx_t_3);
7025 __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)
7026 __Pyx_GOTREF(__pyx_t_4);
7027 __pyx_t_5 = PyTuple_New(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
7028 __Pyx_GOTREF(__pyx_t_5);
7029 __Pyx_INCREF(__pyx_v_shape);
7030 __Pyx_GIVEREF(__pyx_v_shape);
7031 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
7032 __Pyx_GIVEREF(__pyx_t_2);
7033 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
7034 __Pyx_GIVEREF(__pyx_t_3);
7035 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
7036 __Pyx_GIVEREF(__pyx_t_4);
7037 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
7041 __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)
7042 __Pyx_GOTREF(__pyx_t_4);
7043 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7044 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_4);
7065 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
7066 __Pyx_GOTREF(__pyx_t_4);
7067 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
7068 __Pyx_GOTREF(__pyx_t_5);
7069 __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)
7070 __Pyx_GOTREF(__pyx_t_3);
7071 __pyx_t_2 = PyTuple_New(4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
7072 __Pyx_GOTREF(__pyx_t_2);
7073 __Pyx_INCREF(__pyx_v_shape);
7074 __Pyx_GIVEREF(__pyx_v_shape);
7075 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
7076 __Pyx_GIVEREF(__pyx_t_4);
7077 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
7078 __Pyx_GIVEREF(__pyx_t_5);
7079 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
7080 __Pyx_GIVEREF(__pyx_t_3);
7081 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
7093 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
7094 __Pyx_GOTREF(__pyx_t_3);
7095 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
7104 __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)
7105 __Pyx_GOTREF(__pyx_t_5);
7106 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7107 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7108 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_5);
7118 __pyx_v_result->data = __pyx_v_buf;
7129 __Pyx_XDECREF(((PyObject *)__pyx_r));
7130 __Pyx_INCREF(((PyObject *)__pyx_v_result));
7131 __pyx_r = __pyx_v_result;
7144 __Pyx_XDECREF(__pyx_t_2);
7145 __Pyx_XDECREF(__pyx_t_3);
7146 __Pyx_XDECREF(__pyx_t_4);
7147 __Pyx_XDECREF(__pyx_t_5);
7148 __Pyx_AddTraceback(
"View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
7151 __Pyx_XDECREF((PyObject *)__pyx_v_result);
7152 __Pyx_XGIVEREF((PyObject *)__pyx_r);
7153 __Pyx_RefNannyFinishContext();
7166static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
7167static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7168 PyObject *__pyx_v_name = 0;
7169 int __pyx_lineno = 0;
7170 const char *__pyx_filename = NULL;
7171 int __pyx_clineno = 0;
7173 __Pyx_RefNannyDeclarations
7174 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
7176 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
7177 PyObject* values[1] = {0};
7178 if (unlikely(__pyx_kwds)) {
7180 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7182 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7185 default:
goto __pyx_L5_argtuple_error;
7187 kw_args = PyDict_Size(__pyx_kwds);
7190 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
7191 else goto __pyx_L5_argtuple_error;
7193 if (unlikely(kw_args > 0)) {
7194 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
7196 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
7197 goto __pyx_L5_argtuple_error;
7199 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7201 __pyx_v_name = values[0];
7203 goto __pyx_L4_argument_unpacking_done;
7204 __pyx_L5_argtuple_error:;
7205 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
7207 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7208 __Pyx_RefNannyFinishContext();
7210 __pyx_L4_argument_unpacking_done:;
7211 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
7214 __Pyx_RefNannyFinishContext();
7218static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
7220 __Pyx_RefNannyDeclarations
7221 __Pyx_RefNannySetupContext(
"__init__", 0);
7230 __Pyx_INCREF(__pyx_v_name);
7231 __Pyx_GIVEREF(__pyx_v_name);
7232 __Pyx_GOTREF(__pyx_v_self->name);
7233 __Pyx_DECREF(__pyx_v_self->name);
7234 __pyx_v_self->name = __pyx_v_name;
7246 __Pyx_RefNannyFinishContext();
7259static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self);
7260static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
7261 PyObject *__pyx_r = 0;
7262 __Pyx_RefNannyDeclarations
7263 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
7264 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
7267 __Pyx_RefNannyFinishContext();
7271static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
7272 PyObject *__pyx_r = NULL;
7273 __Pyx_RefNannyDeclarations
7274 __Pyx_RefNannySetupContext(
"__repr__", 0);
7283 __Pyx_XDECREF(__pyx_r);
7284 __Pyx_INCREF(__pyx_v_self->name);
7285 __pyx_r = __pyx_v_self->name;
7298 __Pyx_XGIVEREF(__pyx_r);
7299 __Pyx_RefNannyFinishContext();
7310static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
7311static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7312 PyObject *__pyx_r = 0;
7313 __Pyx_RefNannyDeclarations
7314 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
7315 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
7318 __Pyx_RefNannyFinishContext();
7322static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
7323 PyObject *__pyx_v_state = 0;
7324 PyObject *__pyx_v__dict = 0;
7325 int __pyx_v_use_setstate;
7326 PyObject *__pyx_r = NULL;
7327 __Pyx_RefNannyDeclarations
7328 PyObject *__pyx_t_1 = NULL;
7331 PyObject *__pyx_t_4 = NULL;
7332 PyObject *__pyx_t_5 = NULL;
7333 int __pyx_lineno = 0;
7334 const char *__pyx_filename = NULL;
7335 int __pyx_clineno = 0;
7336 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
7345 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
7346 __Pyx_GOTREF(__pyx_t_1);
7347 __Pyx_INCREF(__pyx_v_self->name);
7348 __Pyx_GIVEREF(__pyx_v_self->name);
7349 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
7350 __pyx_v_state = ((PyObject*)__pyx_t_1);
7360 __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)
7361 __Pyx_GOTREF(__pyx_t_1);
7362 __pyx_v__dict = __pyx_t_1;
7372 __pyx_t_2 = (__pyx_v__dict != Py_None);
7373 __pyx_t_3 = (__pyx_t_2 != 0);
7383 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
7384 __Pyx_GOTREF(__pyx_t_1);
7385 __Pyx_INCREF(__pyx_v__dict);
7386 __Pyx_GIVEREF(__pyx_v__dict);
7387 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
7388 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
7389 __Pyx_GOTREF(__pyx_t_4);
7390 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7391 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
7401 __pyx_v_use_setstate = 1;
7421 __pyx_t_3 = (__pyx_v_self->name != Py_None);
7422 __pyx_v_use_setstate = __pyx_t_3;
7433 __pyx_t_3 = (__pyx_v_use_setstate != 0);
7443 __Pyx_XDECREF(__pyx_r);
7444 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
7445 __Pyx_GOTREF(__pyx_t_4);
7446 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
7447 __Pyx_GOTREF(__pyx_t_1);
7448 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7449 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7450 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7451 __Pyx_INCREF(__pyx_int_184977713);
7452 __Pyx_GIVEREF(__pyx_int_184977713);
7453 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
7454 __Pyx_INCREF(Py_None);
7455 __Pyx_GIVEREF(Py_None);
7456 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
7457 __pyx_t_5 = PyTuple_New(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
7458 __Pyx_GOTREF(__pyx_t_5);
7459 __Pyx_GIVEREF(__pyx_t_4);
7460 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
7461 __Pyx_GIVEREF(__pyx_t_1);
7462 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
7463 __Pyx_INCREF(__pyx_v_state);
7464 __Pyx_GIVEREF(__pyx_v_state);
7465 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
7468 __pyx_r = __pyx_t_5;
7489 __Pyx_XDECREF(__pyx_r);
7490 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
7491 __Pyx_GOTREF(__pyx_t_5);
7492 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
7493 __Pyx_GOTREF(__pyx_t_1);
7494 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7495 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7496 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
7497 __Pyx_INCREF(__pyx_int_184977713);
7498 __Pyx_GIVEREF(__pyx_int_184977713);
7499 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
7500 __Pyx_INCREF(__pyx_v_state);
7501 __Pyx_GIVEREF(__pyx_v_state);
7502 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
7503 __pyx_t_4 = PyTuple_New(2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
7504 __Pyx_GOTREF(__pyx_t_4);
7505 __Pyx_GIVEREF(__pyx_t_5);
7506 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
7507 __Pyx_GIVEREF(__pyx_t_1);
7508 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
7511 __pyx_r = __pyx_t_4;
7524 __Pyx_XDECREF(__pyx_t_1);
7525 __Pyx_XDECREF(__pyx_t_4);
7526 __Pyx_XDECREF(__pyx_t_5);
7527 __Pyx_AddTraceback(
"View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7530 __Pyx_XDECREF(__pyx_v_state);
7531 __Pyx_XDECREF(__pyx_v__dict);
7532 __Pyx_XGIVEREF(__pyx_r);
7533 __Pyx_RefNannyFinishContext();
7545static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
7546static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7547 PyObject *__pyx_r = 0;
7548 __Pyx_RefNannyDeclarations
7549 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
7550 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
7553 __Pyx_RefNannyFinishContext();
7557static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7558 PyObject *__pyx_r = NULL;
7559 __Pyx_RefNannyDeclarations
7560 PyObject *__pyx_t_1 = NULL;
7561 int __pyx_lineno = 0;
7562 const char *__pyx_filename = NULL;
7563 int __pyx_clineno = 0;
7564 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
7571 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)
7572 __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)
7573 __Pyx_GOTREF(__pyx_t_1);
7574 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7584 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7587 __Pyx_XDECREF(__pyx_t_1);
7588 __Pyx_AddTraceback(
"View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7591 __Pyx_XGIVEREF(__pyx_r);
7592 __Pyx_RefNannyFinishContext();
7604static void *__pyx_align_pointer(
void *__pyx_v_memory,
size_t __pyx_v_alignment) {
7605 Py_intptr_t __pyx_v_aligned_p;
7606 size_t __pyx_v_offset;
7617 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
7626 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
7635 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
7645 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
7663 __pyx_r = ((
void *)__pyx_v_aligned_p);
7688static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
7689static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7690 PyObject *__pyx_v_obj = 0;
7692 int __pyx_v_dtype_is_object;
7693 int __pyx_lineno = 0;
7694 const char *__pyx_filename = NULL;
7695 int __pyx_clineno = 0;
7697 __Pyx_RefNannyDeclarations
7698 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
7700 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
7701 PyObject* values[3] = {0,0,0};
7702 if (unlikely(__pyx_kwds)) {
7704 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7706 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7708 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7710 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7713 default:
goto __pyx_L5_argtuple_error;
7715 kw_args = PyDict_Size(__pyx_kwds);
7718 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
7719 else goto __pyx_L5_argtuple_error;
7722 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
7724 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
7729 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
7730 if (value) { values[2] = value; kw_args--; }
7733 if (unlikely(kw_args > 0)) {
7734 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
7737 switch (PyTuple_GET_SIZE(__pyx_args)) {
7738 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7740 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7741 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7743 default:
goto __pyx_L5_argtuple_error;
7746 __pyx_v_obj = values[0];
7747 __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)
7749 __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)
7751 __pyx_v_dtype_is_object = ((
int)0);
7754 goto __pyx_L4_argument_unpacking_done;
7755 __pyx_L5_argtuple_error:;
7756 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
7758 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7759 __Pyx_RefNannyFinishContext();
7761 __pyx_L4_argument_unpacking_done:;
7762 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
7765 __Pyx_RefNannyFinishContext();
7769static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object) {
7771 __Pyx_RefNannyDeclarations
7776 int __pyx_lineno = 0;
7777 const char *__pyx_filename = NULL;
7778 int __pyx_clineno = 0;
7779 __Pyx_RefNannySetupContext(
"__cinit__", 0);
7788 __Pyx_INCREF(__pyx_v_obj);
7789 __Pyx_GIVEREF(__pyx_v_obj);
7790 __Pyx_GOTREF(__pyx_v_self->obj);
7791 __Pyx_DECREF(__pyx_v_self->obj);
7792 __pyx_v_self->obj = __pyx_v_obj;
7801 __pyx_v_self->flags = __pyx_v_flags;
7810 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
7811 __pyx_t_3 = (__pyx_t_2 != 0);
7814 __pyx_t_1 = __pyx_t_3;
7815 goto __pyx_L4_bool_binop_done;
7817 __pyx_t_3 = (__pyx_v_obj != Py_None);
7818 __pyx_t_2 = (__pyx_t_3 != 0);
7819 __pyx_t_1 = __pyx_t_2;
7820 __pyx_L4_bool_binop_done:;
7830 __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)
7839 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
7849 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
7885 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
7895 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
7904 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
7922 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
7932 __pyx_v_self->lock = PyThread_allocate_lock();
7941 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
7942 if (unlikely(__pyx_t_1)) {
7951 PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
7978 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
7988 __pyx_t_2 = (((__pyx_v_self->view.format[0]) ==
'O') != 0);
7991 __pyx_t_1 = __pyx_t_2;
7992 goto __pyx_L11_bool_binop_done;
7994 __pyx_t_2 = (((__pyx_v_self->view.format[1]) ==
'\x00') != 0);
7995 __pyx_t_1 = __pyx_t_2;
7996 __pyx_L11_bool_binop_done:;
7997 __pyx_v_self->dtype_is_object = __pyx_t_1;
8017 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
8028 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((
void *)(&(__pyx_v_self->acquisition_count[0]))), (
sizeof(__pyx_atomic_int))));
8037 __pyx_v_self->typeinfo = NULL;
8051 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8054 __Pyx_RefNannyFinishContext();
8067static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self);
8068static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
8069 __Pyx_RefNannyDeclarations
8070 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
8071 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
8074 __Pyx_RefNannyFinishContext();
8077static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self) {
8079 __Pyx_RefNannyDeclarations
8085 PyThread_type_lock __pyx_t_6;
8086 PyThread_type_lock __pyx_t_7;
8087 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
8096 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
8097 __pyx_t_2 = (__pyx_t_1 != 0);
8107 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
8126 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
8136 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
8164 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
8174 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
8175 __pyx_t_4 = __pyx_t_3;
8176 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
8177 __pyx_v_i = __pyx_t_5;
8186 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
8196 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
8205 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
8215 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
8216 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
8225 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
8226 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
8244 goto __pyx_L6_break;
8264 PyThread_free_lock(__pyx_v_self->lock);
8286 __Pyx_RefNannyFinishContext();
8297static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
8298 Py_ssize_t __pyx_v_dim;
8299 char *__pyx_v_itemp;
8300 PyObject *__pyx_v_idx = NULL;
8302 __Pyx_RefNannyDeclarations
8303 Py_ssize_t __pyx_t_1;
8304 PyObject *__pyx_t_2 = NULL;
8305 Py_ssize_t __pyx_t_3;
8306 PyObject *(*__pyx_t_4)(PyObject *);
8307 PyObject *__pyx_t_5 = NULL;
8308 Py_ssize_t __pyx_t_6;
8310 int __pyx_lineno = 0;
8311 const char *__pyx_filename = NULL;
8312 int __pyx_clineno = 0;
8313 __Pyx_RefNannySetupContext(
"get_item_pointer", 0);
8322 __pyx_v_itemp = ((
char *)__pyx_v_self->view.buf);
8332 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
8333 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
8336 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
8337 __Pyx_GOTREF(__pyx_t_2);
8338 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
8341 if (likely(!__pyx_t_4)) {
8342 if (likely(PyList_CheckExact(__pyx_t_2))) {
8343 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2))
break;
8344 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8345 __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)
8347 __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)
8348 __Pyx_GOTREF(__pyx_t_5);
8351 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
8352 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8353 __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)
8355 __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)
8356 __Pyx_GOTREF(__pyx_t_5);
8360 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
8361 if (unlikely(!__pyx_t_5)) {
8362 PyObject* exc_type = PyErr_Occurred();
8364 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8365 else __PYX_ERR(2, 397, __pyx_L1_error)
8369 __Pyx_GOTREF(__pyx_t_5);
8371 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
8373 __pyx_v_dim = __pyx_t_1;
8374 __pyx_t_1 = (__pyx_t_1 + 1);
8383 __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)
8384 __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)
8385 __pyx_v_itemp = __pyx_t_7;
8395 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8404 __pyx_r = __pyx_v_itemp;
8417 __Pyx_XDECREF(__pyx_t_2);
8418 __Pyx_XDECREF(__pyx_t_5);
8419 __Pyx_AddTraceback(
"View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
8422 __Pyx_XDECREF(__pyx_v_idx);
8423 __Pyx_RefNannyFinishContext();
8436static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index);
8437static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
8438 PyObject *__pyx_r = 0;
8439 __Pyx_RefNannyDeclarations
8440 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
8441 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
8444 __Pyx_RefNannyFinishContext();
8448static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
8449 PyObject *__pyx_v_have_slices = NULL;
8450 PyObject *__pyx_v_indices = NULL;
8451 char *__pyx_v_itemp;
8452 PyObject *__pyx_r = NULL;
8453 __Pyx_RefNannyDeclarations
8456 PyObject *__pyx_t_3 = NULL;
8457 PyObject *__pyx_t_4 = NULL;
8458 PyObject *__pyx_t_5 = NULL;
8460 int __pyx_lineno = 0;
8461 const char *__pyx_filename = NULL;
8462 int __pyx_clineno = 0;
8463 __Pyx_RefNannySetupContext(
"__getitem__", 0);
8472 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
8473 __pyx_t_2 = (__pyx_t_1 != 0);
8483 __Pyx_XDECREF(__pyx_r);
8484 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8485 __pyx_r = ((PyObject *)__pyx_v_self);
8504 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
8505 __Pyx_GOTREF(__pyx_t_3);
8506 if (likely(__pyx_t_3 != Py_None)) {
8507 PyObject* sequence = __pyx_t_3;
8508 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8509 if (unlikely(size != 2)) {
8510 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
8511 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8512 __PYX_ERR(2, 407, __pyx_L1_error)
8514 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8515 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
8516 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
8517 __Pyx_INCREF(__pyx_t_4);
8518 __Pyx_INCREF(__pyx_t_5);
8520 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
8521 __Pyx_GOTREF(__pyx_t_4);
8522 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
8523 __Pyx_GOTREF(__pyx_t_5);
8525 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8527 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
8529 __pyx_v_have_slices = __pyx_t_4;
8531 __pyx_v_indices = __pyx_t_5;
8541 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
8551 __Pyx_XDECREF(__pyx_r);
8552 __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)
8553 __Pyx_GOTREF(__pyx_t_3);
8554 __pyx_r = __pyx_t_3;
8575 __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)
8576 __pyx_v_itemp = __pyx_t_6;
8585 __Pyx_XDECREF(__pyx_r);
8586 __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)
8587 __Pyx_GOTREF(__pyx_t_3);
8588 __pyx_r = __pyx_t_3;
8603 __Pyx_XDECREF(__pyx_t_3);
8604 __Pyx_XDECREF(__pyx_t_4);
8605 __Pyx_XDECREF(__pyx_t_5);
8606 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8609 __Pyx_XDECREF(__pyx_v_have_slices);
8610 __Pyx_XDECREF(__pyx_v_indices);
8611 __Pyx_XGIVEREF(__pyx_r);
8612 __Pyx_RefNannyFinishContext();
8625static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
8626static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
8628 __Pyx_RefNannyDeclarations
8629 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
8630 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
8633 __Pyx_RefNannyFinishContext();
8637static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
8638 PyObject *__pyx_v_have_slices = NULL;
8639 PyObject *__pyx_v_obj = NULL;
8641 __Pyx_RefNannyDeclarations
8643 PyObject *__pyx_t_2 = NULL;
8644 PyObject *__pyx_t_3 = NULL;
8645 PyObject *__pyx_t_4 = NULL;
8646 int __pyx_lineno = 0;
8647 const char *__pyx_filename = NULL;
8648 int __pyx_clineno = 0;
8649 __Pyx_RefNannySetupContext(
"__setitem__", 0);
8650 __Pyx_INCREF(__pyx_v_index);
8659 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
8660 if (unlikely(__pyx_t_1)) {
8669 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
8670 __Pyx_GOTREF(__pyx_t_2);
8671 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8672 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8673 __PYX_ERR(2, 418, __pyx_L1_error)
8691 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
8692 __Pyx_GOTREF(__pyx_t_2);
8693 if (likely(__pyx_t_2 != Py_None)) {
8694 PyObject* sequence = __pyx_t_2;
8695 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8696 if (unlikely(size != 2)) {
8697 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
8698 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8699 __PYX_ERR(2, 420, __pyx_L1_error)
8701 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8702 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
8703 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
8704 __Pyx_INCREF(__pyx_t_3);
8705 __Pyx_INCREF(__pyx_t_4);
8707 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
8708 __Pyx_GOTREF(__pyx_t_3);
8709 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
8710 __Pyx_GOTREF(__pyx_t_4);
8712 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8714 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
8716 __pyx_v_have_slices = __pyx_t_3;
8718 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
8728 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
8738 __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)
8739 __Pyx_GOTREF(__pyx_t_2);
8740 __pyx_v_obj = __pyx_t_2;
8750 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
8760 __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)
8761 __Pyx_GOTREF(__pyx_t_2);
8762 __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)
8763 __Pyx_GOTREF(__pyx_t_4);
8764 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8765 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8785 __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)
8786 __Pyx_GOTREF(__pyx_t_4);
8787 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
8788 __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)
8789 __Pyx_GOTREF(__pyx_t_2);
8790 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8791 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8813 __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)
8814 __Pyx_GOTREF(__pyx_t_2);
8815 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8831 __Pyx_XDECREF(__pyx_t_2);
8832 __Pyx_XDECREF(__pyx_t_3);
8833 __Pyx_XDECREF(__pyx_t_4);
8834 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8837 __Pyx_XDECREF(__pyx_v_have_slices);
8838 __Pyx_XDECREF(__pyx_v_obj);
8839 __Pyx_XDECREF(__pyx_v_index);
8840 __Pyx_RefNannyFinishContext();
8852static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
8853 PyObject *__pyx_r = NULL;
8854 __Pyx_RefNannyDeclarations
8857 PyObject *__pyx_t_3 = NULL;
8858 PyObject *__pyx_t_4 = NULL;
8859 PyObject *__pyx_t_5 = NULL;
8860 PyObject *__pyx_t_6 = NULL;
8861 PyObject *__pyx_t_7 = NULL;
8862 PyObject *__pyx_t_8 = NULL;
8864 int __pyx_lineno = 0;
8865 const char *__pyx_filename = NULL;
8866 int __pyx_clineno = 0;
8867 __Pyx_RefNannySetupContext(
"is_slice", 0);
8868 __Pyx_INCREF(__pyx_v_obj);
8877 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
8878 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
8889 __Pyx_PyThreadState_declare
8890 __Pyx_PyThreadState_assign
8891 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
8892 __Pyx_XGOTREF(__pyx_t_3);
8893 __Pyx_XGOTREF(__pyx_t_4);
8894 __Pyx_XGOTREF(__pyx_t_5);
8904 __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)
8905 __Pyx_GOTREF(__pyx_t_6);
8914 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
8915 __Pyx_GOTREF(__pyx_t_7);
8924 __pyx_t_8 = PyTuple_New(3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
8925 __Pyx_GOTREF(__pyx_t_8);
8926 __Pyx_INCREF(__pyx_v_obj);
8927 __Pyx_GIVEREF(__pyx_v_obj);
8928 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
8929 __Pyx_GIVEREF(__pyx_t_6);
8930 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
8931 __Pyx_GIVEREF(__pyx_t_7);
8932 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
8935 __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)
8936 __Pyx_GOTREF(__pyx_t_7);
8937 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8938 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
8949 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8950 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8951 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8952 goto __pyx_L9_try_end;
8954 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8955 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
8956 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8965 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
8967 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
8968 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
8969 __Pyx_GOTREF(__pyx_t_7);
8970 __Pyx_GOTREF(__pyx_t_8);
8971 __Pyx_GOTREF(__pyx_t_6);
8980 __Pyx_XDECREF(__pyx_r);
8981 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8982 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8983 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8984 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8985 goto __pyx_L7_except_return;
8987 goto __pyx_L6_except_error;
8988 __pyx_L6_except_error:;
8997 __Pyx_XGIVEREF(__pyx_t_3);
8998 __Pyx_XGIVEREF(__pyx_t_4);
8999 __Pyx_XGIVEREF(__pyx_t_5);
9000 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
9001 goto __pyx_L1_error;
9002 __pyx_L7_except_return:;
9003 __Pyx_XGIVEREF(__pyx_t_3);
9004 __Pyx_XGIVEREF(__pyx_t_4);
9005 __Pyx_XGIVEREF(__pyx_t_5);
9006 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
9027 __Pyx_XDECREF(__pyx_r);
9028 __Pyx_INCREF(__pyx_v_obj);
9029 __pyx_r = __pyx_v_obj;
9042 __Pyx_XDECREF(__pyx_t_6);
9043 __Pyx_XDECREF(__pyx_t_7);
9044 __Pyx_XDECREF(__pyx_t_8);
9045 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
9048 __Pyx_XDECREF(__pyx_v_obj);
9049 __Pyx_XGIVEREF(__pyx_r);
9050 __Pyx_RefNannyFinishContext();
9062static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
9063 __Pyx_memviewslice __pyx_v_dst_slice;
9064 __Pyx_memviewslice __pyx_v_src_slice;
9065 PyObject *__pyx_r = NULL;
9066 __Pyx_RefNannyDeclarations
9067 __Pyx_memviewslice *__pyx_t_1;
9068 __Pyx_memviewslice *__pyx_t_2;
9069 PyObject *__pyx_t_3 = NULL;
9073 int __pyx_lineno = 0;
9074 const char *__pyx_filename = NULL;
9075 int __pyx_clineno = 0;
9076 __Pyx_RefNannySetupContext(
"setitem_slice_assignment", 0);
9085 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
9086 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 445, __pyx_L1_error)
9095 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
9096 __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice));
if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 446, __pyx_L1_error)
9105 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
9106 __Pyx_GOTREF(__pyx_t_3);
9107 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
9108 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9109 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
9110 __Pyx_GOTREF(__pyx_t_3);
9111 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
9112 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9121 __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(2, 445, __pyx_L1_error)
9132 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9135 __Pyx_XDECREF(__pyx_t_3);
9136 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
9139 __Pyx_XGIVEREF(__pyx_r);
9140 __Pyx_RefNannyFinishContext();
9152static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
9153 int __pyx_v_array[0x80];
9156 __Pyx_memviewslice *__pyx_v_dst_slice;
9157 __Pyx_memviewslice __pyx_v_tmp_slice;
9158 PyObject *__pyx_r = NULL;
9159 __Pyx_RefNannyDeclarations
9160 __Pyx_memviewslice *__pyx_t_1;
9162 PyObject *__pyx_t_3 = NULL;
9165 char const *__pyx_t_6;
9166 PyObject *__pyx_t_7 = NULL;
9167 PyObject *__pyx_t_8 = NULL;
9168 PyObject *__pyx_t_9 = NULL;
9169 PyObject *__pyx_t_10 = NULL;
9170 PyObject *__pyx_t_11 = NULL;
9171 PyObject *__pyx_t_12 = NULL;
9172 int __pyx_lineno = 0;
9173 const char *__pyx_filename = NULL;
9174 int __pyx_clineno = 0;
9175 __Pyx_RefNannySetupContext(
"setitem_slice_assign_scalar", 0);
9193 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 456, __pyx_L1_error)
9194 __pyx_v_dst_slice = __pyx_t_1;
9203 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (
sizeof(__pyx_v_array))) != 0);
9213 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
9222 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
9223 if (unlikely(__pyx_t_2)) {
9232 PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
9250 __pyx_v_item = __pyx_v_tmp;
9270 __pyx_v_item = ((
void *)__pyx_v_array);
9290 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
9300 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
9320 __pyx_t_3 = ((
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_3)) __PYX_ERR(2, 470, __pyx_L6_error)
9321 __Pyx_GOTREF(__pyx_t_3);
9322 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9333 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
9343 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 475, __pyx_L6_error)
9344 __Pyx_GOTREF(__pyx_t_3);
9345 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9363 __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);
9375 PyMem_Free(__pyx_v_tmp);
9380 __Pyx_PyThreadState_declare
9381 __Pyx_PyThreadState_assign
9382 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
9383 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9384 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
9385 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
9386 __Pyx_XGOTREF(__pyx_t_7);
9387 __Pyx_XGOTREF(__pyx_t_8);
9388 __Pyx_XGOTREF(__pyx_t_9);
9389 __Pyx_XGOTREF(__pyx_t_10);
9390 __Pyx_XGOTREF(__pyx_t_11);
9391 __Pyx_XGOTREF(__pyx_t_12);
9392 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
9394 PyMem_Free(__pyx_v_tmp);
9396 if (PY_MAJOR_VERSION >= 3) {
9397 __Pyx_XGIVEREF(__pyx_t_10);
9398 __Pyx_XGIVEREF(__pyx_t_11);
9399 __Pyx_XGIVEREF(__pyx_t_12);
9400 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
9402 __Pyx_XGIVEREF(__pyx_t_7);
9403 __Pyx_XGIVEREF(__pyx_t_8);
9404 __Pyx_XGIVEREF(__pyx_t_9);
9405 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
9406 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
9407 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
9408 goto __pyx_L1_error;
9422 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9425 __Pyx_XDECREF(__pyx_t_3);
9426 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
9429 __Pyx_XGIVEREF(__pyx_r);
9430 __Pyx_RefNannyFinishContext();
9442static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
9443 char *__pyx_v_itemp;
9444 PyObject *__pyx_r = NULL;
9445 __Pyx_RefNannyDeclarations
9447 PyObject *__pyx_t_2 = NULL;
9448 int __pyx_lineno = 0;
9449 const char *__pyx_filename = NULL;
9450 int __pyx_clineno = 0;
9451 __Pyx_RefNannySetupContext(
"setitem_indexed", 0);
9460 __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)
9461 __pyx_v_itemp = __pyx_t_1;
9470 __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)
9471 __Pyx_GOTREF(__pyx_t_2);
9472 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9483 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9486 __Pyx_XDECREF(__pyx_t_2);
9487 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
9490 __Pyx_XGIVEREF(__pyx_r);
9491 __Pyx_RefNannyFinishContext();
9503static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp) {
9504 PyObject *__pyx_v_struct = NULL;
9505 PyObject *__pyx_v_bytesitem = 0;
9506 PyObject *__pyx_v_result = NULL;
9507 PyObject *__pyx_r = NULL;
9508 __Pyx_RefNannyDeclarations
9509 PyObject *__pyx_t_1 = NULL;
9510 PyObject *__pyx_t_2 = NULL;
9511 PyObject *__pyx_t_3 = NULL;
9512 PyObject *__pyx_t_4 = NULL;
9513 PyObject *__pyx_t_5 = NULL;
9514 PyObject *__pyx_t_6 = NULL;
9515 PyObject *__pyx_t_7 = NULL;
9517 PyObject *__pyx_t_9 = NULL;
9520 int __pyx_lineno = 0;
9521 const char *__pyx_filename = NULL;
9522 int __pyx_clineno = 0;
9523 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
9532 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
9533 __Pyx_GOTREF(__pyx_t_1);
9534 __pyx_v_struct = __pyx_t_1;
9544 __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)
9545 __Pyx_GOTREF(__pyx_t_1);
9546 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
9557 __Pyx_PyThreadState_declare
9558 __Pyx_PyThreadState_assign
9559 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
9560 __Pyx_XGOTREF(__pyx_t_2);
9561 __Pyx_XGOTREF(__pyx_t_3);
9562 __Pyx_XGOTREF(__pyx_t_4);
9572 __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)
9573 __Pyx_GOTREF(__pyx_t_5);
9574 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
9575 __Pyx_GOTREF(__pyx_t_6);
9578 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
9579 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
9580 if (likely(__pyx_t_7)) {
9581 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9582 __Pyx_INCREF(__pyx_t_7);
9583 __Pyx_INCREF(function);
9584 __Pyx_DECREF_SET(__pyx_t_5, function);
9588 #if CYTHON_FAST_PYCALL
9589 if (PyFunction_Check(__pyx_t_5)) {
9590 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
9591 __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)
9592 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9593 __Pyx_GOTREF(__pyx_t_1);
9594 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9597 #if CYTHON_FAST_PYCCALL
9598 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
9599 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
9600 __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)
9601 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9602 __Pyx_GOTREF(__pyx_t_1);
9603 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9607 __pyx_t_9 = PyTuple_New(2+__pyx_t_8);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
9608 __Pyx_GOTREF(__pyx_t_9);
9610 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
9612 __Pyx_GIVEREF(__pyx_t_6);
9613 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
9614 __Pyx_INCREF(__pyx_v_bytesitem);
9615 __Pyx_GIVEREF(__pyx_v_bytesitem);
9616 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
9618 __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)
9619 __Pyx_GOTREF(__pyx_t_1);
9620 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9622 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9623 __pyx_v_result = __pyx_t_1;
9643 __pyx_t_10 = strlen(__pyx_v_self->view.format);
9644 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
9654 __Pyx_XDECREF(__pyx_r);
9655 __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)
9656 __Pyx_GOTREF(__pyx_t_1);
9657 __pyx_r = __pyx_t_1;
9659 goto __pyx_L6_except_return;
9677 __Pyx_XDECREF(__pyx_r);
9678 __Pyx_INCREF(__pyx_v_result);
9679 __pyx_r = __pyx_v_result;
9680 goto __pyx_L6_except_return;
9683 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9684 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9685 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9686 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9687 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
9696 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
9697 __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)
9698 __Pyx_GOTREF(__pyx_t_6);
9699 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
9700 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9701 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
9702 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
9704 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
9705 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
9706 __Pyx_GOTREF(__pyx_t_9);
9707 __Pyx_GOTREF(__pyx_t_5);
9708 __Pyx_GOTREF(__pyx_t_1);
9717 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
9718 __Pyx_GOTREF(__pyx_t_6);
9719 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
9720 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9721 __PYX_ERR(2, 495, __pyx_L5_except_error)
9723 goto __pyx_L5_except_error;
9724 __pyx_L5_except_error:;
9733 __Pyx_XGIVEREF(__pyx_t_2);
9734 __Pyx_XGIVEREF(__pyx_t_3);
9735 __Pyx_XGIVEREF(__pyx_t_4);
9736 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
9737 goto __pyx_L1_error;
9738 __pyx_L6_except_return:;
9739 __Pyx_XGIVEREF(__pyx_t_2);
9740 __Pyx_XGIVEREF(__pyx_t_3);
9741 __Pyx_XGIVEREF(__pyx_t_4);
9742 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
9756 __Pyx_XDECREF(__pyx_t_1);
9757 __Pyx_XDECREF(__pyx_t_5);
9758 __Pyx_XDECREF(__pyx_t_6);
9759 __Pyx_XDECREF(__pyx_t_7);
9760 __Pyx_XDECREF(__pyx_t_9);
9761 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
9764 __Pyx_XDECREF(__pyx_v_struct);
9765 __Pyx_XDECREF(__pyx_v_bytesitem);
9766 __Pyx_XDECREF(__pyx_v_result);
9767 __Pyx_XGIVEREF(__pyx_r);
9768 __Pyx_RefNannyFinishContext();
9780static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
9781 PyObject *__pyx_v_struct = NULL;
9783 PyObject *__pyx_v_bytesvalue = 0;
9784 Py_ssize_t __pyx_v_i;
9785 PyObject *__pyx_r = NULL;
9786 __Pyx_RefNannyDeclarations
9787 PyObject *__pyx_t_1 = NULL;
9790 PyObject *__pyx_t_4 = NULL;
9791 PyObject *__pyx_t_5 = NULL;
9792 PyObject *__pyx_t_6 = NULL;
9794 PyObject *__pyx_t_8 = NULL;
9795 Py_ssize_t __pyx_t_9;
9796 PyObject *__pyx_t_10 = NULL;
9801 int __pyx_lineno = 0;
9802 const char *__pyx_filename = NULL;
9803 int __pyx_clineno = 0;
9804 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
9813 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
9814 __Pyx_GOTREF(__pyx_t_1);
9815 __pyx_v_struct = __pyx_t_1;
9825 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
9826 __pyx_t_3 = (__pyx_t_2 != 0);
9836 __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)
9837 __Pyx_GOTREF(__pyx_t_1);
9838 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
9839 __Pyx_GOTREF(__pyx_t_4);
9840 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
9841 __Pyx_GOTREF(__pyx_t_5);
9842 __Pyx_GIVEREF(__pyx_t_4);
9843 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
9845 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
9846 __Pyx_GOTREF(__pyx_t_4);
9847 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
9848 __Pyx_GOTREF(__pyx_t_6);
9849 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9850 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9851 __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)
9852 __Pyx_GOTREF(__pyx_t_4);
9853 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9854 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9855 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)
9856 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
9877 __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)
9878 __Pyx_GOTREF(__pyx_t_6);
9879 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
9880 __Pyx_GOTREF(__pyx_t_1);
9883 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
9884 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
9885 if (likely(__pyx_t_5)) {
9886 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9887 __Pyx_INCREF(__pyx_t_5);
9888 __Pyx_INCREF(function);
9889 __Pyx_DECREF_SET(__pyx_t_6, function);
9893 #if CYTHON_FAST_PYCALL
9894 if (PyFunction_Check(__pyx_t_6)) {
9895 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
9896 __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)
9897 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9898 __Pyx_GOTREF(__pyx_t_4);
9899 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9902 #if CYTHON_FAST_PYCCALL
9903 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
9904 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
9905 __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)
9906 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9907 __Pyx_GOTREF(__pyx_t_4);
9908 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9912 __pyx_t_8 = PyTuple_New(2+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
9913 __Pyx_GOTREF(__pyx_t_8);
9915 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
9917 __Pyx_GIVEREF(__pyx_t_1);
9918 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
9919 __Pyx_INCREF(__pyx_v_value);
9920 __Pyx_GIVEREF(__pyx_v_value);
9921 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
9923 __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)
9924 __Pyx_GOTREF(__pyx_t_4);
9925 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9927 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9928 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)
9929 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
9942 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
9943 PyErr_SetString(PyExc_TypeError,
"'NoneType' is not iterable");
9944 __PYX_ERR(2, 514, __pyx_L1_error)
9946 __Pyx_INCREF(__pyx_v_bytesvalue);
9947 __pyx_t_10 = __pyx_v_bytesvalue;
9948 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
9949 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
9950 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
9951 __pyx_t_11 = __pyx_t_14;
9952 __pyx_v_c = (__pyx_t_11[0]);
9961 __pyx_v_i = __pyx_t_9;
9970 __pyx_t_9 = (__pyx_t_9 + 1);
9979 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
9981 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9992 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9995 __Pyx_XDECREF(__pyx_t_1);
9996 __Pyx_XDECREF(__pyx_t_4);
9997 __Pyx_XDECREF(__pyx_t_5);
9998 __Pyx_XDECREF(__pyx_t_6);
9999 __Pyx_XDECREF(__pyx_t_8);
10000 __Pyx_XDECREF(__pyx_t_10);
10001 __Pyx_AddTraceback(
"View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
10004 __Pyx_XDECREF(__pyx_v_struct);
10005 __Pyx_XDECREF(__pyx_v_bytesvalue);
10006 __Pyx_XGIVEREF(__pyx_r);
10007 __Pyx_RefNannyFinishContext();
10020static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
10021static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
10023 __Pyx_RefNannyDeclarations
10024 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
10025 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
10028 __Pyx_RefNannyFinishContext();
10032static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
10034 __Pyx_RefNannyDeclarations
10037 PyObject *__pyx_t_3 = NULL;
10038 Py_ssize_t *__pyx_t_4;
10042 Py_ssize_t __pyx_t_8;
10043 int __pyx_lineno = 0;
10044 const char *__pyx_filename = NULL;
10045 int __pyx_clineno = 0;
10046 if (__pyx_v_info == NULL) {
10047 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
10050 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
10051 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
10052 __Pyx_GIVEREF(__pyx_v_info->obj);
10061 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
10064 __pyx_t_1 = __pyx_t_2;
10065 goto __pyx_L4_bool_binop_done;
10067 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
10068 __pyx_t_1 = __pyx_t_2;
10069 __pyx_L4_bool_binop_done:;
10070 if (unlikely(__pyx_t_1)) {
10079 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
10080 __Pyx_GOTREF(__pyx_t_3);
10081 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10082 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10083 __PYX_ERR(2, 520, __pyx_L1_error)
10101 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
10111 __pyx_t_4 = __pyx_v_self->view.shape;
10112 __pyx_v_info->shape = __pyx_t_4;
10132 __pyx_v_info->shape = NULL;
10143 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
10153 __pyx_t_4 = __pyx_v_self->view.strides;
10154 __pyx_v_info->strides = __pyx_t_4;
10174 __pyx_v_info->strides = NULL;
10185 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
10195 __pyx_t_4 = __pyx_v_self->view.suboffsets;
10196 __pyx_v_info->suboffsets = __pyx_t_4;
10216 __pyx_v_info->suboffsets = NULL;
10227 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10237 __pyx_t_5 = __pyx_v_self->view.format;
10238 __pyx_v_info->format = __pyx_t_5;
10258 __pyx_v_info->format = NULL;
10269 __pyx_t_6 = __pyx_v_self->view.buf;
10270 __pyx_v_info->buf = __pyx_t_6;
10279 __pyx_t_7 = __pyx_v_self->view.ndim;
10280 __pyx_v_info->ndim = __pyx_t_7;
10289 __pyx_t_8 = __pyx_v_self->view.itemsize;
10290 __pyx_v_info->itemsize = __pyx_t_8;
10299 __pyx_t_8 = __pyx_v_self->view.len;
10300 __pyx_v_info->len = __pyx_t_8;
10309 __pyx_t_1 = __pyx_v_self->view.readonly;
10310 __pyx_v_info->readonly = __pyx_t_1;
10319 __Pyx_INCREF(((PyObject *)__pyx_v_self));
10320 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
10321 __Pyx_GOTREF(__pyx_v_info->obj);
10322 __Pyx_DECREF(__pyx_v_info->obj);
10323 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
10337 __Pyx_XDECREF(__pyx_t_3);
10338 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10340 if (__pyx_v_info->obj != NULL) {
10341 __Pyx_GOTREF(__pyx_v_info->obj);
10342 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
10346 if (__pyx_v_info->obj == Py_None) {
10347 __Pyx_GOTREF(__pyx_v_info->obj);
10348 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
10351 __Pyx_RefNannyFinishContext();
10364static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self);
10365static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
10366 PyObject *__pyx_r = 0;
10367 __Pyx_RefNannyDeclarations
10368 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10369 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10372 __Pyx_RefNannyFinishContext();
10376static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10377 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
10378 PyObject *__pyx_r = NULL;
10379 __Pyx_RefNannyDeclarations
10380 PyObject *__pyx_t_1 = NULL;
10382 int __pyx_lineno = 0;
10383 const char *__pyx_filename = NULL;
10384 int __pyx_clineno = 0;
10385 __Pyx_RefNannySetupContext(
"__get__", 0);
10394 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
10395 __Pyx_GOTREF(__pyx_t_1);
10396 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
10397 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_1);
10407 __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)
10416 __Pyx_XDECREF(__pyx_r);
10417 __Pyx_INCREF(((PyObject *)__pyx_v_result));
10418 __pyx_r = ((PyObject *)__pyx_v_result);
10431 __Pyx_XDECREF(__pyx_t_1);
10432 __Pyx_AddTraceback(
"View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10435 __Pyx_XDECREF((PyObject *)__pyx_v_result);
10436 __Pyx_XGIVEREF(__pyx_r);
10437 __Pyx_RefNannyFinishContext();
10450static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self);
10451static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
10452 PyObject *__pyx_r = 0;
10453 __Pyx_RefNannyDeclarations
10454 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10455 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10458 __Pyx_RefNannyFinishContext();
10462static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10463 PyObject *__pyx_r = NULL;
10464 __Pyx_RefNannyDeclarations
10465 __Pyx_RefNannySetupContext(
"__get__", 0);
10474 __Pyx_XDECREF(__pyx_r);
10475 __Pyx_INCREF(__pyx_v_self->obj);
10476 __pyx_r = __pyx_v_self->obj;
10489 __Pyx_XGIVEREF(__pyx_r);
10490 __Pyx_RefNannyFinishContext();
10503static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self);
10504static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
10505 PyObject *__pyx_r = 0;
10506 __Pyx_RefNannyDeclarations
10507 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10508 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10511 __Pyx_RefNannyFinishContext();
10515static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10516 Py_ssize_t __pyx_v_length;
10517 PyObject *__pyx_r = NULL;
10518 __Pyx_RefNannyDeclarations
10519 PyObject *__pyx_t_1 = NULL;
10520 Py_ssize_t *__pyx_t_2;
10521 Py_ssize_t *__pyx_t_3;
10522 Py_ssize_t *__pyx_t_4;
10523 PyObject *__pyx_t_5 = NULL;
10524 int __pyx_lineno = 0;
10525 const char *__pyx_filename = NULL;
10526 int __pyx_clineno = 0;
10527 __Pyx_RefNannySetupContext(
"__get__", 0);
10536 __Pyx_XDECREF(__pyx_r);
10537 __pyx_t_1 = PyList_New(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
10538 __Pyx_GOTREF(__pyx_t_1);
10539 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
10540 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
10541 __pyx_t_2 = __pyx_t_4;
10542 __pyx_v_length = (__pyx_t_2[0]);
10543 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
10544 __Pyx_GOTREF(__pyx_t_5);
10545 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
10546 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10548 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1));
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
10549 __Pyx_GOTREF(__pyx_t_5);
10550 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10551 __pyx_r = __pyx_t_5;
10565 __Pyx_XDECREF(__pyx_t_1);
10566 __Pyx_XDECREF(__pyx_t_5);
10567 __Pyx_AddTraceback(
"View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10570 __Pyx_XGIVEREF(__pyx_r);
10571 __Pyx_RefNannyFinishContext();
10584static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self);
10585static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
10586 PyObject *__pyx_r = 0;
10587 __Pyx_RefNannyDeclarations
10588 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10589 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10592 __Pyx_RefNannyFinishContext();
10596static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10597 Py_ssize_t __pyx_v_stride;
10598 PyObject *__pyx_r = NULL;
10599 __Pyx_RefNannyDeclarations
10601 PyObject *__pyx_t_2 = NULL;
10602 Py_ssize_t *__pyx_t_3;
10603 Py_ssize_t *__pyx_t_4;
10604 Py_ssize_t *__pyx_t_5;
10605 PyObject *__pyx_t_6 = NULL;
10606 int __pyx_lineno = 0;
10607 const char *__pyx_filename = NULL;
10608 int __pyx_clineno = 0;
10609 __Pyx_RefNannySetupContext(
"__get__", 0);
10618 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
10619 if (unlikely(__pyx_t_1)) {
10628 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
10629 __Pyx_GOTREF(__pyx_t_2);
10630 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10631 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10632 __PYX_ERR(2, 570, __pyx_L1_error)
10650 __Pyx_XDECREF(__pyx_r);
10651 __pyx_t_2 = PyList_New(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
10652 __Pyx_GOTREF(__pyx_t_2);
10653 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
10654 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
10655 __pyx_t_3 = __pyx_t_5;
10656 __pyx_v_stride = (__pyx_t_3[0]);
10657 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
10658 __Pyx_GOTREF(__pyx_t_6);
10659 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
10660 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10662 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
10663 __Pyx_GOTREF(__pyx_t_6);
10664 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10665 __pyx_r = __pyx_t_6;
10679 __Pyx_XDECREF(__pyx_t_2);
10680 __Pyx_XDECREF(__pyx_t_6);
10681 __Pyx_AddTraceback(
"View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10684 __Pyx_XGIVEREF(__pyx_r);
10685 __Pyx_RefNannyFinishContext();
10698static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self);
10699static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
10700 PyObject *__pyx_r = 0;
10701 __Pyx_RefNannyDeclarations
10702 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10703 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10706 __Pyx_RefNannyFinishContext();
10710static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10711 Py_ssize_t __pyx_v_suboffset;
10712 PyObject *__pyx_r = NULL;
10713 __Pyx_RefNannyDeclarations
10715 PyObject *__pyx_t_2 = NULL;
10716 PyObject *__pyx_t_3 = NULL;
10717 Py_ssize_t *__pyx_t_4;
10718 Py_ssize_t *__pyx_t_5;
10719 Py_ssize_t *__pyx_t_6;
10720 int __pyx_lineno = 0;
10721 const char *__pyx_filename = NULL;
10722 int __pyx_clineno = 0;
10723 __Pyx_RefNannySetupContext(
"__get__", 0);
10732 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
10742 __Pyx_XDECREF(__pyx_r);
10743 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
10744 __Pyx_GOTREF(__pyx_t_2);
10745 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__15, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
10746 __Pyx_GOTREF(__pyx_t_3);
10747 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10748 __pyx_r = __pyx_t_3;
10768 __Pyx_XDECREF(__pyx_r);
10769 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
10770 __Pyx_GOTREF(__pyx_t_3);
10771 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
10772 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
10773 __pyx_t_4 = __pyx_t_6;
10774 __pyx_v_suboffset = (__pyx_t_4[0]);
10775 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
10776 __Pyx_GOTREF(__pyx_t_2);
10777 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
10778 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10780 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
10781 __Pyx_GOTREF(__pyx_t_2);
10782 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10783 __pyx_r = __pyx_t_2;
10797 __Pyx_XDECREF(__pyx_t_2);
10798 __Pyx_XDECREF(__pyx_t_3);
10799 __Pyx_AddTraceback(
"View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10802 __Pyx_XGIVEREF(__pyx_r);
10803 __Pyx_RefNannyFinishContext();
10816static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self);
10817static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
10818 PyObject *__pyx_r = 0;
10819 __Pyx_RefNannyDeclarations
10820 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10821 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10824 __Pyx_RefNannyFinishContext();
10828static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10829 PyObject *__pyx_r = NULL;
10830 __Pyx_RefNannyDeclarations
10831 PyObject *__pyx_t_1 = NULL;
10832 int __pyx_lineno = 0;
10833 const char *__pyx_filename = NULL;
10834 int __pyx_clineno = 0;
10835 __Pyx_RefNannySetupContext(
"__get__", 0);
10844 __Pyx_XDECREF(__pyx_r);
10845 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
10846 __Pyx_GOTREF(__pyx_t_1);
10847 __pyx_r = __pyx_t_1;
10861 __Pyx_XDECREF(__pyx_t_1);
10862 __Pyx_AddTraceback(
"View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10865 __Pyx_XGIVEREF(__pyx_r);
10866 __Pyx_RefNannyFinishContext();
10879static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self);
10880static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
10881 PyObject *__pyx_r = 0;
10882 __Pyx_RefNannyDeclarations
10883 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10884 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10887 __Pyx_RefNannyFinishContext();
10891static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10892 PyObject *__pyx_r = NULL;
10893 __Pyx_RefNannyDeclarations
10894 PyObject *__pyx_t_1 = NULL;
10895 int __pyx_lineno = 0;
10896 const char *__pyx_filename = NULL;
10897 int __pyx_clineno = 0;
10898 __Pyx_RefNannySetupContext(
"__get__", 0);
10907 __Pyx_XDECREF(__pyx_r);
10908 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
10909 __Pyx_GOTREF(__pyx_t_1);
10910 __pyx_r = __pyx_t_1;
10924 __Pyx_XDECREF(__pyx_t_1);
10925 __Pyx_AddTraceback(
"View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10928 __Pyx_XGIVEREF(__pyx_r);
10929 __Pyx_RefNannyFinishContext();
10942static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self);
10943static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
10944 PyObject *__pyx_r = 0;
10945 __Pyx_RefNannyDeclarations
10946 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
10947 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10950 __Pyx_RefNannyFinishContext();
10954static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10955 PyObject *__pyx_r = NULL;
10956 __Pyx_RefNannyDeclarations
10957 PyObject *__pyx_t_1 = NULL;
10958 PyObject *__pyx_t_2 = NULL;
10959 PyObject *__pyx_t_3 = NULL;
10960 int __pyx_lineno = 0;
10961 const char *__pyx_filename = NULL;
10962 int __pyx_clineno = 0;
10963 __Pyx_RefNannySetupContext(
"__get__", 0);
10972 __Pyx_XDECREF(__pyx_r);
10973 __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)
10974 __Pyx_GOTREF(__pyx_t_1);
10975 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
10976 __Pyx_GOTREF(__pyx_t_2);
10977 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
10978 __Pyx_GOTREF(__pyx_t_3);
10979 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10980 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10981 __pyx_r = __pyx_t_3;
10995 __Pyx_XDECREF(__pyx_t_1);
10996 __Pyx_XDECREF(__pyx_t_2);
10997 __Pyx_XDECREF(__pyx_t_3);
10998 __Pyx_AddTraceback(
"View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11001 __Pyx_XGIVEREF(__pyx_r);
11002 __Pyx_RefNannyFinishContext();
11015static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self);
11016static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
11017 PyObject *__pyx_r = 0;
11018 __Pyx_RefNannyDeclarations
11019 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11020 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11023 __Pyx_RefNannyFinishContext();
11027static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11028 PyObject *__pyx_v_result = NULL;
11029 PyObject *__pyx_v_length = NULL;
11030 PyObject *__pyx_r = NULL;
11031 __Pyx_RefNannyDeclarations
11034 Py_ssize_t *__pyx_t_3;
11035 Py_ssize_t *__pyx_t_4;
11036 Py_ssize_t *__pyx_t_5;
11037 PyObject *__pyx_t_6 = NULL;
11038 int __pyx_lineno = 0;
11039 const char *__pyx_filename = NULL;
11040 int __pyx_clineno = 0;
11041 __Pyx_RefNannySetupContext(
"__get__", 0);
11050 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
11051 __pyx_t_2 = (__pyx_t_1 != 0);
11061 __Pyx_INCREF(__pyx_int_1);
11062 __pyx_v_result = __pyx_int_1;
11071 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
11072 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
11073 __pyx_t_3 = __pyx_t_5;
11074 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0]));
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
11075 __Pyx_GOTREF(__pyx_t_6);
11076 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
11086 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
11087 __Pyx_GOTREF(__pyx_t_6);
11088 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
11099 __Pyx_INCREF(__pyx_v_result);
11100 __Pyx_GIVEREF(__pyx_v_result);
11101 __Pyx_GOTREF(__pyx_v_self->_size);
11102 __Pyx_DECREF(__pyx_v_self->_size);
11103 __pyx_v_self->_size = __pyx_v_result;
11121 __Pyx_XDECREF(__pyx_r);
11122 __Pyx_INCREF(__pyx_v_self->_size);
11123 __pyx_r = __pyx_v_self->_size;
11136 __Pyx_XDECREF(__pyx_t_6);
11137 __Pyx_AddTraceback(
"View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11140 __Pyx_XDECREF(__pyx_v_result);
11141 __Pyx_XDECREF(__pyx_v_length);
11142 __Pyx_XGIVEREF(__pyx_r);
11143 __Pyx_RefNannyFinishContext();
11156static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self);
11157static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
11158 Py_ssize_t __pyx_r;
11159 __Pyx_RefNannyDeclarations
11160 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
11161 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11164 __Pyx_RefNannyFinishContext();
11168static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11169 Py_ssize_t __pyx_r;
11170 __Pyx_RefNannyDeclarations
11172 __Pyx_RefNannySetupContext(
"__len__", 0);
11181 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
11191 __pyx_r = (__pyx_v_self->view.shape[0]);
11223 __Pyx_RefNannyFinishContext();
11236static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self);
11237static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
11238 PyObject *__pyx_r = 0;
11239 __Pyx_RefNannyDeclarations
11240 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
11241 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11244 __Pyx_RefNannyFinishContext();
11248static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11249 PyObject *__pyx_r = NULL;
11250 __Pyx_RefNannyDeclarations
11251 PyObject *__pyx_t_1 = NULL;
11252 PyObject *__pyx_t_2 = NULL;
11253 PyObject *__pyx_t_3 = NULL;
11254 int __pyx_lineno = 0;
11255 const char *__pyx_filename = NULL;
11256 int __pyx_clineno = 0;
11257 __Pyx_RefNannySetupContext(
"__repr__", 0);
11266 __Pyx_XDECREF(__pyx_r);
11267 __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)
11268 __Pyx_GOTREF(__pyx_t_1);
11269 __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)
11270 __Pyx_GOTREF(__pyx_t_2);
11271 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11272 __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)
11273 __Pyx_GOTREF(__pyx_t_1);
11274 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11283 __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)
11284 __Pyx_GOTREF(__pyx_t_2);
11293 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
11294 __Pyx_GOTREF(__pyx_t_3);
11295 __Pyx_GIVEREF(__pyx_t_1);
11296 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
11297 __Pyx_GIVEREF(__pyx_t_2);
11298 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
11301 __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)
11302 __Pyx_GOTREF(__pyx_t_2);
11303 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11304 __pyx_r = __pyx_t_2;
11318 __Pyx_XDECREF(__pyx_t_1);
11319 __Pyx_XDECREF(__pyx_t_2);
11320 __Pyx_XDECREF(__pyx_t_3);
11321 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11324 __Pyx_XGIVEREF(__pyx_r);
11325 __Pyx_RefNannyFinishContext();
11338static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self);
11339static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
11340 PyObject *__pyx_r = 0;
11341 __Pyx_RefNannyDeclarations
11342 __Pyx_RefNannySetupContext(
"__str__ (wrapper)", 0);
11343 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11346 __Pyx_RefNannyFinishContext();
11350static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11351 PyObject *__pyx_r = NULL;
11352 __Pyx_RefNannyDeclarations
11353 PyObject *__pyx_t_1 = NULL;
11354 PyObject *__pyx_t_2 = NULL;
11355 int __pyx_lineno = 0;
11356 const char *__pyx_filename = NULL;
11357 int __pyx_clineno = 0;
11358 __Pyx_RefNannySetupContext(
"__str__", 0);
11367 __Pyx_XDECREF(__pyx_r);
11368 __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)
11369 __Pyx_GOTREF(__pyx_t_1);
11370 __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)
11371 __Pyx_GOTREF(__pyx_t_2);
11372 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11373 __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)
11374 __Pyx_GOTREF(__pyx_t_1);
11375 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11376 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
11377 __Pyx_GOTREF(__pyx_t_2);
11378 __Pyx_GIVEREF(__pyx_t_1);
11379 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
11381 __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)
11382 __Pyx_GOTREF(__pyx_t_1);
11383 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11384 __pyx_r = __pyx_t_1;
11398 __Pyx_XDECREF(__pyx_t_1);
11399 __Pyx_XDECREF(__pyx_t_2);
11400 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11403 __Pyx_XGIVEREF(__pyx_r);
11404 __Pyx_RefNannyFinishContext();
11417static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11418static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11419 PyObject *__pyx_r = 0;
11420 __Pyx_RefNannyDeclarations
11421 __Pyx_RefNannySetupContext(
"is_c_contig (wrapper)", 0);
11422 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11425 __Pyx_RefNannyFinishContext();
11429static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
11430 __Pyx_memviewslice *__pyx_v_mslice;
11431 __Pyx_memviewslice __pyx_v_tmp;
11432 PyObject *__pyx_r = NULL;
11433 __Pyx_RefNannyDeclarations
11434 __Pyx_memviewslice *__pyx_t_1;
11435 PyObject *__pyx_t_2 = NULL;
11436 int __pyx_lineno = 0;
11437 const char *__pyx_filename = NULL;
11438 int __pyx_clineno = 0;
11439 __Pyx_RefNannySetupContext(
"is_c_contig", 0);
11448 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 622, __pyx_L1_error)
11449 __pyx_v_mslice = __pyx_t_1;
11458 __Pyx_XDECREF(__pyx_r);
11459 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'C', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 623, __pyx_L1_error)
11460 __Pyx_GOTREF(__pyx_t_2);
11461 __pyx_r = __pyx_t_2;
11475 __Pyx_XDECREF(__pyx_t_2);
11476 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
11479 __Pyx_XGIVEREF(__pyx_r);
11480 __Pyx_RefNannyFinishContext();
11493static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11494static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11495 PyObject *__pyx_r = 0;
11496 __Pyx_RefNannyDeclarations
11497 __Pyx_RefNannySetupContext(
"is_f_contig (wrapper)", 0);
11498 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11501 __Pyx_RefNannyFinishContext();
11505static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
11506 __Pyx_memviewslice *__pyx_v_mslice;
11507 __Pyx_memviewslice __pyx_v_tmp;
11508 PyObject *__pyx_r = NULL;
11509 __Pyx_RefNannyDeclarations
11510 __Pyx_memviewslice *__pyx_t_1;
11511 PyObject *__pyx_t_2 = NULL;
11512 int __pyx_lineno = 0;
11513 const char *__pyx_filename = NULL;
11514 int __pyx_clineno = 0;
11515 __Pyx_RefNannySetupContext(
"is_f_contig", 0);
11524 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 628, __pyx_L1_error)
11525 __pyx_v_mslice = __pyx_t_1;
11534 __Pyx_XDECREF(__pyx_r);
11535 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'F', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 629, __pyx_L1_error)
11536 __Pyx_GOTREF(__pyx_t_2);
11537 __pyx_r = __pyx_t_2;
11551 __Pyx_XDECREF(__pyx_t_2);
11552 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
11555 __Pyx_XGIVEREF(__pyx_r);
11556 __Pyx_RefNannyFinishContext();
11569static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11570static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11571 PyObject *__pyx_r = 0;
11572 __Pyx_RefNannyDeclarations
11573 __Pyx_RefNannySetupContext(
"copy (wrapper)", 0);
11574 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11577 __Pyx_RefNannyFinishContext();
11581static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self) {
11582 __Pyx_memviewslice __pyx_v_mslice;
11584 PyObject *__pyx_r = NULL;
11585 __Pyx_RefNannyDeclarations
11586 __Pyx_memviewslice __pyx_t_1;
11587 PyObject *__pyx_t_2 = NULL;
11588 int __pyx_lineno = 0;
11589 const char *__pyx_filename = NULL;
11590 int __pyx_clineno = 0;
11591 __Pyx_RefNannySetupContext(
"copy", 0);
11600 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
11609 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
11618 __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)
11619 __pyx_v_mslice = __pyx_t_1;
11628 __Pyx_XDECREF(__pyx_r);
11629 __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)
11630 __Pyx_GOTREF(__pyx_t_2);
11631 __pyx_r = __pyx_t_2;
11645 __Pyx_XDECREF(__pyx_t_2);
11646 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
11649 __Pyx_XGIVEREF(__pyx_r);
11650 __Pyx_RefNannyFinishContext();
11663static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11664static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11665 PyObject *__pyx_r = 0;
11666 __Pyx_RefNannyDeclarations
11667 __Pyx_RefNannySetupContext(
"copy_fortran (wrapper)", 0);
11668 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11671 __Pyx_RefNannyFinishContext();
11675static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self) {
11676 __Pyx_memviewslice __pyx_v_src;
11677 __Pyx_memviewslice __pyx_v_dst;
11679 PyObject *__pyx_r = NULL;
11680 __Pyx_RefNannyDeclarations
11681 __Pyx_memviewslice __pyx_t_1;
11682 PyObject *__pyx_t_2 = NULL;
11683 int __pyx_lineno = 0;
11684 const char *__pyx_filename = NULL;
11685 int __pyx_clineno = 0;
11686 __Pyx_RefNannySetupContext(
"copy_fortran", 0);
11695 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
11704 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
11713 __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)
11714 __pyx_v_dst = __pyx_t_1;
11723 __Pyx_XDECREF(__pyx_r);
11724 __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)
11725 __Pyx_GOTREF(__pyx_t_2);
11726 __pyx_r = __pyx_t_2;
11740 __Pyx_XDECREF(__pyx_t_2);
11741 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
11744 __Pyx_XGIVEREF(__pyx_r);
11745 __Pyx_RefNannyFinishContext();
11756static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11757static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11758 PyObject *__pyx_r = 0;
11759 __Pyx_RefNannyDeclarations
11760 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
11761 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11764 __Pyx_RefNannyFinishContext();
11768static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self) {
11769 PyObject *__pyx_r = NULL;
11770 __Pyx_RefNannyDeclarations
11771 PyObject *__pyx_t_1 = NULL;
11772 int __pyx_lineno = 0;
11773 const char *__pyx_filename = NULL;
11774 int __pyx_clineno = 0;
11775 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
11783 __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)
11784 __Pyx_GOTREF(__pyx_t_1);
11785 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11786 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11787 __PYX_ERR(2, 2, __pyx_L1_error)
11797 __Pyx_XDECREF(__pyx_t_1);
11798 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11800 __Pyx_XGIVEREF(__pyx_r);
11801 __Pyx_RefNannyFinishContext();
11813static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
11814static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11815 PyObject *__pyx_r = 0;
11816 __Pyx_RefNannyDeclarations
11817 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
11818 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
11821 __Pyx_RefNannyFinishContext();
11825static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
11826 PyObject *__pyx_r = NULL;
11827 __Pyx_RefNannyDeclarations
11828 PyObject *__pyx_t_1 = NULL;
11829 int __pyx_lineno = 0;
11830 const char *__pyx_filename = NULL;
11831 int __pyx_clineno = 0;
11832 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
11839 __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)
11840 __Pyx_GOTREF(__pyx_t_1);
11841 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11842 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11843 __PYX_ERR(2, 4, __pyx_L1_error)
11854 __Pyx_XDECREF(__pyx_t_1);
11855 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11857 __Pyx_XGIVEREF(__pyx_r);
11858 __Pyx_RefNannyFinishContext();
11870static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o,
int __pyx_v_flags,
int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
11871 struct __pyx_memoryview_obj *__pyx_v_result = 0;
11872 PyObject *__pyx_r = NULL;
11873 __Pyx_RefNannyDeclarations
11874 PyObject *__pyx_t_1 = NULL;
11875 PyObject *__pyx_t_2 = NULL;
11876 PyObject *__pyx_t_3 = NULL;
11877 int __pyx_lineno = 0;
11878 const char *__pyx_filename = NULL;
11879 int __pyx_clineno = 0;
11880 __Pyx_RefNannySetupContext(
"memoryview_cwrapper", 0);
11889 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
11890 __Pyx_GOTREF(__pyx_t_1);
11891 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
11892 __Pyx_GOTREF(__pyx_t_2);
11893 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
11894 __Pyx_GOTREF(__pyx_t_3);
11895 __Pyx_INCREF(__pyx_v_o);
11896 __Pyx_GIVEREF(__pyx_v_o);
11897 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
11898 __Pyx_GIVEREF(__pyx_t_1);
11899 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
11900 __Pyx_GIVEREF(__pyx_t_2);
11901 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
11904 __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)
11905 __Pyx_GOTREF(__pyx_t_2);
11906 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11907 __pyx_v_result = ((
struct __pyx_memoryview_obj *)__pyx_t_2);
11917 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
11926 __Pyx_XDECREF(__pyx_r);
11927 __Pyx_INCREF(((PyObject *)__pyx_v_result));
11928 __pyx_r = ((PyObject *)__pyx_v_result);
11941 __Pyx_XDECREF(__pyx_t_1);
11942 __Pyx_XDECREF(__pyx_t_2);
11943 __Pyx_XDECREF(__pyx_t_3);
11944 __Pyx_AddTraceback(
"View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
11947 __Pyx_XDECREF((PyObject *)__pyx_v_result);
11948 __Pyx_XGIVEREF(__pyx_r);
11949 __Pyx_RefNannyFinishContext();
11961static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *__pyx_v_o) {
11963 __Pyx_RefNannyDeclarations
11965 __Pyx_RefNannySetupContext(
"memoryview_check", 0);
11974 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
11975 __pyx_r = __pyx_t_1;
11988 __Pyx_RefNannyFinishContext();
12000static PyObject *_unellipsify(PyObject *__pyx_v_index,
int __pyx_v_ndim) {
12001 PyObject *__pyx_v_tup = NULL;
12002 PyObject *__pyx_v_result = NULL;
12003 int __pyx_v_have_slices;
12004 int __pyx_v_seen_ellipsis;
12005 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
12006 PyObject *__pyx_v_item = NULL;
12007 Py_ssize_t __pyx_v_nslices;
12008 PyObject *__pyx_r = NULL;
12009 __Pyx_RefNannyDeclarations
12012 PyObject *__pyx_t_3 = NULL;
12013 PyObject *__pyx_t_4 = NULL;
12014 Py_ssize_t __pyx_t_5;
12015 PyObject *(*__pyx_t_6)(PyObject *);
12016 PyObject *__pyx_t_7 = NULL;
12017 Py_ssize_t __pyx_t_8;
12020 PyObject *__pyx_t_11 = NULL;
12021 int __pyx_lineno = 0;
12022 const char *__pyx_filename = NULL;
12023 int __pyx_clineno = 0;
12024 __Pyx_RefNannySetupContext(
"_unellipsify", 0);
12033 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
12034 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
12044 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
12045 __Pyx_GOTREF(__pyx_t_3);
12046 __Pyx_INCREF(__pyx_v_index);
12047 __Pyx_GIVEREF(__pyx_v_index);
12048 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
12049 __pyx_v_tup = __pyx_t_3;
12070 __Pyx_INCREF(__pyx_v_index);
12071 __pyx_v_tup = __pyx_v_index;
12082 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
12083 __Pyx_GOTREF(__pyx_t_3);
12084 __pyx_v_result = ((PyObject*)__pyx_t_3);
12094 __pyx_v_have_slices = 0;
12103 __pyx_v_seen_ellipsis = 0;
12112 __Pyx_INCREF(__pyx_int_0);
12113 __pyx_t_3 = __pyx_int_0;
12114 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
12115 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
12118 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
12119 __Pyx_GOTREF(__pyx_t_4);
12120 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
12123 if (likely(!__pyx_t_6)) {
12124 if (likely(PyList_CheckExact(__pyx_t_4))) {
12125 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4))
break;
12126 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12127 __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)
12129 __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)
12130 __Pyx_GOTREF(__pyx_t_7);
12133 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
12134 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12135 __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)
12137 __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)
12138 __Pyx_GOTREF(__pyx_t_7);
12142 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
12143 if (unlikely(!__pyx_t_7)) {
12144 PyObject* exc_type = PyErr_Occurred();
12146 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12147 else __PYX_ERR(2, 679, __pyx_L1_error)
12151 __Pyx_GOTREF(__pyx_t_7);
12153 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
12155 __Pyx_INCREF(__pyx_t_3);
12156 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
12157 __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)
12158 __Pyx_GOTREF(__pyx_t_7);
12159 __Pyx_DECREF(__pyx_t_3);
12160 __pyx_t_3 = __pyx_t_7;
12170 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
12171 __pyx_t_1 = (__pyx_t_2 != 0);
12181 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
12191 __pyx_t_8 = PyObject_Length(__pyx_v_tup);
if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
12192 __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)
12193 __Pyx_GOTREF(__pyx_t_7);
12194 { Py_ssize_t __pyx_temp;
12195 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
12196 __Pyx_INCREF(__pyx_slice_);
12197 __Pyx_GIVEREF(__pyx_slice_);
12198 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice_);
12201 __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)
12202 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12211 __pyx_v_seen_ellipsis = 1;
12231 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice_);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
12242 __pyx_v_have_slices = 1;
12262 __pyx_t_2 = PySlice_Check(__pyx_v_item);
12263 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
12266 __pyx_t_1 = __pyx_t_10;
12267 goto __pyx_L9_bool_binop_done;
12269 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
12270 __pyx_t_1 = __pyx_t_10;
12271 __pyx_L9_bool_binop_done:;
12272 if (unlikely(__pyx_t_1)) {
12281 __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)
12282 __Pyx_GOTREF(__pyx_t_7);
12283 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7);
if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
12284 __Pyx_GOTREF(__pyx_t_11);
12285 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12286 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
12287 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
12288 __PYX_ERR(2, 689, __pyx_L1_error)
12306 __pyx_t_10 = (__pyx_v_have_slices != 0);
12309 __pyx_t_1 = __pyx_t_10;
12310 goto __pyx_L11_bool_binop_done;
12312 __pyx_t_10 = PySlice_Check(__pyx_v_item);
12313 __pyx_t_2 = (__pyx_t_10 != 0);
12314 __pyx_t_1 = __pyx_t_2;
12315 __pyx_L11_bool_binop_done:;
12316 __pyx_v_have_slices = __pyx_t_1;
12325 __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)
12337 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12338 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12347 __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)
12348 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
12357 __pyx_t_1 = (__pyx_v_nslices != 0);
12367 __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)
12368 __Pyx_GOTREF(__pyx_t_3);
12369 { Py_ssize_t __pyx_temp;
12370 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
12371 __Pyx_INCREF(__pyx_slice_);
12372 __Pyx_GIVEREF(__pyx_slice_);
12373 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice_);
12376 __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)
12377 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12395 __Pyx_XDECREF(__pyx_r);
12396 if (!__pyx_v_have_slices) {
12398 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
12399 __Pyx_GOTREF(__pyx_t_4);
12400 __pyx_t_3 = __pyx_t_4;
12402 goto __pyx_L14_bool_binop_done;
12404 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
12405 __Pyx_GOTREF(__pyx_t_4);
12406 __pyx_t_3 = __pyx_t_4;
12408 __pyx_L14_bool_binop_done:;
12409 __pyx_t_4 = PyList_AsTuple(__pyx_v_result);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
12410 __Pyx_GOTREF(__pyx_t_4);
12411 __pyx_t_11 = PyTuple_New(2);
if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
12412 __Pyx_GOTREF(__pyx_t_11);
12413 __Pyx_GIVEREF(__pyx_t_3);
12414 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
12415 __Pyx_GIVEREF(__pyx_t_4);
12416 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
12419 __pyx_r = ((PyObject*)__pyx_t_11);
12433 __Pyx_XDECREF(__pyx_t_3);
12434 __Pyx_XDECREF(__pyx_t_4);
12435 __Pyx_XDECREF(__pyx_t_7);
12436 __Pyx_XDECREF(__pyx_t_11);
12437 __Pyx_AddTraceback(
"View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
12440 __Pyx_XDECREF(__pyx_v_tup);
12441 __Pyx_XDECREF(__pyx_v_result);
12442 __Pyx_XDECREF(__pyx_v_idx);
12443 __Pyx_XDECREF(__pyx_v_item);
12444 __Pyx_XGIVEREF(__pyx_r);
12445 __Pyx_RefNannyFinishContext();
12457static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets,
int __pyx_v_ndim) {
12458 Py_ssize_t __pyx_v_suboffset;
12459 PyObject *__pyx_r = NULL;
12460 __Pyx_RefNannyDeclarations
12461 Py_ssize_t *__pyx_t_1;
12462 Py_ssize_t *__pyx_t_2;
12463 Py_ssize_t *__pyx_t_3;
12465 PyObject *__pyx_t_5 = NULL;
12466 int __pyx_lineno = 0;
12467 const char *__pyx_filename = NULL;
12468 int __pyx_clineno = 0;
12469 __Pyx_RefNannySetupContext(
"assert_direct_dimensions", 0);
12478 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
12479 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
12480 __pyx_t_1 = __pyx_t_3;
12481 __pyx_v_suboffset = (__pyx_t_1[0]);
12490 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
12491 if (unlikely(__pyx_t_4)) {
12500 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
12501 __Pyx_GOTREF(__pyx_t_5);
12502 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
12503 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12504 __PYX_ERR(2, 703, __pyx_L1_error)
12525 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12528 __Pyx_XDECREF(__pyx_t_5);
12529 __Pyx_AddTraceback(
"View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
12532 __Pyx_XGIVEREF(__pyx_r);
12533 __Pyx_RefNannyFinishContext();
12545static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
12546 int __pyx_v_new_ndim;
12547 int __pyx_v_suboffset_dim;
12549 __Pyx_memviewslice __pyx_v_src;
12550 __Pyx_memviewslice __pyx_v_dst;
12551 __Pyx_memviewslice *__pyx_v_p_src;
12552 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
12553 __Pyx_memviewslice *__pyx_v_p_dst;
12554 int *__pyx_v_p_suboffset_dim;
12555 Py_ssize_t __pyx_v_start;
12556 Py_ssize_t __pyx_v_stop;
12557 Py_ssize_t __pyx_v_step;
12558 int __pyx_v_have_start;
12559 int __pyx_v_have_stop;
12560 int __pyx_v_have_step;
12561 PyObject *__pyx_v_index = NULL;
12562 struct __pyx_memoryview_obj *__pyx_r = NULL;
12563 __Pyx_RefNannyDeclarations
12566 PyObject *__pyx_t_3 = NULL;
12567 struct __pyx_memoryview_obj *__pyx_t_4;
12570 Py_ssize_t __pyx_t_7;
12571 PyObject *(*__pyx_t_8)(PyObject *);
12572 PyObject *__pyx_t_9 = NULL;
12573 Py_ssize_t __pyx_t_10;
12575 Py_ssize_t __pyx_t_12;
12576 int __pyx_lineno = 0;
12577 const char *__pyx_filename = NULL;
12578 int __pyx_clineno = 0;
12579 __Pyx_RefNannySetupContext(
"memview_slice", 0);
12588 __pyx_v_new_ndim = 0;
12589 __pyx_v_suboffset_dim = -1;
12598 (void)(memset((&__pyx_v_dst), 0, (
sizeof(__pyx_v_dst))));
12607 #ifndef CYTHON_WITHOUT_ASSERTIONS
12608 if (unlikely(!Py_OptimizeFlag)) {
12609 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
12610 PyErr_SetNone(PyExc_AssertionError);
12611 __PYX_ERR(2, 722, __pyx_L1_error)
12623 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
12624 __pyx_t_2 = (__pyx_t_1 != 0);
12634 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)
12635 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
12636 __Pyx_INCREF(__pyx_t_3);
12637 __pyx_v_memviewsliceobj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
12647 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
12667 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
12676 __pyx_v_p_src = (&__pyx_v_src);
12687 __pyx_t_4 = __pyx_v_p_src->memview;
12688 __pyx_v_dst.memview = __pyx_t_4;
12697 __pyx_t_5 = __pyx_v_p_src->data;
12698 __pyx_v_dst.data = __pyx_t_5;
12707 __pyx_v_p_dst = (&__pyx_v_dst);
12716 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
12726 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
12727 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
12730 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
12731 __Pyx_GOTREF(__pyx_t_3);
12732 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
12735 if (likely(!__pyx_t_8)) {
12736 if (likely(PyList_CheckExact(__pyx_t_3))) {
12737 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3))
break;
12738 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12739 __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)
12741 __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)
12742 __Pyx_GOTREF(__pyx_t_9);
12745 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
12746 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12747 __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)
12749 __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)
12750 __Pyx_GOTREF(__pyx_t_9);
12754 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
12755 if (unlikely(!__pyx_t_9)) {
12756 PyObject* exc_type = PyErr_Occurred();
12758 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12759 else __PYX_ERR(2, 746, __pyx_L1_error)
12763 __Pyx_GOTREF(__pyx_t_9);
12765 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
12767 __pyx_v_dim = __pyx_t_6;
12768 __pyx_t_6 = (__pyx_t_6 + 1);
12777 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
12787 __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)
12796 __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)
12815 __pyx_t_2 = (__pyx_v_index == Py_None);
12816 __pyx_t_1 = (__pyx_t_2 != 0);
12826 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
12835 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
12844 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
12853 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
12873 __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)
12874 __Pyx_GOTREF(__pyx_t_9);
12875 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
12877 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12879 __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)
12880 __pyx_t_10 = __pyx_t_12;
12881 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12882 goto __pyx_L7_bool_binop_done;
12885 __pyx_L7_bool_binop_done:;
12886 __pyx_v_start = __pyx_t_10;
12895 __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)
12896 __Pyx_GOTREF(__pyx_t_9);
12897 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
12899 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12901 __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)
12902 __pyx_t_10 = __pyx_t_12;
12903 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12904 goto __pyx_L9_bool_binop_done;
12907 __pyx_L9_bool_binop_done:;
12908 __pyx_v_stop = __pyx_t_10;
12917 __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)
12918 __Pyx_GOTREF(__pyx_t_9);
12919 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
12921 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12923 __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)
12924 __pyx_t_10 = __pyx_t_12;
12925 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12926 goto __pyx_L11_bool_binop_done;
12929 __pyx_L11_bool_binop_done:;
12930 __pyx_v_step = __pyx_t_10;
12939 __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)
12940 __Pyx_GOTREF(__pyx_t_9);
12941 __pyx_t_1 = (__pyx_t_9 != Py_None);
12942 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12943 __pyx_v_have_start = __pyx_t_1;
12952 __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)
12953 __Pyx_GOTREF(__pyx_t_9);
12954 __pyx_t_1 = (__pyx_t_9 != Py_None);
12955 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12956 __pyx_v_have_stop = __pyx_t_1;
12965 __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)
12966 __Pyx_GOTREF(__pyx_t_9);
12967 __pyx_t_1 = (__pyx_t_9 != Py_None);
12968 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12969 __pyx_v_have_step = __pyx_t_1;
12978 __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)
12987 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
12999 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13008 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
13009 __pyx_t_2 = (__pyx_t_1 != 0);
13019 __Pyx_XDECREF(((PyObject *)__pyx_r));
13028 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
13037 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
13046 __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)
13047 __Pyx_GOTREF(__pyx_t_3);
13048 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
13049 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
13070 __Pyx_XDECREF(((PyObject *)__pyx_r));
13079 __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)
13080 __Pyx_GOTREF(__pyx_t_3);
13089 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
13090 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
13105 __Pyx_XDECREF(__pyx_t_3);
13106 __Pyx_XDECREF(__pyx_t_9);
13107 __Pyx_AddTraceback(
"View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13110 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
13111 __Pyx_XDECREF(__pyx_v_index);
13112 __Pyx_XGIVEREF((PyObject *)__pyx_r);
13113 __Pyx_RefNannyFinishContext();
13125static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset,
int __pyx_v_dim,
int __pyx_v_new_ndim,
int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step,
int __pyx_v_have_start,
int __pyx_v_have_stop,
int __pyx_v_have_step,
int __pyx_v_is_slice) {
13126 Py_ssize_t __pyx_v_new_shape;
13127 int __pyx_v_negative_step;
13132 int __pyx_lineno = 0;
13133 const char *__pyx_filename = NULL;
13134 int __pyx_clineno = 0;
13143 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
13153 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
13163 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
13181 __pyx_t_1 = (0 <= __pyx_v_start);
13183 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
13185 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13195 __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)
13224 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
13227 __pyx_t_2 = __pyx_t_1;
13228 goto __pyx_L6_bool_binop_done;
13230 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
13231 __pyx_t_2 = __pyx_t_1;
13232 __pyx_L6_bool_binop_done:;
13233 __pyx_v_negative_step = __pyx_t_2;
13242 __pyx_t_1 = (__pyx_v_have_step != 0);
13245 __pyx_t_2 = __pyx_t_1;
13246 goto __pyx_L9_bool_binop_done;
13248 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
13249 __pyx_t_2 = __pyx_t_1;
13250 __pyx_L9_bool_binop_done:;
13260 __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)
13278 __pyx_t_2 = (__pyx_v_have_start != 0);
13288 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
13298 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
13307 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
13345 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
13355 __pyx_t_2 = (__pyx_v_negative_step != 0);
13365 __pyx_v_start = (__pyx_v_shape - 1);
13385 __pyx_v_start = __pyx_v_shape;
13417 __pyx_t_2 = (__pyx_v_negative_step != 0);
13427 __pyx_v_start = (__pyx_v_shape - 1);
13460 __pyx_t_2 = (__pyx_v_have_stop != 0);
13470 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
13480 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
13489 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
13527 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
13537 __pyx_v_stop = __pyx_v_shape;
13567 __pyx_t_2 = (__pyx_v_negative_step != 0);
13577 __pyx_v_stop = -1L;
13597 __pyx_v_stop = __pyx_v_shape;
13610 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
13638 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
13647 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
13657 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
13675 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
13685 __pyx_v_new_shape = 0;
13703 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
13712 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
13721 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
13732 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
13742 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
13762 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
13763 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
13774 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
13784 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
13794 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
13804 __pyx_v_dst->data = ((((
char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
13832 __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)
13854 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
13889 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
13891 __Pyx_AddTraceback(
"View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13893 __Pyx_PyGILState_Release(__pyx_gilstate_save);
13909static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view,
char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
13910 Py_ssize_t __pyx_v_shape;
13911 Py_ssize_t __pyx_v_stride;
13912 Py_ssize_t __pyx_v_suboffset;
13913 Py_ssize_t __pyx_v_itemsize;
13914 char *__pyx_v_resultp;
13916 __Pyx_RefNannyDeclarations
13917 Py_ssize_t __pyx_t_1;
13919 PyObject *__pyx_t_3 = NULL;
13920 PyObject *__pyx_t_4 = NULL;
13921 int __pyx_lineno = 0;
13922 const char *__pyx_filename = NULL;
13923 int __pyx_clineno = 0;
13924 __Pyx_RefNannySetupContext(
"pybuffer_index", 0);
13933 __pyx_v_suboffset = -1L;
13942 __pyx_t_1 = __pyx_v_view->itemsize;
13943 __pyx_v_itemsize = __pyx_t_1;
13952 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
13962 if (unlikely(__pyx_v_itemsize == 0)) {
13963 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
13964 __PYX_ERR(2, 917, __pyx_L1_error)
13966 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))) {
13967 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
13968 __PYX_ERR(2, 917, __pyx_L1_error)
13970 __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
13979 __pyx_v_stride = __pyx_v_itemsize;
13999 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
14008 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
14017 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
14027 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
14047 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
14057 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
14066 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
14067 if (unlikely(__pyx_t_2)) {
14076 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
14077 __Pyx_GOTREF(__pyx_t_3);
14078 __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)
14079 __Pyx_GOTREF(__pyx_t_4);
14080 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14081 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
14082 __Pyx_GOTREF(__pyx_t_3);
14083 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14084 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14085 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14086 __PYX_ERR(2, 928, __pyx_L1_error)
14113 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
14114 if (unlikely(__pyx_t_2)) {
14123 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
14124 __Pyx_GOTREF(__pyx_t_3);
14125 __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)
14126 __Pyx_GOTREF(__pyx_t_4);
14127 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14128 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
14129 __Pyx_GOTREF(__pyx_t_3);
14130 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14131 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14132 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14133 __PYX_ERR(2, 931, __pyx_L1_error)
14151 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
14160 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
14170 __pyx_v_resultp = ((((
char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
14188 __pyx_r = __pyx_v_resultp;
14201 __Pyx_XDECREF(__pyx_t_3);
14202 __Pyx_XDECREF(__pyx_t_4);
14203 __Pyx_AddTraceback(
"View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
14206 __Pyx_RefNannyFinishContext();
14218static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
14220 Py_ssize_t *__pyx_v_shape;
14221 Py_ssize_t *__pyx_v_strides;
14226 Py_ssize_t *__pyx_t_2;
14229 Py_ssize_t __pyx_t_5;
14230 Py_ssize_t __pyx_t_6;
14234 int __pyx_lineno = 0;
14235 const char *__pyx_filename = NULL;
14236 int __pyx_clineno = 0;
14245 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
14246 __pyx_v_ndim = __pyx_t_1;
14255 __pyx_t_2 = __pyx_v_memslice->shape;
14256 __pyx_v_shape = __pyx_t_2;
14265 __pyx_t_2 = __pyx_v_memslice->strides;
14266 __pyx_v_strides = __pyx_t_2;
14275 __pyx_t_3 = (__pyx_v_ndim / 2);
14276 __pyx_t_4 = __pyx_t_3;
14277 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
14278 __pyx_v_i = __pyx_t_1;
14287 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
14296 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
14297 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
14298 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
14299 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
14308 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
14309 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
14310 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
14311 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
14320 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
14323 __pyx_t_7 = __pyx_t_8;
14324 goto __pyx_L6_bool_binop_done;
14326 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
14327 __pyx_t_7 = __pyx_t_8;
14328 __pyx_L6_bool_binop_done:;
14338 __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)
14372 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
14374 __Pyx_AddTraceback(
"View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14376 __Pyx_PyGILState_Release(__pyx_gilstate_save);
14393static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self);
14394static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
14395 __Pyx_RefNannyDeclarations
14396 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
14397 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14400 __Pyx_RefNannyFinishContext();
14403static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14404 __Pyx_RefNannyDeclarations
14405 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
14414 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
14425 __Pyx_RefNannyFinishContext();
14436static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp) {
14437 PyObject *__pyx_r = NULL;
14438 __Pyx_RefNannyDeclarations
14440 PyObject *__pyx_t_2 = NULL;
14441 int __pyx_lineno = 0;
14442 const char *__pyx_filename = NULL;
14443 int __pyx_clineno = 0;
14444 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
14453 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
14463 __Pyx_XDECREF(__pyx_r);
14464 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
14465 __Pyx_GOTREF(__pyx_t_2);
14466 __pyx_r = __pyx_t_2;
14487 __Pyx_XDECREF(__pyx_r);
14488 __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)
14489 __Pyx_GOTREF(__pyx_t_2);
14490 __pyx_r = __pyx_t_2;
14505 __Pyx_XDECREF(__pyx_t_2);
14506 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14509 __Pyx_XGIVEREF(__pyx_r);
14510 __Pyx_RefNannyFinishContext();
14522static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
14523 PyObject *__pyx_r = NULL;
14524 __Pyx_RefNannyDeclarations
14527 PyObject *__pyx_t_3 = NULL;
14528 int __pyx_lineno = 0;
14529 const char *__pyx_filename = NULL;
14530 int __pyx_clineno = 0;
14531 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
14540 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
14550 __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)
14570 __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)
14571 __Pyx_GOTREF(__pyx_t_3);
14572 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14585 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14588 __Pyx_XDECREF(__pyx_t_3);
14589 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14592 __Pyx_XGIVEREF(__pyx_r);
14593 __Pyx_RefNannyFinishContext();
14606static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self);
14607static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
14608 PyObject *__pyx_r = 0;
14609 __Pyx_RefNannyDeclarations
14610 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
14611 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14614 __Pyx_RefNannyFinishContext();
14618static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14619 PyObject *__pyx_r = NULL;
14620 __Pyx_RefNannyDeclarations
14621 __Pyx_RefNannySetupContext(
"__get__", 0);
14630 __Pyx_XDECREF(__pyx_r);
14631 __Pyx_INCREF(__pyx_v_self->from_object);
14632 __pyx_r = __pyx_v_self->from_object;
14645 __Pyx_XGIVEREF(__pyx_r);
14646 __Pyx_RefNannyFinishContext();
14657static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14658static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14659 PyObject *__pyx_r = 0;
14660 __Pyx_RefNannyDeclarations
14661 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
14662 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
14665 __Pyx_RefNannyFinishContext();
14669static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
14670 PyObject *__pyx_r = NULL;
14671 __Pyx_RefNannyDeclarations
14672 PyObject *__pyx_t_1 = NULL;
14673 int __pyx_lineno = 0;
14674 const char *__pyx_filename = NULL;
14675 int __pyx_clineno = 0;
14676 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
14684 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
14685 __Pyx_GOTREF(__pyx_t_1);
14686 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14687 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14688 __PYX_ERR(2, 2, __pyx_L1_error)
14698 __Pyx_XDECREF(__pyx_t_1);
14699 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14701 __Pyx_XGIVEREF(__pyx_r);
14702 __Pyx_RefNannyFinishContext();
14714static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
14715static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14716 PyObject *__pyx_r = 0;
14717 __Pyx_RefNannyDeclarations
14718 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
14719 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14722 __Pyx_RefNannyFinishContext();
14726static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
14727 PyObject *__pyx_r = NULL;
14728 __Pyx_RefNannyDeclarations
14729 PyObject *__pyx_t_1 = NULL;
14730 int __pyx_lineno = 0;
14731 const char *__pyx_filename = NULL;
14732 int __pyx_clineno = 0;
14733 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
14740 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
14741 __Pyx_GOTREF(__pyx_t_1);
14742 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14743 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14744 __PYX_ERR(2, 4, __pyx_L1_error)
14755 __Pyx_XDECREF(__pyx_t_1);
14756 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14758 __Pyx_XGIVEREF(__pyx_r);
14759 __Pyx_RefNannyFinishContext();
14771static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,
int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(
char *),
int (*__pyx_v_to_dtype_func)(
char *, PyObject *),
int __pyx_v_dtype_is_object) {
14772 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
14773 Py_ssize_t __pyx_v_suboffset;
14774 PyObject *__pyx_v_length = NULL;
14775 PyObject *__pyx_r = NULL;
14776 __Pyx_RefNannyDeclarations
14778 PyObject *__pyx_t_2 = NULL;
14779 PyObject *__pyx_t_3 = NULL;
14780 __Pyx_TypeInfo *__pyx_t_4;
14781 Py_buffer __pyx_t_5;
14782 Py_ssize_t *__pyx_t_6;
14783 Py_ssize_t *__pyx_t_7;
14784 Py_ssize_t *__pyx_t_8;
14785 Py_ssize_t __pyx_t_9;
14786 int __pyx_lineno = 0;
14787 const char *__pyx_filename = NULL;
14788 int __pyx_clineno = 0;
14789 __Pyx_RefNannySetupContext(
"memoryview_fromslice", 0);
14798 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
14808 __Pyx_XDECREF(__pyx_r);
14809 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14828 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
14829 __Pyx_GOTREF(__pyx_t_2);
14830 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
14831 __Pyx_GOTREF(__pyx_t_3);
14832 __Pyx_INCREF(Py_None);
14833 __Pyx_GIVEREF(Py_None);
14834 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
14835 __Pyx_INCREF(__pyx_int_0);
14836 __Pyx_GIVEREF(__pyx_int_0);
14837 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
14838 __Pyx_GIVEREF(__pyx_t_2);
14839 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
14841 __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)
14842 __Pyx_GOTREF(__pyx_t_2);
14843 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14844 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_2);
14854 __pyx_v_result->from_slice = __pyx_v_memviewslice;
14863 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
14872 __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)
14873 __Pyx_GOTREF(__pyx_t_2);
14874 __Pyx_GIVEREF(__pyx_t_2);
14875 __Pyx_GOTREF(__pyx_v_result->from_object);
14876 __Pyx_DECREF(__pyx_v_result->from_object);
14877 __pyx_v_result->from_object = __pyx_t_2;
14887 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
14888 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
14897 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
14898 __pyx_v_result->__pyx_base.view = __pyx_t_5;
14907 __pyx_v_result->__pyx_base.view.buf = ((
void *)__pyx_v_memviewslice.data);
14916 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
14925 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
14934 Py_INCREF(Py_None);
14943 __pyx_t_1 = ((((
struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
14953 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
14973 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
14984 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
14993 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
15002 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
15011 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
15012 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
15013 __pyx_t_6 = __pyx_t_8;
15014 __pyx_v_suboffset = (__pyx_t_6[0]);
15023 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
15033 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
15042 goto __pyx_L6_break;
15062 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
15063 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
15072 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
15073 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
15074 __pyx_t_6 = __pyx_t_8;
15075 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0]));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
15076 __Pyx_GOTREF(__pyx_t_2);
15077 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
15087 __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)
15088 __Pyx_GOTREF(__pyx_t_2);
15089 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
15090 __Pyx_GOTREF(__pyx_t_3);
15091 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15092 __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)
15093 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15094 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
15104 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
15113 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
15122 __Pyx_XDECREF(__pyx_r);
15123 __Pyx_INCREF(((PyObject *)__pyx_v_result));
15124 __pyx_r = ((PyObject *)__pyx_v_result);
15137 __Pyx_XDECREF(__pyx_t_2);
15138 __Pyx_XDECREF(__pyx_t_3);
15139 __Pyx_AddTraceback(
"View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15142 __Pyx_XDECREF((PyObject *)__pyx_v_result);
15143 __Pyx_XDECREF(__pyx_v_length);
15144 __Pyx_XGIVEREF(__pyx_r);
15145 __Pyx_RefNannyFinishContext();
15157static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
15158 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
15159 __Pyx_memviewslice *__pyx_r;
15160 __Pyx_RefNannyDeclarations
15163 PyObject *__pyx_t_3 = NULL;
15164 int __pyx_lineno = 0;
15165 const char *__pyx_filename = NULL;
15166 int __pyx_clineno = 0;
15167 __Pyx_RefNannySetupContext(
"get_slice_from_memview", 0);
15176 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15177 __pyx_t_2 = (__pyx_t_1 != 0);
15187 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)
15188 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
15189 __Pyx_INCREF(__pyx_t_3);
15190 __pyx_v_obj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
15200 __pyx_r = (&__pyx_v_obj->from_slice);
15220 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
15229 __pyx_r = __pyx_v_mslice;
15243 __Pyx_XDECREF(__pyx_t_3);
15244 __Pyx_AddTraceback(
"View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
15247 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
15248 __Pyx_RefNannyFinishContext();
15260static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
15262 Py_ssize_t *__pyx_v_shape;
15263 Py_ssize_t *__pyx_v_strides;
15264 Py_ssize_t *__pyx_v_suboffsets;
15265 __Pyx_RefNannyDeclarations
15266 Py_ssize_t *__pyx_t_1;
15270 Py_ssize_t __pyx_t_5;
15271 __Pyx_RefNannySetupContext(
"slice_copy", 0);
15280 __pyx_t_1 = __pyx_v_memview->view.shape;
15281 __pyx_v_shape = __pyx_t_1;
15290 __pyx_t_1 = __pyx_v_memview->view.strides;
15291 __pyx_v_strides = __pyx_t_1;
15300 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
15301 __pyx_v_suboffsets = __pyx_t_1;
15310 __pyx_v_dst->memview = ((
struct __pyx_memoryview_obj *)__pyx_v_memview);
15319 __pyx_v_dst->data = ((
char *)__pyx_v_memview->view.buf);
15328 __pyx_t_2 = __pyx_v_memview->view.ndim;
15329 __pyx_t_3 = __pyx_t_2;
15330 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15331 __pyx_v_dim = __pyx_t_4;
15340 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
15349 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
15358 if ((__pyx_v_suboffsets != 0)) {
15359 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
15363 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
15375 __Pyx_RefNannyFinishContext();
15386static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *__pyx_v_memview) {
15387 __Pyx_memviewslice __pyx_v_memviewslice;
15388 PyObject *__pyx_r = NULL;
15389 __Pyx_RefNannyDeclarations
15390 PyObject *__pyx_t_1 = NULL;
15391 int __pyx_lineno = 0;
15392 const char *__pyx_filename = NULL;
15393 int __pyx_clineno = 0;
15394 __Pyx_RefNannySetupContext(
"memoryview_copy", 0);
15403 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
15412 __Pyx_XDECREF(__pyx_r);
15413 __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)
15414 __Pyx_GOTREF(__pyx_t_1);
15415 __pyx_r = __pyx_t_1;
15429 __Pyx_XDECREF(__pyx_t_1);
15430 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
15433 __Pyx_XGIVEREF(__pyx_r);
15434 __Pyx_RefNannyFinishContext();
15446static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
15447 PyObject *(*__pyx_v_to_object_func)(
char *);
15448 int (*__pyx_v_to_dtype_func)(
char *, PyObject *);
15449 PyObject *__pyx_r = NULL;
15450 __Pyx_RefNannyDeclarations
15453 PyObject *(*__pyx_t_3)(
char *);
15454 int (*__pyx_t_4)(
char *, PyObject *);
15455 PyObject *__pyx_t_5 = NULL;
15456 int __pyx_lineno = 0;
15457 const char *__pyx_filename = NULL;
15458 int __pyx_clineno = 0;
15459 __Pyx_RefNannySetupContext(
"memoryview_copy_from_slice", 0);
15468 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15469 __pyx_t_2 = (__pyx_t_1 != 0);
15479 __pyx_t_3 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
15480 __pyx_v_to_object_func = __pyx_t_3;
15489 __pyx_t_4 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
15490 __pyx_v_to_dtype_func = __pyx_t_4;
15510 __pyx_v_to_object_func = NULL;
15519 __pyx_v_to_dtype_func = NULL;
15530 __Pyx_XDECREF(__pyx_r);
15539 __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)
15540 __Pyx_GOTREF(__pyx_t_5);
15541 __pyx_r = __pyx_t_5;
15555 __Pyx_XDECREF(__pyx_t_5);
15556 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15559 __Pyx_XGIVEREF(__pyx_r);
15560 __Pyx_RefNannyFinishContext();
15572static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
15573 Py_ssize_t __pyx_r;
15583 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
15593 __pyx_r = (-__pyx_v_arg);
15613 __pyx_r = __pyx_v_arg;
15638static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim) {
15640 Py_ssize_t __pyx_v_c_stride;
15641 Py_ssize_t __pyx_v_f_stride;
15655 __pyx_v_c_stride = 0;
15664 __pyx_v_f_stride = 0;
15673 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
15674 __pyx_v_i = __pyx_t_1;
15683 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
15693 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
15702 goto __pyx_L4_break;
15722 __pyx_t_1 = __pyx_v_ndim;
15723 __pyx_t_3 = __pyx_t_1;
15724 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
15725 __pyx_v_i = __pyx_t_4;
15734 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
15744 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
15753 goto __pyx_L7_break;
15773 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
15828static void _copy_strided_to_strided(
char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides,
char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
15829 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
15830 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
15831 Py_ssize_t __pyx_v_dst_extent;
15832 Py_ssize_t __pyx_v_src_stride;
15833 Py_ssize_t __pyx_v_dst_stride;
15837 Py_ssize_t __pyx_t_4;
15838 Py_ssize_t __pyx_t_5;
15839 Py_ssize_t __pyx_t_6;
15848 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
15857 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
15866 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
15875 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
15884 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
15894 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
15897 __pyx_t_1 = __pyx_t_2;
15898 goto __pyx_L5_bool_binop_done;
15900 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
15903 __pyx_t_1 = __pyx_t_2;
15904 goto __pyx_L5_bool_binop_done;
15914 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
15916 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
15918 __pyx_t_3 = (__pyx_t_2 != 0);
15919 __pyx_t_1 = __pyx_t_3;
15920 __pyx_L5_bool_binop_done:;
15938 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
15958 __pyx_t_4 = __pyx_v_dst_extent;
15959 __pyx_t_5 = __pyx_t_4;
15960 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15961 __pyx_v_i = __pyx_t_6;
15970 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
15979 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
15988 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
16011 __pyx_t_4 = __pyx_v_dst_extent;
16012 __pyx_t_5 = __pyx_t_4;
16013 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16014 __pyx_v_i = __pyx_t_6;
16023 _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);
16032 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
16041 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
16065static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
16074 _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);
16095static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src,
int __pyx_v_ndim) {
16096 Py_ssize_t __pyx_v_shape;
16097 Py_ssize_t __pyx_v_size;
16098 Py_ssize_t __pyx_r;
16099 Py_ssize_t __pyx_t_1;
16100 Py_ssize_t *__pyx_t_2;
16101 Py_ssize_t *__pyx_t_3;
16102 Py_ssize_t *__pyx_t_4;
16111 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
16112 __pyx_v_size = __pyx_t_1;
16121 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
16122 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
16123 __pyx_t_2 = __pyx_t_4;
16124 __pyx_v_shape = (__pyx_t_2[0]);
16133 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
16143 __pyx_r = __pyx_v_size;
16167static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride,
int __pyx_v_ndim,
char __pyx_v_order) {
16169 Py_ssize_t __pyx_r;
16182 __pyx_t_1 = ((__pyx_v_order ==
'F') != 0);
16192 __pyx_t_2 = __pyx_v_ndim;
16193 __pyx_t_3 = __pyx_t_2;
16194 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16195 __pyx_v_idx = __pyx_t_4;
16204 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
16213 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
16234 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
16235 __pyx_v_idx = __pyx_t_2;
16244 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
16253 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
16265 __pyx_r = __pyx_v_stride;
16289static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice,
char __pyx_v_order,
int __pyx_v_ndim) {
16291 void *__pyx_v_result;
16292 size_t __pyx_v_itemsize;
16293 size_t __pyx_v_size;
16295 Py_ssize_t __pyx_t_1;
16298 struct __pyx_memoryview_obj *__pyx_t_4;
16301 int __pyx_lineno = 0;
16302 const char *__pyx_filename = NULL;
16303 int __pyx_clineno = 0;
16312 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
16313 __pyx_v_itemsize = __pyx_t_1;
16322 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
16331 __pyx_v_result = malloc(__pyx_v_size);
16340 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
16350 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
16368 __pyx_v_tmpslice->data = ((
char *)__pyx_v_result);
16377 __pyx_t_4 = __pyx_v_src->memview;
16378 __pyx_v_tmpslice->memview = __pyx_t_4;
16387 __pyx_t_3 = __pyx_v_ndim;
16388 __pyx_t_5 = __pyx_t_3;
16389 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16390 __pyx_v_i = __pyx_t_6;
16399 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
16408 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
16418 (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));
16427 __pyx_t_3 = __pyx_v_ndim;
16428 __pyx_t_5 = __pyx_t_3;
16429 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16430 __pyx_v_i = __pyx_t_6;
16439 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
16449 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
16468 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
16478 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
16498 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
16509 __pyx_r = __pyx_v_result;
16524 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16526 __Pyx_AddTraceback(
"View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
16528 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16544static int __pyx_memoryview_err_extents(
int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
16546 __Pyx_RefNannyDeclarations
16547 PyObject *__pyx_t_1 = NULL;
16548 PyObject *__pyx_t_2 = NULL;
16549 PyObject *__pyx_t_3 = NULL;
16550 PyObject *__pyx_t_4 = NULL;
16551 int __pyx_lineno = 0;
16552 const char *__pyx_filename = NULL;
16553 int __pyx_clineno = 0;
16555 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16557 __Pyx_RefNannySetupContext(
"_err_extents", 0);
16566 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
16567 __Pyx_GOTREF(__pyx_t_1);
16568 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
16569 __Pyx_GOTREF(__pyx_t_2);
16570 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
16571 __Pyx_GOTREF(__pyx_t_3);
16572 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
16573 __Pyx_GOTREF(__pyx_t_4);
16574 __Pyx_GIVEREF(__pyx_t_1);
16575 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
16576 __Pyx_GIVEREF(__pyx_t_2);
16577 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
16578 __Pyx_GIVEREF(__pyx_t_3);
16579 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
16591 __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, 1253, __pyx_L1_error)
16592 __Pyx_GOTREF(__pyx_t_3);
16593 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16594 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
16595 __Pyx_GOTREF(__pyx_t_4);
16596 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16597 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
16598 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16599 __PYX_ERR(2, 1253, __pyx_L1_error)
16611 __Pyx_XDECREF(__pyx_t_1);
16612 __Pyx_XDECREF(__pyx_t_2);
16613 __Pyx_XDECREF(__pyx_t_3);
16614 __Pyx_XDECREF(__pyx_t_4);
16615 __Pyx_AddTraceback(
"View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
16617 __Pyx_RefNannyFinishContext();
16619 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16632static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error,
char *__pyx_v_msg,
int __pyx_v_dim) {
16634 __Pyx_RefNannyDeclarations
16635 PyObject *__pyx_t_1 = NULL;
16636 PyObject *__pyx_t_2 = NULL;
16637 PyObject *__pyx_t_3 = NULL;
16638 PyObject *__pyx_t_4 = NULL;
16639 int __pyx_lineno = 0;
16640 const char *__pyx_filename = NULL;
16641 int __pyx_clineno = 0;
16643 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16645 __Pyx_RefNannySetupContext(
"_err_dim", 0);
16646 __Pyx_INCREF(__pyx_v_error);
16655 __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, 1258, __pyx_L1_error)
16656 __Pyx_GOTREF(__pyx_t_2);
16657 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
16658 __Pyx_GOTREF(__pyx_t_3);
16659 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
16660 __Pyx_GOTREF(__pyx_t_4);
16661 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16662 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16663 __Pyx_INCREF(__pyx_v_error);
16664 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
16665 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
16666 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
16667 if (likely(__pyx_t_2)) {
16668 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
16669 __Pyx_INCREF(__pyx_t_2);
16670 __Pyx_INCREF(function);
16671 __Pyx_DECREF_SET(__pyx_t_3, function);
16674 __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);
16675 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16676 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16677 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
16678 __Pyx_GOTREF(__pyx_t_1);
16679 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16680 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16681 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16682 __PYX_ERR(2, 1258, __pyx_L1_error)
16694 __Pyx_XDECREF(__pyx_t_1);
16695 __Pyx_XDECREF(__pyx_t_2);
16696 __Pyx_XDECREF(__pyx_t_3);
16697 __Pyx_XDECREF(__pyx_t_4);
16698 __Pyx_AddTraceback(
"View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
16700 __Pyx_XDECREF(__pyx_v_error);
16701 __Pyx_RefNannyFinishContext();
16703 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16716static int __pyx_memoryview_err(PyObject *__pyx_v_error,
char *__pyx_v_msg) {
16718 __Pyx_RefNannyDeclarations
16720 PyObject *__pyx_t_2 = NULL;
16721 PyObject *__pyx_t_3 = NULL;
16722 PyObject *__pyx_t_4 = NULL;
16723 PyObject *__pyx_t_5 = NULL;
16724 int __pyx_lineno = 0;
16725 const char *__pyx_filename = NULL;
16726 int __pyx_clineno = 0;
16728 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16730 __Pyx_RefNannySetupContext(
"_err", 0);
16731 __Pyx_INCREF(__pyx_v_error);
16740 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
16741 if (unlikely(__pyx_t_1)) {
16750 __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, 1263, __pyx_L1_error)
16751 __Pyx_GOTREF(__pyx_t_3);
16752 __Pyx_INCREF(__pyx_v_error);
16753 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
16754 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16755 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
16756 if (likely(__pyx_t_5)) {
16757 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16758 __Pyx_INCREF(__pyx_t_5);
16759 __Pyx_INCREF(function);
16760 __Pyx_DECREF_SET(__pyx_t_4, function);
16763 __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);
16764 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16765 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16766 if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
16767 __Pyx_GOTREF(__pyx_t_2);
16768 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16769 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
16770 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16771 __PYX_ERR(2, 1263, __pyx_L1_error)
16790 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
16791 __PYX_ERR(2, 1265, __pyx_L1_error)
16804 __Pyx_XDECREF(__pyx_t_2);
16805 __Pyx_XDECREF(__pyx_t_3);
16806 __Pyx_XDECREF(__pyx_t_4);
16807 __Pyx_XDECREF(__pyx_t_5);
16808 __Pyx_AddTraceback(
"View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
16810 __Pyx_XDECREF(__pyx_v_error);
16811 __Pyx_RefNannyFinishContext();
16813 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16826static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst,
int __pyx_v_src_ndim,
int __pyx_v_dst_ndim,
int __pyx_v_dtype_is_object) {
16827 void *__pyx_v_tmpdata;
16828 size_t __pyx_v_itemsize;
16830 char __pyx_v_order;
16831 int __pyx_v_broadcasting;
16832 int __pyx_v_direct_copy;
16833 __Pyx_memviewslice __pyx_v_tmp;
16836 Py_ssize_t __pyx_t_1;
16844 int __pyx_lineno = 0;
16845 const char *__pyx_filename = NULL;
16846 int __pyx_clineno = 0;
16855 __pyx_v_tmpdata = NULL;
16864 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
16865 __pyx_v_itemsize = __pyx_t_1;
16874 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
16883 __pyx_v_broadcasting = 0;
16892 __pyx_v_direct_copy = 0;
16901 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
16911 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
16930 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
16940 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
16959 __pyx_t_3 = __pyx_v_dst_ndim;
16960 __pyx_t_4 = __pyx_v_src_ndim;
16961 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
16962 __pyx_t_5 = __pyx_t_3;
16964 __pyx_t_5 = __pyx_t_4;
16966 __pyx_v_ndim = __pyx_t_5;
16975 __pyx_t_5 = __pyx_v_ndim;
16976 __pyx_t_3 = __pyx_t_5;
16977 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16978 __pyx_v_i = __pyx_t_4;
16987 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
16997 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
17007 __pyx_v_broadcasting = 1;
17016 (__pyx_v_src.strides[__pyx_v_i]) = 0;
17036 __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, 1297, __pyx_L1_error)
17056 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
17066 __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, 1300, __pyx_L1_error)
17085 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
17095 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
17105 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
17123 __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, 1307, __pyx_L1_error)
17124 __pyx_v_tmpdata = __pyx_t_7;
17133 __pyx_v_src = __pyx_v_tmp;
17151 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
17161 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'C', __pyx_v_ndim) != 0);
17171 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'C', __pyx_v_ndim);
17190 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'F', __pyx_v_ndim) != 0);
17200 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'F', __pyx_v_ndim);
17219 __pyx_t_2 = (__pyx_v_direct_copy != 0);
17229 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17238 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
17247 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17256 free(__pyx_v_tmpdata);
17293 __pyx_t_2 = (__pyx_v_order ==
'F');
17295 __pyx_t_2 = (
'F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
17297 __pyx_t_8 = (__pyx_t_2 != 0);
17307 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
17316 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
17334 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17343 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
17352 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17361 free(__pyx_v_tmpdata);
17385 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17387 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
17389 __Pyx_PyGILState_Release(__pyx_gilstate_save);
17405static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim,
int __pyx_v_ndim_other) {
17407 int __pyx_v_offset;
17419 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
17428 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17429 __pyx_v_i = __pyx_t_1;
17438 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
17447 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
17456 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
17466 __pyx_t_1 = __pyx_v_offset;
17467 __pyx_t_2 = __pyx_t_1;
17468 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17469 __pyx_v_i = __pyx_t_3;
17478 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
17487 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
17496 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
17518static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_dtype_is_object,
int __pyx_v_ndim,
int __pyx_v_inc) {
17528 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
17538 __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);
17568static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
17569 __Pyx_RefNannyDeclarations
17571 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17573 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice_with_gil", 0);
17582 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
17593 __Pyx_RefNannyFinishContext();
17595 __Pyx_PyGILState_Release(__pyx_gilstate_save);
17607static void __pyx_memoryview_refcount_objects_in_slice(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
17608 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17609 __Pyx_RefNannyDeclarations
17610 Py_ssize_t __pyx_t_1;
17611 Py_ssize_t __pyx_t_2;
17612 Py_ssize_t __pyx_t_3;
17614 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice", 0);
17623 __pyx_t_1 = (__pyx_v_shape[0]);
17624 __pyx_t_2 = __pyx_t_1;
17625 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
17626 __pyx_v_i = __pyx_t_3;
17635 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
17645 __pyx_t_4 = (__pyx_v_inc != 0);
17655 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
17675 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
17705 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
17716 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
17728 __Pyx_RefNannyFinishContext();
17739static 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) {
17748 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17757 __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);
17766 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17787static void __pyx_memoryview__slice_assign_scalar(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item) {
17788 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17789 Py_ssize_t __pyx_v_stride;
17790 Py_ssize_t __pyx_v_extent;
17792 Py_ssize_t __pyx_t_2;
17793 Py_ssize_t __pyx_t_3;
17794 Py_ssize_t __pyx_t_4;
17803 __pyx_v_stride = (__pyx_v_strides[0]);
17812 __pyx_v_extent = (__pyx_v_shape[0]);
17821 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17831 __pyx_t_2 = __pyx_v_extent;
17832 __pyx_t_3 = __pyx_t_2;
17833 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17834 __pyx_v_i = __pyx_t_4;
17843 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
17852 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
17873 __pyx_t_2 = __pyx_v_extent;
17874 __pyx_t_3 = __pyx_t_2;
17875 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17876 __pyx_v_i = __pyx_t_4;
17885 __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);
17894 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
17917static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
17918static 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};
17919static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17920 PyObject *__pyx_v___pyx_type = 0;
17921 long __pyx_v___pyx_checksum;
17922 PyObject *__pyx_v___pyx_state = 0;
17923 int __pyx_lineno = 0;
17924 const char *__pyx_filename = NULL;
17925 int __pyx_clineno = 0;
17926 PyObject *__pyx_r = 0;
17927 __Pyx_RefNannyDeclarations
17928 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum (wrapper)", 0);
17930 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
17931 PyObject* values[3] = {0,0,0};
17932 if (unlikely(__pyx_kwds)) {
17933 Py_ssize_t kw_args;
17934 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17935 switch (pos_args) {
17936 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17937 CYTHON_FALLTHROUGH;
17938 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17939 CYTHON_FALLTHROUGH;
17940 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17941 CYTHON_FALLTHROUGH;
17943 default:
goto __pyx_L5_argtuple_error;
17945 kw_args = PyDict_Size(__pyx_kwds);
17946 switch (pos_args) {
17948 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
17949 else goto __pyx_L5_argtuple_error;
17950 CYTHON_FALLTHROUGH;
17952 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
17954 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
17956 CYTHON_FALLTHROUGH;
17958 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
17960 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
17963 if (unlikely(kw_args > 0)) {
17964 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
17966 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
17967 goto __pyx_L5_argtuple_error;
17969 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17970 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17971 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17973 __pyx_v___pyx_type = values[0];
17974 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]);
if (unlikely((__pyx_v___pyx_checksum == (
long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
17975 __pyx_v___pyx_state = values[2];
17977 goto __pyx_L4_argument_unpacking_done;
17978 __pyx_L5_argtuple_error:;
17979 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
17981 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
17982 __Pyx_RefNannyFinishContext();
17984 __pyx_L4_argument_unpacking_done:;
17985 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
17988 __Pyx_RefNannyFinishContext();
17992static 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) {
17993 PyObject *__pyx_v___pyx_PickleError = 0;
17994 PyObject *__pyx_v___pyx_result = 0;
17995 PyObject *__pyx_r = NULL;
17996 __Pyx_RefNannyDeclarations
17998 PyObject *__pyx_t_2 = NULL;
17999 PyObject *__pyx_t_3 = NULL;
18000 PyObject *__pyx_t_4 = NULL;
18001 PyObject *__pyx_t_5 = NULL;
18003 int __pyx_lineno = 0;
18004 const char *__pyx_filename = NULL;
18005 int __pyx_clineno = 0;
18006 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum", 0);
18015 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
18025 __pyx_t_2 = PyList_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
18026 __Pyx_GOTREF(__pyx_t_2);
18027 __Pyx_INCREF(__pyx_n_s_PickleError);
18028 __Pyx_GIVEREF(__pyx_n_s_PickleError);
18029 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
18030 __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)
18031 __Pyx_GOTREF(__pyx_t_3);
18032 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18033 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
18034 __Pyx_GOTREF(__pyx_t_2);
18035 __Pyx_INCREF(__pyx_t_2);
18036 __pyx_v___pyx_PickleError = __pyx_t_2;
18037 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18038 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18047 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
18048 __Pyx_GOTREF(__pyx_t_2);
18049 __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)
18050 __Pyx_GOTREF(__pyx_t_4);
18051 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18052 __Pyx_INCREF(__pyx_v___pyx_PickleError);
18053 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
18054 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
18055 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
18056 if (likely(__pyx_t_5)) {
18057 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
18058 __Pyx_INCREF(__pyx_t_5);
18059 __Pyx_INCREF(function);
18060 __Pyx_DECREF_SET(__pyx_t_2, function);
18063 __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);
18064 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18065 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18066 if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
18067 __Pyx_GOTREF(__pyx_t_3);
18068 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18069 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
18070 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18071 __PYX_ERR(2, 6, __pyx_L1_error)
18089 __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)
18090 __Pyx_GOTREF(__pyx_t_2);
18092 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
18093 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
18094 if (likely(__pyx_t_4)) {
18095 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
18096 __Pyx_INCREF(__pyx_t_4);
18097 __Pyx_INCREF(function);
18098 __Pyx_DECREF_SET(__pyx_t_2, function);
18101 __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);
18102 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
18103 if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
18104 __Pyx_GOTREF(__pyx_t_3);
18105 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18106 __pyx_v___pyx_result = __pyx_t_3;
18116 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
18117 __pyx_t_6 = (__pyx_t_1 != 0);
18127 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)
18128 __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)
18129 __Pyx_GOTREF(__pyx_t_3);
18130 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18148 __Pyx_XDECREF(__pyx_r);
18149 __Pyx_INCREF(__pyx_v___pyx_result);
18150 __pyx_r = __pyx_v___pyx_result;
18161 __Pyx_XDECREF(__pyx_t_2);
18162 __Pyx_XDECREF(__pyx_t_3);
18163 __Pyx_XDECREF(__pyx_t_4);
18164 __Pyx_XDECREF(__pyx_t_5);
18165 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
18168 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
18169 __Pyx_XDECREF(__pyx_v___pyx_result);
18170 __Pyx_XGIVEREF(__pyx_r);
18171 __Pyx_RefNannyFinishContext();
18183static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
18184 PyObject *__pyx_r = NULL;
18185 __Pyx_RefNannyDeclarations
18186 PyObject *__pyx_t_1 = NULL;
18188 Py_ssize_t __pyx_t_3;
18191 PyObject *__pyx_t_6 = NULL;
18192 PyObject *__pyx_t_7 = NULL;
18193 PyObject *__pyx_t_8 = NULL;
18194 int __pyx_lineno = 0;
18195 const char *__pyx_filename = NULL;
18196 int __pyx_clineno = 0;
18197 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum__set_state", 0);
18206 if (unlikely(__pyx_v___pyx_state == Py_None)) {
18207 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
18208 __PYX_ERR(2, 12, __pyx_L1_error)
18210 __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)
18211 __Pyx_GOTREF(__pyx_t_1);
18212 __Pyx_GIVEREF(__pyx_t_1);
18213 __Pyx_GOTREF(__pyx_v___pyx_result->name);
18214 __Pyx_DECREF(__pyx_v___pyx_result->name);
18215 __pyx_v___pyx_result->name = __pyx_t_1;
18224 if (unlikely(__pyx_v___pyx_state == Py_None)) {
18225 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
18226 __PYX_ERR(2, 13, __pyx_L1_error)
18228 __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)
18229 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
18232 __pyx_t_2 = __pyx_t_4;
18233 goto __pyx_L4_bool_binop_done;
18235 __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)
18236 __pyx_t_5 = (__pyx_t_4 != 0);
18237 __pyx_t_2 = __pyx_t_5;
18238 __pyx_L4_bool_binop_done:;
18246 __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)
18247 __Pyx_GOTREF(__pyx_t_6);
18248 __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)
18249 __Pyx_GOTREF(__pyx_t_7);
18250 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18251 if (unlikely(__pyx_v___pyx_state == Py_None)) {
18252 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
18253 __PYX_ERR(2, 14, __pyx_L1_error)
18255 __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)
18256 __Pyx_GOTREF(__pyx_t_6);
18258 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
18259 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
18260 if (likely(__pyx_t_8)) {
18261 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
18262 __Pyx_INCREF(__pyx_t_8);
18263 __Pyx_INCREF(function);
18264 __Pyx_DECREF_SET(__pyx_t_7, function);
18267 __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);
18268 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
18269 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18270 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
18271 __Pyx_GOTREF(__pyx_t_1);
18272 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
18273 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18292 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18295 __Pyx_XDECREF(__pyx_t_1);
18296 __Pyx_XDECREF(__pyx_t_6);
18297 __Pyx_XDECREF(__pyx_t_7);
18298 __Pyx_XDECREF(__pyx_t_8);
18299 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
18302 __Pyx_XGIVEREF(__pyx_r);
18303 __Pyx_RefNannyFinishContext();
18306static struct __pyx_vtabstruct_array __pyx_vtable_array;
18308static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
18309 struct __pyx_array_obj *p;
18311 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18312 o = (*t->tp_alloc)(t, 0);
18314 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18316 if (unlikely(!o))
return 0;
18317 p = ((
struct __pyx_array_obj *)o);
18318 p->__pyx_vtab = __pyx_vtabptr_array;
18319 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
18320 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
18321 if (unlikely(__pyx_array___cinit__(o, a, k) < 0))
goto bad;
18324 Py_DECREF(o); o = 0;
18328static void __pyx_tp_dealloc_array(PyObject *o) {
18329 struct __pyx_array_obj *p = (
struct __pyx_array_obj *)o;
18330 #if CYTHON_USE_TP_FINALIZE
18331 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
18332 if (PyObject_CallFinalizerFromDealloc(o))
return;
18336 PyObject *etype, *eval, *etb;
18337 PyErr_Fetch(&etype, &eval, &etb);
18338 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18339 __pyx_array___dealloc__(o);
18340 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18341 PyErr_Restore(etype, eval, etb);
18344 Py_CLEAR(p->_format);
18345 (*Py_TYPE(o)->tp_free)(o);
18347static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
18349 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
18350 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
18355static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
18357 return __pyx_array___setitem__(o, i, v);
18360 PyErr_Format(PyExc_NotImplementedError,
18361 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
18366static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
18367 PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
18368 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
18370 v = __pyx_array___getattr__(o, n);
18375static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED
void *x) {
18376 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
18379static PyMethodDef __pyx_methods_array[] = {
18380 {
"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
18381 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
18382 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
18386static struct PyGetSetDef __pyx_getsets_array[] = {
18387 {(
char *)
"memview", __pyx_getprop___pyx_array_memview, 0, (
char *)0, 0},
18391static PySequenceMethods __pyx_tp_as_sequence_array = {
18392 __pyx_array___len__,
18395 __pyx_sq_item_array,
18404static PyMappingMethods __pyx_tp_as_mapping_array = {
18405 __pyx_array___len__,
18406 __pyx_array___getitem__,
18407 __pyx_mp_ass_subscript_array,
18410static PyBufferProcs __pyx_tp_as_buffer_array = {
18411 #if PY_MAJOR_VERSION < 3
18414 #if PY_MAJOR_VERSION < 3
18417 #if PY_MAJOR_VERSION < 3
18420 #if PY_MAJOR_VERSION < 3
18423 __pyx_array_getbuffer,
18427static PyTypeObject __pyx_type___pyx_array = {
18428 PyVarObject_HEAD_INIT(0, 0)
18430 sizeof(
struct __pyx_array_obj),
18432 __pyx_tp_dealloc_array,
18433 #
if PY_VERSION_HEX < 0x030800b4
18436 #
if PY_VERSION_HEX >= 0x030800b4
18441 #
if PY_MAJOR_VERSION < 3
18444 #
if PY_MAJOR_VERSION >= 3
18449 &__pyx_tp_as_sequence_array,
18450 &__pyx_tp_as_mapping_array,
18454 __pyx_tp_getattro_array,
18456 &__pyx_tp_as_buffer_array,
18457 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
18465 __pyx_methods_array,
18467 __pyx_getsets_array,
18475 __pyx_tp_new_array,
18485 #
if PY_VERSION_HEX >= 0x030400a1
18488 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18491 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18494 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18499static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18500 struct __pyx_MemviewEnum_obj *p;
18502 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18503 o = (*t->tp_alloc)(t, 0);
18505 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18507 if (unlikely(!o))
return 0;
18508 p = ((
struct __pyx_MemviewEnum_obj *)o);
18509 p->name = Py_None; Py_INCREF(Py_None);
18513static void __pyx_tp_dealloc_Enum(PyObject *o) {
18514 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
18515 #if CYTHON_USE_TP_FINALIZE
18516 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
18517 if (PyObject_CallFinalizerFromDealloc(o))
return;
18520 PyObject_GC_UnTrack(o);
18522 (*Py_TYPE(o)->tp_free)(o);
18525static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v,
void *a) {
18527 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
18529 e = (*v)(p->name, a);
if (e)
return e;
18534static int __pyx_tp_clear_Enum(PyObject *o) {
18536 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
18537 tmp = ((PyObject*)p->name);
18538 p->name = Py_None; Py_INCREF(Py_None);
18543static PyMethodDef __pyx_methods_Enum[] = {
18544 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
18545 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
18549static PyTypeObject __pyx_type___pyx_MemviewEnum = {
18550 PyVarObject_HEAD_INIT(0, 0)
18552 sizeof(
struct __pyx_MemviewEnum_obj),
18554 __pyx_tp_dealloc_Enum,
18555 #
if PY_VERSION_HEX < 0x030800b4
18558 #
if PY_VERSION_HEX >= 0x030800b4
18563 #
if PY_MAJOR_VERSION < 3
18566 #
if PY_MAJOR_VERSION >= 3
18569 __pyx_MemviewEnum___repr__,
18579 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
18581 __pyx_tp_traverse_Enum,
18582 __pyx_tp_clear_Enum,
18587 __pyx_methods_Enum,
18595 __pyx_MemviewEnum___init__,
18607 #
if PY_VERSION_HEX >= 0x030400a1
18610 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18613 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18616 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18620static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
18622static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
18623 struct __pyx_memoryview_obj *p;
18625 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18626 o = (*t->tp_alloc)(t, 0);
18628 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18630 if (unlikely(!o))
return 0;
18631 p = ((
struct __pyx_memoryview_obj *)o);
18632 p->__pyx_vtab = __pyx_vtabptr_memoryview;
18633 p->obj = Py_None; Py_INCREF(Py_None);
18634 p->_size = Py_None; Py_INCREF(Py_None);
18635 p->_array_interface = Py_None; Py_INCREF(Py_None);
18636 p->view.obj = NULL;
18637 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0))
goto bad;
18640 Py_DECREF(o); o = 0;
18644static void __pyx_tp_dealloc_memoryview(PyObject *o) {
18645 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
18646 #if CYTHON_USE_TP_FINALIZE
18647 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
18648 if (PyObject_CallFinalizerFromDealloc(o))
return;
18651 PyObject_GC_UnTrack(o);
18653 PyObject *etype, *eval, *etb;
18654 PyErr_Fetch(&etype, &eval, &etb);
18655 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18656 __pyx_memoryview___dealloc__(o);
18657 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18658 PyErr_Restore(etype, eval, etb);
18661 Py_CLEAR(p->_size);
18662 Py_CLEAR(p->_array_interface);
18663 (*Py_TYPE(o)->tp_free)(o);
18666static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v,
void *a) {
18668 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
18670 e = (*v)(p->obj, a);
if (e)
return e;
18673 e = (*v)(p->_size, a);
if (e)
return e;
18675 if (p->_array_interface) {
18676 e = (*v)(p->_array_interface, a);
if (e)
return e;
18679 e = (*v)(p->view.obj, a);
if (e)
return e;
18684static int __pyx_tp_clear_memoryview(PyObject *o) {
18686 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
18687 tmp = ((PyObject*)p->obj);
18688 p->obj = Py_None; Py_INCREF(Py_None);
18690 tmp = ((PyObject*)p->_size);
18691 p->_size = Py_None; Py_INCREF(Py_None);
18693 tmp = ((PyObject*)p->_array_interface);
18694 p->_array_interface = Py_None; Py_INCREF(Py_None);
18696 Py_CLEAR(p->view.obj);
18699static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
18701 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
18702 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
18707static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
18709 return __pyx_memoryview___setitem__(o, i, v);
18712 PyErr_Format(PyExc_NotImplementedError,
18713 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
18718static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED
void *x) {
18719 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
18722static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED
void *x) {
18723 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
18726static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED
void *x) {
18727 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
18730static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED
void *x) {
18731 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
18734static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED
void *x) {
18735 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
18738static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED
void *x) {
18739 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
18742static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED
void *x) {
18743 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
18746static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED
void *x) {
18747 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
18750static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED
void *x) {
18751 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
18754static PyMethodDef __pyx_methods_memoryview[] = {
18755 {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
18756 {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
18757 {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
18758 {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
18759 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
18760 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
18764static struct PyGetSetDef __pyx_getsets_memoryview[] = {
18765 {(
char *)
"T", __pyx_getprop___pyx_memoryview_T, 0, (
char *)0, 0},
18766 {(
char *)
"base", __pyx_getprop___pyx_memoryview_base, 0, (
char *)0, 0},
18767 {(
char *)
"shape", __pyx_getprop___pyx_memoryview_shape, 0, (
char *)0, 0},
18768 {(
char *)
"strides", __pyx_getprop___pyx_memoryview_strides, 0, (
char *)0, 0},
18769 {(
char *)
"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (
char *)0, 0},
18770 {(
char *)
"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (
char *)0, 0},
18771 {(
char *)
"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (
char *)0, 0},
18772 {(
char *)
"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (
char *)0, 0},
18773 {(
char *)
"size", __pyx_getprop___pyx_memoryview_size, 0, (
char *)0, 0},
18777static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
18778 __pyx_memoryview___len__,
18781 __pyx_sq_item_memoryview,
18790static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
18791 __pyx_memoryview___len__,
18792 __pyx_memoryview___getitem__,
18793 __pyx_mp_ass_subscript_memoryview,
18796static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
18797 #if PY_MAJOR_VERSION < 3
18800 #if PY_MAJOR_VERSION < 3
18803 #if PY_MAJOR_VERSION < 3
18806 #if PY_MAJOR_VERSION < 3
18809 __pyx_memoryview_getbuffer,
18813static PyTypeObject __pyx_type___pyx_memoryview = {
18814 PyVarObject_HEAD_INIT(0, 0)
18815 "roc_cy.memoryview",
18816 sizeof(
struct __pyx_memoryview_obj),
18818 __pyx_tp_dealloc_memoryview,
18819 #
if PY_VERSION_HEX < 0x030800b4
18822 #
if PY_VERSION_HEX >= 0x030800b4
18827 #
if PY_MAJOR_VERSION < 3
18830 #
if PY_MAJOR_VERSION >= 3
18833 __pyx_memoryview___repr__,
18835 &__pyx_tp_as_sequence_memoryview,
18836 &__pyx_tp_as_mapping_memoryview,
18839 __pyx_memoryview___str__,
18842 &__pyx_tp_as_buffer_memoryview,
18843 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
18845 __pyx_tp_traverse_memoryview,
18846 __pyx_tp_clear_memoryview,
18851 __pyx_methods_memoryview,
18853 __pyx_getsets_memoryview,
18861 __pyx_tp_new_memoryview,
18871 #
if PY_VERSION_HEX >= 0x030400a1
18874 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18877 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18880 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18884static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
18886static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
18887 struct __pyx_memoryviewslice_obj *p;
18888 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
18889 if (unlikely(!o))
return 0;
18890 p = ((
struct __pyx_memoryviewslice_obj *)o);
18891 p->__pyx_base.__pyx_vtab = (
struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
18892 p->from_object = Py_None; Py_INCREF(Py_None);
18893 p->from_slice.memview = NULL;
18897static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
18898 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
18899 #if CYTHON_USE_TP_FINALIZE
18900 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
18901 if (PyObject_CallFinalizerFromDealloc(o))
return;
18904 PyObject_GC_UnTrack(o);
18906 PyObject *etype, *eval, *etb;
18907 PyErr_Fetch(&etype, &eval, &etb);
18908 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
18909 __pyx_memoryviewslice___dealloc__(o);
18910 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
18911 PyErr_Restore(etype, eval, etb);
18913 Py_CLEAR(p->from_object);
18914 PyObject_GC_Track(o);
18915 __pyx_tp_dealloc_memoryview(o);
18918static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v,
void *a) {
18920 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
18921 e = __pyx_tp_traverse_memoryview(o, v, a);
if (e)
return e;
18922 if (p->from_object) {
18923 e = (*v)(p->from_object, a);
if (e)
return e;
18928static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
18930 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
18931 __pyx_tp_clear_memoryview(o);
18932 tmp = ((PyObject*)p->from_object);
18933 p->from_object = Py_None; Py_INCREF(Py_None);
18935 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
18939static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED
void *x) {
18940 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
18943static PyMethodDef __pyx_methods__memoryviewslice[] = {
18944 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
18945 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
18949static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
18950 {(
char *)
"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (
char *)0, 0},
18954static PyTypeObject __pyx_type___pyx_memoryviewslice = {
18955 PyVarObject_HEAD_INIT(0, 0)
18956 "roc_cy._memoryviewslice",
18957 sizeof(
struct __pyx_memoryviewslice_obj),
18959 __pyx_tp_dealloc__memoryviewslice,
18960 #
if PY_VERSION_HEX < 0x030800b4
18963 #
if PY_VERSION_HEX >= 0x030800b4
18968 #
if PY_MAJOR_VERSION < 3
18971 #
if PY_MAJOR_VERSION >= 3
18974 #
if CYTHON_COMPILING_IN_PYPY
18975 __pyx_memoryview___repr__,
18984 #
if CYTHON_COMPILING_IN_PYPY
18985 __pyx_memoryview___str__,
18992 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
18993 "Internal class for passing memoryview slices to Python",
18994 __pyx_tp_traverse__memoryviewslice,
18995 __pyx_tp_clear__memoryviewslice,
19000 __pyx_methods__memoryviewslice,
19002 __pyx_getsets__memoryviewslice,
19010 __pyx_tp_new__memoryviewslice,
19020 #
if PY_VERSION_HEX >= 0x030400a1
19023 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
19026 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19029 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
19034static PyMethodDef __pyx_methods[] = {
19035 {
"evaluate_roc_cy", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_6roc_cy_1evaluate_roc_cy, METH_VARARGS|METH_KEYWORDS, 0},
19039#if PY_MAJOR_VERSION >= 3
19040#if CYTHON_PEP489_MULTI_PHASE_INIT
19041static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
19042static int __pyx_pymod_exec_roc_cy(PyObject* module);
19043static PyModuleDef_Slot __pyx_moduledef_slots[] = {
19044 {Py_mod_create, (
void*)__pyx_pymod_create},
19045 {Py_mod_exec, (
void*)__pyx_pymod_exec_roc_cy},
19050static struct PyModuleDef __pyx_moduledef = {
19051 PyModuleDef_HEAD_INIT,
19054 #if CYTHON_PEP489_MULTI_PHASE_INIT
19060 #if CYTHON_PEP489_MULTI_PHASE_INIT
19061 __pyx_moduledef_slots,
19070#ifndef CYTHON_SMALL_CODE
19071#if defined(__clang__)
19072 #define CYTHON_SMALL_CODE
19073#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
19074 #define CYTHON_SMALL_CODE __attribute__((cold))
19076 #define CYTHON_SMALL_CODE
19080static __Pyx_StringTabEntry __pyx_string_tab[] = {
19081 {&__pyx_n_s_ASCII, __pyx_k_ASCII,
sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
19082 {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri,
sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
19083 {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is,
sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
19084 {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor,
sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
19085 {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi,
sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
19086 {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s,
sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
19087 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis,
sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
19088 {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr,
sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
19089 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
19090 {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0,
sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
19091 {&__pyx_n_s_IndexError, __pyx_k_IndexError,
sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
19092 {&__pyx_n_s_IndexFlatL2, __pyx_k_IndexFlatL2,
sizeof(__pyx_k_IndexFlatL2), 0, 0, 1, 1},
19093 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte,
sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
19094 {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr,
sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
19095 {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d,
sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
19096 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError,
sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
19097 {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x,
sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
19098 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object,
sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
19099 {&__pyx_n_b_O, __pyx_k_O,
sizeof(__pyx_k_O), 0, 0, 0, 1},
19100 {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a,
sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
19101 {&__pyx_n_s_PickleError, __pyx_k_PickleError,
sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
19102 {&__pyx_n_s_TypeError, __pyx_k_TypeError,
sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
19103 {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object,
sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
19104 {&__pyx_n_s_ValueError, __pyx_k_ValueError,
sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
19105 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView,
sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
19106 {&__pyx_n_s_add, __pyx_k_add,
sizeof(__pyx_k_add), 0, 0, 1, 1},
19107 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer,
sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
19108 {&__pyx_n_s_asarray, __pyx_k_asarray,
sizeof(__pyx_k_asarray), 0, 0, 1, 1},
19109 {&__pyx_n_s_astype, __pyx_k_astype,
sizeof(__pyx_k_astype), 0, 0, 1, 1},
19110 {&__pyx_n_s_base, __pyx_k_base,
sizeof(__pyx_k_base), 0, 0, 1, 1},
19111 {&__pyx_n_s_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 0, 1, 1},
19112 {&__pyx_n_u_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 1, 0, 1},
19113 {&__pyx_n_s_class, __pyx_k_class,
sizeof(__pyx_k_class), 0, 0, 1, 1},
19114 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
19115 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct,
sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
19116 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect,
sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
19117 {&__pyx_n_s_dict, __pyx_k_dict,
sizeof(__pyx_k_dict), 0, 0, 1, 1},
19118 {&__pyx_n_s_distmat, __pyx_k_distmat,
sizeof(__pyx_k_distmat), 0, 0, 1, 1},
19119 {&__pyx_n_s_dtype, __pyx_k_dtype,
sizeof(__pyx_k_dtype), 0, 0, 1, 1},
19120 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object,
sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
19121 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
19122 {&__pyx_n_s_enumerate, __pyx_k_enumerate,
sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
19123 {&__pyx_n_s_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 0, 1, 1},
19124 {&__pyx_n_s_faiss, __pyx_k_faiss,
sizeof(__pyx_k_faiss), 0, 0, 1, 1},
19125 {&__pyx_n_s_flags, __pyx_k_flags,
sizeof(__pyx_k_flags), 0, 0, 1, 1},
19126 {&__pyx_n_s_float32, __pyx_k_float32,
sizeof(__pyx_k_float32), 0, 0, 1, 1},
19127 {&__pyx_n_s_format, __pyx_k_format,
sizeof(__pyx_k_format), 0, 0, 1, 1},
19128 {&__pyx_n_s_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 0, 1, 1},
19129 {&__pyx_n_u_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 1, 0, 1},
19130 {&__pyx_n_s_g_camids, __pyx_k_g_camids,
sizeof(__pyx_k_g_camids), 0, 0, 1, 1},
19131 {&__pyx_n_s_g_feats, __pyx_k_g_feats,
sizeof(__pyx_k_g_feats), 0, 0, 1, 1},
19132 {&__pyx_n_s_g_pids, __pyx_k_g_pids,
sizeof(__pyx_k_g_pids), 0, 0, 1, 1},
19133 {&__pyx_n_s_getstate, __pyx_k_getstate,
sizeof(__pyx_k_getstate), 0, 0, 1, 1},
19134 {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi,
sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
19135 {&__pyx_n_s_hstack, __pyx_k_hstack,
sizeof(__pyx_k_hstack), 0, 0, 1, 1},
19136 {&__pyx_n_s_id, __pyx_k_id,
sizeof(__pyx_k_id), 0, 0, 1, 1},
19137 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
19138 {&__pyx_n_s_int64, __pyx_k_int64,
sizeof(__pyx_k_int64), 0, 0, 1, 1},
19139 {&__pyx_n_s_itemsize, __pyx_k_itemsize,
sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
19140 {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array,
sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
19141 {&__pyx_n_s_k, __pyx_k_k,
sizeof(__pyx_k_k), 0, 0, 1, 1},
19142 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
19143 {&__pyx_n_s_memview, __pyx_k_memview,
sizeof(__pyx_k_memview), 0, 0, 1, 1},
19144 {&__pyx_n_s_mode, __pyx_k_mode,
sizeof(__pyx_k_mode), 0, 0, 1, 1},
19145 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
19146 {&__pyx_n_s_name_2, __pyx_k_name_2,
sizeof(__pyx_k_name_2), 0, 0, 1, 1},
19147 {&__pyx_n_s_ndim, __pyx_k_ndim,
sizeof(__pyx_k_ndim), 0, 0, 1, 1},
19148 {&__pyx_n_s_new, __pyx_k_new,
sizeof(__pyx_k_new), 0, 0, 1, 1},
19149 {&__pyx_n_s_newaxis, __pyx_k_newaxis,
sizeof(__pyx_k_newaxis), 0, 0, 1, 1},
19150 {&__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},
19151 {&__pyx_n_s_np, __pyx_k_np,
sizeof(__pyx_k_np), 0, 0, 1, 1},
19152 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
19153 {&__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},
19154 {&__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},
19155 {&__pyx_n_s_obj, __pyx_k_obj,
sizeof(__pyx_k_obj), 0, 0, 1, 1},
19156 {&__pyx_n_s_ones, __pyx_k_ones,
sizeof(__pyx_k_ones), 0, 0, 1, 1},
19157 {&__pyx_n_s_pack, __pyx_k_pack,
sizeof(__pyx_k_pack), 0, 0, 1, 1},
19158 {&__pyx_n_s_pickle, __pyx_k_pickle,
sizeof(__pyx_k_pickle), 0, 0, 1, 1},
19159 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError,
sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
19160 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum,
sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
19161 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer,
sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
19162 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result,
sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
19163 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state,
sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
19164 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type,
sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
19165 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum,
sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
19166 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable,
sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
19167 {&__pyx_n_s_q_camids, __pyx_k_q_camids,
sizeof(__pyx_k_q_camids), 0, 0, 1, 1},
19168 {&__pyx_n_s_q_feats, __pyx_k_q_feats,
sizeof(__pyx_k_q_feats), 0, 0, 1, 1},
19169 {&__pyx_n_s_q_pids, __pyx_k_q_pids,
sizeof(__pyx_k_q_pids), 0, 0, 1, 1},
19170 {&__pyx_n_s_range, __pyx_k_range,
sizeof(__pyx_k_range), 0, 0, 1, 1},
19171 {&__pyx_n_s_reduce, __pyx_k_reduce,
sizeof(__pyx_k_reduce), 0, 0, 1, 1},
19172 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython,
sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
19173 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex,
sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
19174 {&__pyx_n_s_search, __pyx_k_search,
sizeof(__pyx_k_search), 0, 0, 1, 1},
19175 {&__pyx_n_s_setstate, __pyx_k_setstate,
sizeof(__pyx_k_setstate), 0, 0, 1, 1},
19176 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython,
sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
19177 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
19178 {&__pyx_n_s_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 0, 1, 1},
19179 {&__pyx_n_s_start, __pyx_k_start,
sizeof(__pyx_k_start), 0, 0, 1, 1},
19180 {&__pyx_n_s_step, __pyx_k_step,
sizeof(__pyx_k_step), 0, 0, 1, 1},
19181 {&__pyx_n_s_stop, __pyx_k_stop,
sizeof(__pyx_k_stop), 0, 0, 1, 1},
19182 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct,
sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
19183 {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect,
sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
19184 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect,
sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
19185 {&__pyx_kp_s_stringsource, __pyx_k_stringsource,
sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
19186 {&__pyx_n_s_struct, __pyx_k_struct,
sizeof(__pyx_k_struct), 0, 0, 1, 1},
19187 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
19188 {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data,
sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
19189 {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str,
sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
19190 {&__pyx_n_s_unpack, __pyx_k_unpack,
sizeof(__pyx_k_unpack), 0, 0, 1, 1},
19191 {&__pyx_n_s_update, __pyx_k_update,
sizeof(__pyx_k_update), 0, 0, 1, 1},
19192 {&__pyx_n_s_zeros, __pyx_k_zeros,
sizeof(__pyx_k_zeros), 0, 0, 1, 1},
19193 {0, 0, 0, 0, 0, 0, 0}
19195static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
19196 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range);
if (!__pyx_builtin_range) __PYX_ERR(0, 59, __pyx_L1_error)
19197 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
19198 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError);
if (!__pyx_builtin_ValueError) __PYX_ERR(2, 133, __pyx_L1_error)
19199 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError);
if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
19200 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate);
if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error)
19201 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError);
if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
19202 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis);
if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
19203 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id);
if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
19204 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError);
if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
19210static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
19211 __Pyx_RefNannyDeclarations
19212 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
19221 __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None);
if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 42, __pyx_L1_error)
19222 __Pyx_GOTREF(__pyx_slice_);
19223 __Pyx_GIVEREF(__pyx_slice_);
19232 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 945, __pyx_L1_error)
19233 __Pyx_GOTREF(__pyx_tuple__2);
19234 __Pyx_GIVEREF(__pyx_tuple__2);
19243 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 951, __pyx_L1_error)
19244 __Pyx_GOTREF(__pyx_tuple__3);
19245 __Pyx_GIVEREF(__pyx_tuple__3);
19254 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr);
if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 133, __pyx_L1_error)
19255 __Pyx_GOTREF(__pyx_tuple__4);
19256 __Pyx_GIVEREF(__pyx_tuple__4);
19265 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 136, __pyx_L1_error)
19266 __Pyx_GOTREF(__pyx_tuple__5);
19267 __Pyx_GIVEREF(__pyx_tuple__5);
19276 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str);
if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 148, __pyx_L1_error)
19277 __Pyx_GOTREF(__pyx_tuple__6);
19278 __Pyx_GIVEREF(__pyx_tuple__6);
19287 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data);
if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 176, __pyx_L1_error)
19288 __Pyx_GOTREF(__pyx_tuple__7);
19289 __Pyx_GIVEREF(__pyx_tuple__7);
19298 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is);
if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 192, __pyx_L1_error)
19299 __Pyx_GOTREF(__pyx_tuple__8);
19300 __Pyx_GIVEREF(__pyx_tuple__8);
19308 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 2, __pyx_L1_error)
19309 __Pyx_GOTREF(__pyx_tuple__9);
19310 __Pyx_GIVEREF(__pyx_tuple__9);
19317 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 4, __pyx_L1_error)
19318 __Pyx_GOTREF(__pyx_tuple__10);
19319 __Pyx_GIVEREF(__pyx_tuple__10);
19328 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 418, __pyx_L1_error)
19329 __Pyx_GOTREF(__pyx_tuple__11);
19330 __Pyx_GIVEREF(__pyx_tuple__11);
19339 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object);
if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 495, __pyx_L1_error)
19340 __Pyx_GOTREF(__pyx_tuple__12);
19341 __Pyx_GIVEREF(__pyx_tuple__12);
19350 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi);
if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 520, __pyx_L1_error)
19351 __Pyx_GOTREF(__pyx_tuple__13);
19352 __Pyx_GIVEREF(__pyx_tuple__13);
19361 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri);
if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 570, __pyx_L1_error)
19362 __Pyx_GOTREF(__pyx_tuple__14);
19363 __Pyx_GIVEREF(__pyx_tuple__14);
19372 __pyx_tuple__15 = PyTuple_New(1);
if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 577, __pyx_L1_error)
19373 __Pyx_GOTREF(__pyx_tuple__15);
19374 __Pyx_INCREF(__pyx_int_neg_1);
19375 __Pyx_GIVEREF(__pyx_int_neg_1);
19376 PyTuple_SET_ITEM(__pyx_tuple__15, 0, __pyx_int_neg_1);
19377 __Pyx_GIVEREF(__pyx_tuple__15);
19385 __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)
19386 __Pyx_GOTREF(__pyx_tuple__16);
19387 __Pyx_GIVEREF(__pyx_tuple__16);
19394 __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)
19395 __Pyx_GOTREF(__pyx_tuple__17);
19396 __Pyx_GIVEREF(__pyx_tuple__17);
19405 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte);
if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 703, __pyx_L1_error)
19406 __Pyx_GOTREF(__pyx_tuple__18);
19407 __Pyx_GIVEREF(__pyx_tuple__18);
19415 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 2, __pyx_L1_error)
19416 __Pyx_GOTREF(__pyx_tuple__19);
19417 __Pyx_GIVEREF(__pyx_tuple__19);
19424 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 4, __pyx_L1_error)
19425 __Pyx_GOTREF(__pyx_tuple__20);
19426 __Pyx_GIVEREF(__pyx_tuple__20);
19435 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect);
if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 286, __pyx_L1_error)
19436 __Pyx_GOTREF(__pyx_tuple__21);
19437 __Pyx_GIVEREF(__pyx_tuple__21);
19446 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct);
if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 287, __pyx_L1_error)
19447 __Pyx_GOTREF(__pyx_tuple__22);
19448 __Pyx_GIVEREF(__pyx_tuple__22);
19457 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect);
if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 288, __pyx_L1_error)
19458 __Pyx_GOTREF(__pyx_tuple__23);
19459 __Pyx_GIVEREF(__pyx_tuple__23);
19468 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct);
if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 291, __pyx_L1_error)
19469 __Pyx_GOTREF(__pyx_tuple__24);
19470 __Pyx_GIVEREF(__pyx_tuple__24);
19479 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect);
if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 292, __pyx_L1_error)
19480 __Pyx_GOTREF(__pyx_tuple__25);
19481 __Pyx_GIVEREF(__pyx_tuple__25);
19488 __pyx_tuple__26 = 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__26)) __PYX_ERR(2, 1, __pyx_L1_error)
19489 __Pyx_GOTREF(__pyx_tuple__26);
19490 __Pyx_GIVEREF(__pyx_tuple__26);
19491 __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(2, 1, __pyx_L1_error)
19492 __Pyx_RefNannyFinishContext();
19495 __Pyx_RefNannyFinishContext();
19499static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
19500 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
19501 __pyx_int_0 = PyInt_FromLong(0);
if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
19502 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
19503 __pyx_int_184977713 = PyInt_FromLong(184977713L);
if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
19504 __pyx_int_neg_1 = PyInt_FromLong(-1);
if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
19510static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
19511static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
19512static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
19513static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
19514static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
19515static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
19516static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
19518static int __Pyx_modinit_global_init_code(
void) {
19519 __Pyx_RefNannyDeclarations
19520 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
19522 generic = Py_None; Py_INCREF(Py_None);
19523 strided = Py_None; Py_INCREF(Py_None);
19524 indirect = Py_None; Py_INCREF(Py_None);
19525 contiguous = Py_None; Py_INCREF(Py_None);
19526 indirect_contiguous = Py_None; Py_INCREF(Py_None);
19527 __Pyx_RefNannyFinishContext();
19531static int __Pyx_modinit_variable_export_code(
void) {
19532 __Pyx_RefNannyDeclarations
19533 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
19535 __Pyx_RefNannyFinishContext();
19539static int __Pyx_modinit_function_export_code(
void) {
19540 __Pyx_RefNannyDeclarations
19541 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
19543 __Pyx_RefNannyFinishContext();
19547static int __Pyx_modinit_type_init_code(
void) {
19548 __Pyx_RefNannyDeclarations
19549 int __pyx_lineno = 0;
19550 const char *__pyx_filename = NULL;
19551 int __pyx_clineno = 0;
19552 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
19554 __pyx_vtabptr_array = &__pyx_vtable_array;
19555 __pyx_vtable_array.get_memview = (PyObject *(*)(
struct __pyx_array_obj *))__pyx_array_get_memview;
19556 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
19557 #if PY_VERSION_HEX < 0x030800B1
19558 __pyx_type___pyx_array.tp_print = 0;
19560 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
19561 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
19562 __pyx_array_type = &__pyx_type___pyx_array;
19563 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
19564 #if PY_VERSION_HEX < 0x030800B1
19565 __pyx_type___pyx_MemviewEnum.tp_print = 0;
19567 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
19568 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19570 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
19571 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
19572 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
19573 __pyx_vtable_memoryview.get_item_pointer = (
char *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
19574 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
19575 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
19576 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
19577 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
19578 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryview_convert_item_to_object;
19579 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryview_assign_item_from_object;
19580 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
19581 #if PY_VERSION_HEX < 0x030800B1
19582 __pyx_type___pyx_memoryview.tp_print = 0;
19584 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
19585 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19587 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
19588 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
19589 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
19590 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
19591 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
19592 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryviewslice_convert_item_to_object;
19593 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
19594 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
19595 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
19596 #if PY_VERSION_HEX < 0x030800B1
19597 __pyx_type___pyx_memoryviewslice.tp_print = 0;
19599 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
19600 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
19602 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
19603 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
19604 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
19605 __Pyx_RefNannyFinishContext();
19608 __Pyx_RefNannyFinishContext();
19612static int __Pyx_modinit_type_import_code(
void) {
19613 __Pyx_RefNannyDeclarations
19614 PyObject *__pyx_t_1 = NULL;
19615 int __pyx_lineno = 0;
19616 const char *__pyx_filename = NULL;
19617 int __pyx_clineno = 0;
19618 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
19620 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
19621 __Pyx_GOTREF(__pyx_t_1);
19622 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME,
"type",
19623 #
if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
19624 sizeof(PyTypeObject),
19626 sizeof(PyHeapTypeObject),
19628 __Pyx_ImportType_CheckSize_Warn);
19629 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
19630 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19631 __pyx_t_1 = PyImport_ImportModule(
"numpy");
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
19632 __Pyx_GOTREF(__pyx_t_1);
19633 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1,
"numpy",
"dtype",
sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
19634 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
19635 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flatiter",
sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
19636 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
19637 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1,
"numpy",
"broadcast",
sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
19638 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
19639 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ndarray",
sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
19640 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
19641 __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1,
"numpy",
"generic",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19642 if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
19643 __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1,
"numpy",
"number",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19644 if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
19645 __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1,
"numpy",
"integer",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19646 if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
19647 __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"signedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19648 if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
19649 __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"unsignedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19650 if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
19651 __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1,
"numpy",
"inexact",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19652 if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
19653 __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"floating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19654 if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
19655 __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"complexfloating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19656 if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
19657 __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flexible",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19658 if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
19659 __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1,
"numpy",
"character",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
19660 if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
19661 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ufunc",
sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
19662 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
19663 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19664 __Pyx_RefNannyFinishContext();
19667 __Pyx_XDECREF(__pyx_t_1);
19668 __Pyx_RefNannyFinishContext();
19672static int __Pyx_modinit_variable_import_code(
void) {
19673 __Pyx_RefNannyDeclarations
19674 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
19676 __Pyx_RefNannyFinishContext();
19680static int __Pyx_modinit_function_import_code(
void) {
19681 __Pyx_RefNannyDeclarations
19682 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
19684 __Pyx_RefNannyFinishContext();
19689#ifndef CYTHON_NO_PYINIT_EXPORT
19690#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
19691#elif PY_MAJOR_VERSION < 3
19693#define __Pyx_PyMODINIT_FUNC extern "C" void
19695#define __Pyx_PyMODINIT_FUNC void
19699#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
19701#define __Pyx_PyMODINIT_FUNC PyObject *
19706#if PY_MAJOR_VERSION < 3
19707__Pyx_PyMODINIT_FUNC initroc_cy(
void) CYTHON_SMALL_CODE;
19708__Pyx_PyMODINIT_FUNC initroc_cy(
void)
19710__Pyx_PyMODINIT_FUNC PyInit_roc_cy(
void) CYTHON_SMALL_CODE;
19711__Pyx_PyMODINIT_FUNC PyInit_roc_cy(
void)
19712#if CYTHON_PEP489_MULTI_PHASE_INIT
19714 return PyModuleDef_Init(&__pyx_moduledef);
19716static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
19717 #if PY_VERSION_HEX >= 0x030700A1
19718 static PY_INT64_T main_interpreter_id = -1;
19719 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
19720 if (main_interpreter_id == -1) {
19721 main_interpreter_id = current_id;
19722 return (unlikely(current_id == -1)) ? -1 : 0;
19723 }
else if (unlikely(main_interpreter_id != current_id))
19725 static PyInterpreterState *main_interpreter = NULL;
19726 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
19727 if (!main_interpreter) {
19728 main_interpreter = current_interpreter;
19729 }
else if (unlikely(main_interpreter != current_interpreter))
19734 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
19739static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict,
const char* from_name,
const char* to_name,
int allow_none) {
19740 PyObject *value = PyObject_GetAttrString(spec, from_name);
19742 if (likely(value)) {
19743 if (allow_none || value != Py_None) {
19744 result = PyDict_SetItemString(moddict, to_name, value);
19747 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
19754static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
19755 PyObject *
module = NULL, *moddict, *modname;
19756 if (__Pyx_check_single_interpreter())
19759 return __Pyx_NewRef(__pyx_m);
19760 modname = PyObject_GetAttrString(spec,
"name");
19761 if (unlikely(!modname))
goto bad;
19762 module = PyModule_NewObject(modname);
19763 Py_DECREF(modname);
19764 if (unlikely(!module))
goto bad;
19765 moddict = PyModule_GetDict(module);
19766 if (unlikely(!moddict))
goto bad;
19767 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
19768 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
19769 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
19770 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
19773 Py_XDECREF(module);
19778static CYTHON_SMALL_CODE
int __pyx_pymod_exec_roc_cy(PyObject *__pyx_pyinit_module)
19782 PyObject *__pyx_t_1 = NULL;
19783 static PyThread_type_lock __pyx_t_2[8];
19784 int __pyx_lineno = 0;
19785 const char *__pyx_filename = NULL;
19786 int __pyx_clineno = 0;
19787 __Pyx_RefNannyDeclarations
19788 #if CYTHON_PEP489_MULTI_PHASE_INIT
19790 if (__pyx_m == __pyx_pyinit_module)
return 0;
19791 PyErr_SetString(PyExc_RuntimeError,
"Module 'roc_cy' has already been imported. Re-initialisation is not supported.");
19794 #elif PY_MAJOR_VERSION >= 3
19795 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
19797 #if CYTHON_REFNANNY
19798__Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
19799if (!__Pyx_RefNanny) {
19801 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
19802 if (!__Pyx_RefNanny)
19803 Py_FatalError(
"failed to import 'refnanny' module");
19806 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_roc_cy(void)", 0);
19807 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19808 #ifdef __Pxy_PyFrame_Initialize_Offsets
19809 __Pxy_PyFrame_Initialize_Offsets();
19811 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
19812 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
19813 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
19814 #ifdef __Pyx_CyFunction_USED
19815 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19817 #ifdef __Pyx_FusedFunction_USED
19818 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19820 #ifdef __Pyx_Coroutine_USED
19821 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19823 #ifdef __Pyx_Generator_USED
19824 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19826 #ifdef __Pyx_AsyncGen_USED
19827 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19829 #ifdef __Pyx_StopAsyncIteration_USED
19830 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19834 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
19835 PyEval_InitThreads();
19838 #if CYTHON_PEP489_MULTI_PHASE_INIT
19839 __pyx_m = __pyx_pyinit_module;
19840 Py_INCREF(__pyx_m);
19842 #if PY_MAJOR_VERSION < 3
19843 __pyx_m = Py_InitModule4(
"roc_cy", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
19845 __pyx_m = PyModule_Create(&__pyx_moduledef);
19847 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
19849 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
19850 Py_INCREF(__pyx_d);
19851 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
19852 Py_INCREF(__pyx_b);
19853 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
19854 Py_INCREF(__pyx_cython_runtime);
19855 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
19857 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19858 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
19859 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19861 if (__pyx_module_is_main_roc_cy) {
19862 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19864 #if PY_MAJOR_VERSION >= 3
19866 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
19867 if (!PyDict_GetItemString(modules,
"roc_cy")) {
19868 if (unlikely(PyDict_SetItemString(modules,
"roc_cy", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19873 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19875 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19877 (void)__Pyx_modinit_global_init_code();
19878 (void)__Pyx_modinit_variable_export_code();
19879 (void)__Pyx_modinit_function_export_code();
19880 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19881 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
19882 (void)__Pyx_modinit_variable_import_code();
19883 (void)__Pyx_modinit_function_import_code();
19885 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
19886 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19896 __pyx_t_1 = __Pyx_Import(__pyx_n_s_faiss, 0, -1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
19897 __Pyx_GOTREF(__pyx_t_1);
19898 if (PyDict_SetItem(__pyx_d, __pyx_n_s_faiss, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
19899 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19908 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
19909 __Pyx_GOTREF(__pyx_t_1);
19910 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
19911 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19918 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
19919 __Pyx_GOTREF(__pyx_t_1);
19920 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19921 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19930 __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)
19931 __Pyx_GOTREF(__pyx_t_1);
19932 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)
19933 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19934 PyType_Modified(__pyx_array_type);
19943 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__21, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error)
19944 __Pyx_GOTREF(__pyx_t_1);
19945 __Pyx_XGOTREF(generic);
19946 __Pyx_DECREF_SET(generic, __pyx_t_1);
19947 __Pyx_GIVEREF(__pyx_t_1);
19957 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__22, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
19958 __Pyx_GOTREF(__pyx_t_1);
19959 __Pyx_XGOTREF(strided);
19960 __Pyx_DECREF_SET(strided, __pyx_t_1);
19961 __Pyx_GIVEREF(__pyx_t_1);
19971 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
19972 __Pyx_GOTREF(__pyx_t_1);
19973 __Pyx_XGOTREF(indirect);
19974 __Pyx_DECREF_SET(indirect, __pyx_t_1);
19975 __Pyx_GIVEREF(__pyx_t_1);
19985 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error)
19986 __Pyx_GOTREF(__pyx_t_1);
19987 __Pyx_XGOTREF(contiguous);
19988 __Pyx_DECREF_SET(contiguous, __pyx_t_1);
19989 __Pyx_GIVEREF(__pyx_t_1);
19999 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
20000 __Pyx_GOTREF(__pyx_t_1);
20001 __Pyx_XGOTREF(indirect_contiguous);
20002 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
20003 __Pyx_GIVEREF(__pyx_t_1);
20013 __pyx_memoryview_thread_locks_used = 0;
20022 __pyx_t_2[0] = PyThread_allocate_lock();
20023 __pyx_t_2[1] = PyThread_allocate_lock();
20024 __pyx_t_2[2] = PyThread_allocate_lock();
20025 __pyx_t_2[3] = PyThread_allocate_lock();
20026 __pyx_t_2[4] = PyThread_allocate_lock();
20027 __pyx_t_2[5] = PyThread_allocate_lock();
20028 __pyx_t_2[6] = PyThread_allocate_lock();
20029 __pyx_t_2[7] = PyThread_allocate_lock();
20030 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2,
sizeof(__pyx_memoryview_thread_locks[0]) * (8));
20039 __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)
20040 __Pyx_GOTREF(__pyx_t_1);
20041 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)
20042 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20043 PyType_Modified(__pyx_memoryview_type);
20052 __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)
20053 __Pyx_GOTREF(__pyx_t_1);
20054 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)
20055 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20056 PyType_Modified(__pyx_memoryviewslice_type);
20063 __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)
20064 __Pyx_GOTREF(__pyx_t_1);
20065 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
20066 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20080 __Pyx_XDECREF(__pyx_t_1);
20083 __Pyx_AddTraceback(
"init roc_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
20086 }
else if (!PyErr_Occurred()) {
20087 PyErr_SetString(PyExc_ImportError,
"init roc_cy");
20090 __Pyx_RefNannyFinishContext();
20091 #if CYTHON_PEP489_MULTI_PHASE_INIT
20092 return (__pyx_m != NULL) ? 0 : -1;
20093 #elif PY_MAJOR_VERSION >= 3
20103static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
20104 PyObject *m = NULL, *p = NULL;
20106 m = PyImport_ImportModule(modname);
20108 p = PyObject_GetAttrString(m,
"RefNannyAPI");
20110 r = PyLong_AsVoidPtr(p);
20114 return (__Pyx_RefNannyAPIStruct *)r;
20119#if CYTHON_USE_TYPE_SLOTS
20120static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
20121 PyTypeObject* tp = Py_TYPE(obj);
20122 if (likely(tp->tp_getattro))
20123 return tp->tp_getattro(obj, attr_name);
20124#if PY_MAJOR_VERSION < 3
20125 if (likely(tp->tp_getattr))
20126 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
20128 return PyObject_GetAttr(obj, attr_name);
20133static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
20134 PyObject*
result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
20135 if (unlikely(!result)) {
20136 PyErr_Format(PyExc_NameError,
20137#
if PY_MAJOR_VERSION >= 3
20138 "name '%U' is not defined", name);
20140 "name '%.200s' is not defined", PyString_AS_STRING(name));
20148__Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
20150 __Pyx_memviewslice *memviewslice,
20151 int memview_is_new_reference)
20153 __Pyx_RefNannyDeclarations
20155 Py_buffer *buf = &memview->view;
20156 __Pyx_RefNannySetupContext(
"init_memviewslice", 0);
20157 if (unlikely(memviewslice->memview || memviewslice->data)) {
20158 PyErr_SetString(PyExc_ValueError,
20159 "memviewslice is already initialized!");
20162 if (buf->strides) {
20163 for (i = 0; i < ndim; i++) {
20164 memviewslice->strides[i] = buf->strides[i];
20167 Py_ssize_t stride = buf->itemsize;
20168 for (i = ndim - 1; i >= 0; i--) {
20169 memviewslice->strides[i] = stride;
20170 stride *= buf->shape[i];
20173 for (i = 0; i < ndim; i++) {
20174 memviewslice->shape[i] = buf->shape[i];
20175 if (buf->suboffsets) {
20176 memviewslice->suboffsets[i] = buf->suboffsets[i];
20178 memviewslice->suboffsets[i] = -1;
20181 memviewslice->memview = memview;
20182 memviewslice->data = (
char *)buf->buf;
20183 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
20184 Py_INCREF(memview);
20189 memviewslice->memview = 0;
20190 memviewslice->data = 0;
20193 __Pyx_RefNannyFinishContext();
20196#ifndef Py_NO_RETURN
20197#define Py_NO_RETURN
20199static void __pyx_fatalerror(
const char *fmt, ...) Py_NO_RETURN {
20202#ifdef HAVE_STDARG_PROTOTYPES
20203 va_start(vargs, fmt);
20207 vsnprintf(msg, 200, fmt, vargs);
20209 Py_FatalError(msg);
20211static CYTHON_INLINE
int
20212__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
20213 PyThread_type_lock lock)
20216 PyThread_acquire_lock(lock, 1);
20217 result = (*acquisition_count)++;
20218 PyThread_release_lock(lock);
20221static CYTHON_INLINE
int
20222__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
20223 PyThread_type_lock lock)
20226 PyThread_acquire_lock(lock, 1);
20227 result = (*acquisition_count)--;
20228 PyThread_release_lock(lock);
20231static CYTHON_INLINE
void
20232__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice,
int have_gil,
int lineno)
20235 struct __pyx_memoryview_obj *memview = memslice->memview;
20236 if (unlikely(!memview || (PyObject *) memview == Py_None))
20238 if (unlikely(__pyx_get_slice_count(memview) < 0))
20239 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
20240 __pyx_get_slice_count(memview), lineno);
20241 first_time = __pyx_add_acquisition_count(memview) == 0;
20242 if (unlikely(first_time)) {
20244 Py_INCREF((PyObject *) memview);
20246 PyGILState_STATE _gilstate = PyGILState_Ensure();
20247 Py_INCREF((PyObject *) memview);
20248 PyGILState_Release(_gilstate);
20252static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
20253 int have_gil,
int lineno) {
20255 struct __pyx_memoryview_obj *memview = memslice->memview;
20256 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
20257 memslice->memview = NULL;
20260 if (unlikely(__pyx_get_slice_count(memview) <= 0))
20261 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
20262 __pyx_get_slice_count(memview), lineno);
20263 last_time = __pyx_sub_acquisition_count(memview) == 1;
20264 memslice->data = NULL;
20265 if (unlikely(last_time)) {
20267 Py_CLEAR(memslice->memview);
20269 PyGILState_STATE _gilstate = PyGILState_Ensure();
20270 Py_CLEAR(memslice->memview);
20271 PyGILState_Release(_gilstate);
20274 memslice->memview = NULL;
20279#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
20280static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
20281 PyObject *dict = Py_TYPE(obj)->tp_dict;
20282 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
20284static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
20285 PyObject **dictptr = NULL;
20286 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
20288#if CYTHON_COMPILING_IN_CPYTHON
20289 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
20291 dictptr = _PyObject_GetDictPtr(obj);
20294 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
20296static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
20297 PyObject *dict = Py_TYPE(obj)->tp_dict;
20298 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
20300 return obj_dict_version == __Pyx_get_object_dict_version(obj);
20305#if CYTHON_USE_DICT_VERSIONS
20306static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
20308static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
20312#if !CYTHON_AVOID_BORROWED_REFS
20313#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
20314 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
20315 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20316 if (likely(result)) {
20317 return __Pyx_NewRef(result);
20318 }
else if (unlikely(PyErr_Occurred())) {
20322 result = PyDict_GetItem(__pyx_d, name);
20323 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20324 if (likely(result)) {
20325 return __Pyx_NewRef(result);
20329 result = PyObject_GetItem(__pyx_d, name);
20330 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
20331 if (likely(result)) {
20332 return __Pyx_NewRef(result);
20336 return __Pyx_GetBuiltinName(name);
20340#if CYTHON_COMPILING_IN_CPYTHON
20341static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
20343 ternaryfunc call = Py_TYPE(func)->tp_call;
20344 if (unlikely(!call))
20345 return PyObject_Call(func, arg, kw);
20346 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
20348 result = (*call)(func, arg, kw);
20349 Py_LeaveRecursiveCall();
20350 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
20353 "NULL result without error in PyObject_Call");
20360#if CYTHON_FAST_PYCCALL
20361static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
20362 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
20363 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
20364 PyObject *self = PyCFunction_GET_SELF(func);
20365 int flags = PyCFunction_GET_FLAGS(func);
20366 assert(PyCFunction_Check(func));
20367 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
20368 assert(nargs >= 0);
20369 assert(nargs == 0 || args != NULL);
20373 assert(!PyErr_Occurred());
20374 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
20375 return (*((__Pyx_PyCFunctionFastWithKeywords)(
void*)meth)) (self,
args,
nargs, NULL);
20377 return (*((__Pyx_PyCFunctionFast)(
void*)meth)) (self, args, nargs);
20383#if CYTHON_FAST_PYCALL
20384static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
20385 PyObject *globals) {
20387 PyThreadState *tstate = __Pyx_PyThreadState_Current;
20388 PyObject **fastlocals;
20391 assert(globals != NULL);
20396 assert(tstate != NULL);
20397 f = PyFrame_New(tstate, co, globals, NULL);
20401 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
20402 for (i = 0; i < na; i++) {
20404 fastlocals[i] = *
args++;
20406 result = PyEval_EvalFrameEx(f,0);
20407 ++tstate->recursion_depth;
20409 --tstate->recursion_depth;
20412#if 1 || PY_VERSION_HEX < 0x030600B1
20413static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
20414 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
20415 PyObject *globals = PyFunction_GET_GLOBALS(func);
20416 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
20418#if PY_MAJOR_VERSION >= 3
20421 PyObject *kwtuple, **
k;
20426 assert(kwargs == NULL || PyDict_Check(kwargs));
20427 nk = kwargs ? PyDict_Size(kwargs) : 0;
20428 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
20432#
if PY_MAJOR_VERSION >= 3
20433 co->co_kwonlyargcount == 0 &&
20435 likely(kwargs == NULL || nk == 0) &&
20436 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
20437 if (argdefs == NULL && co->co_argcount == nargs) {
20438 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
20441 else if (nargs == 0 && argdefs != NULL
20442 && co->co_argcount == Py_SIZE(argdefs)) {
20445 args = &PyTuple_GET_ITEM(argdefs, 0);
20446 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
20450 if (kwargs != NULL) {
20452 kwtuple = PyTuple_New(2 * nk);
20453 if (kwtuple == NULL) {
20457 k = &PyTuple_GET_ITEM(kwtuple, 0);
20459 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
20470 closure = PyFunction_GET_CLOSURE(func);
20471#if PY_MAJOR_VERSION >= 3
20472 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
20474 if (argdefs != NULL) {
20475 d = &PyTuple_GET_ITEM(argdefs, 0);
20476 nd = Py_SIZE(argdefs);
20482#if PY_MAJOR_VERSION >= 3
20483 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
20486 d, (
int)nd, kwdefs, closure);
20488 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
20491 d, (
int)nd, closure);
20493 Py_XDECREF(kwtuple);
20495 Py_LeaveRecursiveCall();
20502static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
20504 #if CYTHON_FAST_PYCALL
20505 if (PyFunction_Check(function)) {
20506 PyObject *
args[2] = {arg1, arg2};
20507 return __Pyx_PyFunction_FastCall(function, args, 2);
20510 #if CYTHON_FAST_PYCCALL
20511 if (__Pyx_PyFastCFunction_Check(function)) {
20512 PyObject *
args[2] = {arg1, arg2};
20513 return __Pyx_PyCFunction_FastCall(function, args, 2);
20516 args = PyTuple_New(2);
20517 if (unlikely(!args))
goto done;
20519 PyTuple_SET_ITEM(args, 0, arg1);
20521 PyTuple_SET_ITEM(args, 1, arg2);
20522 Py_INCREF(function);
20523 result = __Pyx_PyObject_Call(function, args, NULL);
20525 Py_DECREF(function);
20531#if CYTHON_COMPILING_IN_CPYTHON
20532static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
20533 PyObject *self, *
result;
20535 cfunc = PyCFunction_GET_FUNCTION(func);
20536 self = PyCFunction_GET_SELF(func);
20537 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
20539 result = cfunc(self, arg);
20540 Py_LeaveRecursiveCall();
20541 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
20544 "NULL result without error in PyObject_Call");
20551#if CYTHON_COMPILING_IN_CPYTHON
20552static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20554 PyObject *
args = PyTuple_New(1);
20555 if (unlikely(!args))
return NULL;
20557 PyTuple_SET_ITEM(args, 0, arg);
20558 result = __Pyx_PyObject_Call(func, args, NULL);
20562static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20563#if CYTHON_FAST_PYCALL
20564 if (PyFunction_Check(func)) {
20565 return __Pyx_PyFunction_FastCall(func, &arg, 1);
20568 if (likely(PyCFunction_Check(func))) {
20569 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
20570 return __Pyx_PyObject_CallMethO(func, arg);
20571#if CYTHON_FAST_PYCCALL
20572 }
else if (__Pyx_PyFastCFunction_Check(func)) {
20573 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
20577 return __Pyx__PyObject_CallOneArg(func, arg);
20580static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20582 PyObject *
args = PyTuple_Pack(1, arg);
20583 if (unlikely(!args))
return NULL;
20584 result = __Pyx_PyObject_Call(func, args, NULL);
20591static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
20593 if (!j)
return NULL;
20594 r = PyObject_GetItem(o, j);
20598static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
20599 CYTHON_NCP_UNUSED
int wraparound,
20600 CYTHON_NCP_UNUSED
int boundscheck) {
20601#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
20602 Py_ssize_t wrapped_i = i;
20603 if (wraparound & unlikely(i < 0)) {
20604 wrapped_i += PyList_GET_SIZE(o);
20606 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
20607 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
20611 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
20613 return PySequence_GetItem(o, i);
20616static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
20617 CYTHON_NCP_UNUSED
int wraparound,
20618 CYTHON_NCP_UNUSED
int boundscheck) {
20619#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
20620 Py_ssize_t wrapped_i = i;
20621 if (wraparound & unlikely(i < 0)) {
20622 wrapped_i += PyTuple_GET_SIZE(o);
20624 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
20625 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
20629 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
20631 return PySequence_GetItem(o, i);
20634static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list,
20635 CYTHON_NCP_UNUSED
int wraparound,
20636 CYTHON_NCP_UNUSED
int boundscheck) {
20637#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
20638 if (is_list || PyList_CheckExact(o)) {
20639 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
20640 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
20641 PyObject *r = PyList_GET_ITEM(o, n);
20646 else if (PyTuple_CheckExact(o)) {
20647 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
20648 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
20649 PyObject *r = PyTuple_GET_ITEM(o, n);
20654 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
20655 if (likely(m && m->sq_item)) {
20656 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
20657 Py_ssize_t l = m->sq_length(o);
20658 if (likely(l >= 0)) {
20661 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
20666 return m->sq_item(o, i);
20670 if (is_list || PySequence_Check(o)) {
20671 return PySequence_GetItem(o, i);
20674 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
20678#if CYTHON_USE_TYPE_SLOTS
20679static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
20681 Py_ssize_t key_value;
20682 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
20683 if (unlikely(!(m && m->sq_item))) {
20684 PyErr_Format(PyExc_TypeError,
"'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
20687 key_value = __Pyx_PyIndex_AsSsize_t(index);
20688 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
20689 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
20691 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
20693 PyErr_Format(PyExc_IndexError,
"cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
20697static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
20698 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
20699 if (likely(m && m->mp_subscript)) {
20700 return m->mp_subscript(obj, key);
20702 return __Pyx_PyObject_GetIndex(obj, key);
20707#if !CYTHON_COMPILING_IN_PYPY
20708static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval,
int inplace,
int zerodivision_check) {
20710 (void)zerodivision_check;
20711 #if PY_MAJOR_VERSION < 3
20712 if (likely(PyInt_CheckExact(op1))) {
20713 const long b = intval;
20715 long a = PyInt_AS_LONG(op1);
20716 x = (long)((
unsigned long)a + b);
20717 if (likely((x^a) >= 0 || (x^b) >= 0))
20718 return PyInt_FromLong(x);
20719 return PyLong_Type.tp_as_number->nb_add(op1, op2);
20722 #if CYTHON_USE_PYLONG_INTERNALS
20723 if (likely(PyLong_CheckExact(op1))) {
20724 const long b = intval;
20726#ifdef HAVE_LONG_LONG
20727 const PY_LONG_LONG llb = intval;
20728 PY_LONG_LONG lla, llx;
20730 const digit* digits = ((PyLongObject*)op1)->ob_digit;
20731 const Py_ssize_t size = Py_SIZE(op1);
20732 if (likely(__Pyx_sst_abs(size) <= 1)) {
20733 a = likely(size) ? digits[0] : 0;
20734 if (size == -1) a = -a;
20738 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
20739 a = -(long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
20741#ifdef HAVE_LONG_LONG
20742 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
20743 lla = -(PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
20747 CYTHON_FALLTHROUGH;
20749 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
20750 a = (long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
20752#ifdef HAVE_LONG_LONG
20753 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
20754 lla = (PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
20758 CYTHON_FALLTHROUGH;
20760 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
20761 a = -(long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
20763#ifdef HAVE_LONG_LONG
20764 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
20765 lla = -(PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
20769 CYTHON_FALLTHROUGH;
20771 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
20772 a = (long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
20774#ifdef HAVE_LONG_LONG
20775 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
20776 lla = (PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
20780 CYTHON_FALLTHROUGH;
20782 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
20783 a = -(long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
20785#ifdef HAVE_LONG_LONG
20786 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
20787 lla = -(PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
20791 CYTHON_FALLTHROUGH;
20793 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
20794 a = (long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
20796#ifdef HAVE_LONG_LONG
20797 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
20798 lla = (PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
20802 CYTHON_FALLTHROUGH;
20803 default:
return PyLong_Type.tp_as_number->nb_add(op1, op2);
20807 return PyLong_FromLong(x);
20808#ifdef HAVE_LONG_LONG
20811 return PyLong_FromLongLong(llx);
20817 if (PyFloat_CheckExact(op1)) {
20818 const long b = intval;
20819 double a = PyFloat_AS_DOUBLE(op1);
20821 PyFPE_START_PROTECT(
"add",
return NULL)
20822 result = ((double)a) + (double)b;
20823 PyFPE_END_PROTECT(result)
20824 return PyFloat_FromDouble(result);
20826 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
20831static void __Pyx_RaiseArgtupleInvalid(
20832 const char* func_name,
20834 Py_ssize_t num_min,
20835 Py_ssize_t num_max,
20836 Py_ssize_t num_found)
20838 Py_ssize_t num_expected;
20839 const char *more_or_less;
20840 if (num_found < num_min) {
20841 num_expected = num_min;
20842 more_or_less =
"at least";
20844 num_expected = num_max;
20845 more_or_less =
"at most";
20848 more_or_less =
"exactly";
20850 PyErr_Format(PyExc_TypeError,
20851 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
20852 func_name, more_or_less, num_expected,
20853 (num_expected == 1) ?
"" :
"s", num_found);
20857static void __Pyx_RaiseDoubleKeywordsError(
20858 const char* func_name,
20861 PyErr_Format(PyExc_TypeError,
20862 #
if PY_MAJOR_VERSION >= 3
20863 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
20865 "%s() got multiple values for keyword argument '%s'", func_name,
20866 PyString_AsString(kw_name));
20871static int __Pyx_ParseOptionalKeywords(
20873 PyObject **argnames[],
20875 PyObject *values[],
20876 Py_ssize_t num_pos_args,
20877 const char* function_name)
20879 PyObject *key = 0, *value = 0;
20880 Py_ssize_t pos = 0;
20882 PyObject*** first_kw_arg = argnames + num_pos_args;
20883 while (PyDict_Next(kwds, &pos, &key, &value)) {
20884 name = first_kw_arg;
20885 while (*name && (**name != key))
name++;
20887 values[
name-argnames] = value;
20890 name = first_kw_arg;
20891 #if PY_MAJOR_VERSION < 3
20892 if (likely(PyString_Check(key))) {
20894 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
20895 && _PyString_Eq(**name, key)) {
20896 values[
name-argnames] = value;
20901 if (*name)
continue;
20903 PyObject*** argname = argnames;
20904 while (argname != first_kw_arg) {
20905 if ((**argname == key) || (
20906 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
20907 && _PyString_Eq(**argname, key))) {
20908 goto arg_passed_twice;
20915 if (likely(PyUnicode_Check(key))) {
20917 int cmp = (**
name == key) ? 0 :
20918 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
20919 (__Pyx_PyUnicode_GET_LENGTH(**
name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
20921 PyUnicode_Compare(**
name, key);
20922 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
20924 values[
name-argnames] = value;
20929 if (*name)
continue;
20931 PyObject*** argname = argnames;
20932 while (argname != first_kw_arg) {
20933 int cmp = (**argname == key) ? 0 :
20934 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
20935 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
20937 PyUnicode_Compare(**argname, key);
20938 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
20939 if (cmp == 0)
goto arg_passed_twice;
20944 goto invalid_keyword_type;
20946 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
20948 goto invalid_keyword;
20953 __Pyx_RaiseDoubleKeywordsError(function_name, key);
20955invalid_keyword_type:
20956 PyErr_Format(PyExc_TypeError,
20957 "%.200s() keywords must be strings", function_name);
20960 PyErr_Format(PyExc_TypeError,
20961 #
if PY_MAJOR_VERSION < 3
20962 "%.200s() got an unexpected keyword argument '%.200s'",
20963 function_name, PyString_AsString(key));
20965 "%s() got an unexpected keyword argument '%U'",
20966 function_name, key);
20973static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname) {
20974 PyErr_Format(PyExc_UnboundLocalError,
"local variable '%s' referenced before assignment", varname);
20978#if CYTHON_USE_EXC_INFO_STACK
20979static _PyErr_StackItem *
20980__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
20982 _PyErr_StackItem *exc_info = tstate->exc_info;
20983 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
20984 exc_info->previous_item != NULL)
20986 exc_info = exc_info->previous_item;
20993#if CYTHON_FAST_THREAD_STATE
20994static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
20995 #if CYTHON_USE_EXC_INFO_STACK
20996 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
20997 *
type = exc_info->exc_type;
20998 *value = exc_info->exc_value;
20999 *tb = exc_info->exc_traceback;
21001 *
type = tstate->exc_type;
21002 *value = tstate->exc_value;
21003 *tb = tstate->exc_traceback;
21006 Py_XINCREF(*value);
21009static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
21010 PyObject *tmp_type, *tmp_value, *tmp_tb;
21011 #if CYTHON_USE_EXC_INFO_STACK
21012 _PyErr_StackItem *exc_info = tstate->exc_info;
21013 tmp_type = exc_info->exc_type;
21014 tmp_value = exc_info->exc_value;
21015 tmp_tb = exc_info->exc_traceback;
21016 exc_info->exc_type =
type;
21017 exc_info->exc_value = value;
21018 exc_info->exc_traceback = tb;
21020 tmp_type = tstate->exc_type;
21021 tmp_value = tstate->exc_value;
21022 tmp_tb = tstate->exc_traceback;
21023 tstate->exc_type =
type;
21024 tstate->exc_value = value;
21025 tstate->exc_traceback = tb;
21027 Py_XDECREF(tmp_type);
21028 Py_XDECREF(tmp_value);
21029 Py_XDECREF(tmp_tb);
21034#if CYTHON_FAST_THREAD_STATE
21035static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
21037 n = PyTuple_GET_SIZE(tuple);
21038#if PY_MAJOR_VERSION >= 3
21039 for (i=0; i<n; i++) {
21040 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
21043 for (i=0; i<n; i++) {
21044 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
21048static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
21049 PyObject *exc_type = tstate->curexc_type;
21050 if (exc_type == err)
return 1;
21051 if (unlikely(!exc_type))
return 0;
21052 if (unlikely(PyTuple_Check(err)))
21053 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
21054 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
21059#if CYTHON_FAST_THREAD_STATE
21060static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
21062static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
21065 PyObject *local_type, *local_value, *local_tb;
21066#if CYTHON_FAST_THREAD_STATE
21067 PyObject *tmp_type, *tmp_value, *tmp_tb;
21068 local_type = tstate->curexc_type;
21069 local_value = tstate->curexc_value;
21070 local_tb = tstate->curexc_traceback;
21071 tstate->curexc_type = 0;
21072 tstate->curexc_value = 0;
21073 tstate->curexc_traceback = 0;
21075 PyErr_Fetch(&local_type, &local_value, &local_tb);
21077 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
21078#if CYTHON_FAST_THREAD_STATE
21079 if (unlikely(tstate->curexc_type))
21081 if (unlikely(PyErr_Occurred()))
21084 #if PY_MAJOR_VERSION >= 3
21086 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
21090 Py_XINCREF(local_tb);
21091 Py_XINCREF(local_type);
21092 Py_XINCREF(local_value);
21093 *
type = local_type;
21094 *value = local_value;
21096#if CYTHON_FAST_THREAD_STATE
21097 #if CYTHON_USE_EXC_INFO_STACK
21099 _PyErr_StackItem *exc_info = tstate->exc_info;
21100 tmp_type = exc_info->exc_type;
21101 tmp_value = exc_info->exc_value;
21102 tmp_tb = exc_info->exc_traceback;
21103 exc_info->exc_type = local_type;
21104 exc_info->exc_value = local_value;
21105 exc_info->exc_traceback = local_tb;
21108 tmp_type = tstate->exc_type;
21109 tmp_value = tstate->exc_value;
21110 tmp_tb = tstate->exc_traceback;
21111 tstate->exc_type = local_type;
21112 tstate->exc_value = local_value;
21113 tstate->exc_traceback = local_tb;
21115 Py_XDECREF(tmp_type);
21116 Py_XDECREF(tmp_value);
21117 Py_XDECREF(tmp_tb);
21119 PyErr_SetExcInfo(local_type, local_value, local_tb);
21126 Py_XDECREF(local_type);
21127 Py_XDECREF(local_value);
21128 Py_XDECREF(local_tb);
21133#if CYTHON_FAST_THREAD_STATE
21134static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
21135 PyObject *tmp_type, *tmp_value, *tmp_tb;
21136 tmp_type = tstate->curexc_type;
21137 tmp_value = tstate->curexc_value;
21138 tmp_tb = tstate->curexc_traceback;
21139 tstate->curexc_type =
type;
21140 tstate->curexc_value = value;
21141 tstate->curexc_traceback = tb;
21142 Py_XDECREF(tmp_type);
21143 Py_XDECREF(tmp_value);
21144 Py_XDECREF(tmp_tb);
21146static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
21147 *
type = tstate->curexc_type;
21148 *value = tstate->curexc_value;
21149 *tb = tstate->curexc_traceback;
21150 tstate->curexc_type = 0;
21151 tstate->curexc_value = 0;
21152 tstate->curexc_traceback = 0;
21157#if PY_MAJOR_VERSION < 3
21158static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
21159 CYTHON_UNUSED PyObject *cause) {
21160 __Pyx_PyThreadState_declare
21162 if (!value || value == Py_None)
21166 if (!tb || tb == Py_None)
21170 if (!PyTraceBack_Check(tb)) {
21171 PyErr_SetString(PyExc_TypeError,
21172 "raise: arg 3 must be a traceback or None");
21176 if (PyType_Check(type)) {
21177#if CYTHON_COMPILING_IN_PYPY
21179 Py_INCREF(Py_None);
21183 PyErr_NormalizeException(&type, &value, &tb);
21186 PyErr_SetString(PyExc_TypeError,
21187 "instance exception may not have a separate value");
21191 type = (PyObject*) Py_TYPE(type);
21193 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
21194 PyErr_SetString(PyExc_TypeError,
21195 "raise: exception class must be a subclass of BaseException");
21199 __Pyx_PyThreadState_assign
21200 __Pyx_ErrRestore(type, value, tb);
21209static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
21210 PyObject* owned_instance = NULL;
21211 if (tb == Py_None) {
21213 }
else if (tb && !PyTraceBack_Check(tb)) {
21214 PyErr_SetString(PyExc_TypeError,
21215 "raise: arg 3 must be a traceback or None");
21218 if (value == Py_None)
21220 if (PyExceptionInstance_Check(type)) {
21222 PyErr_SetString(PyExc_TypeError,
21223 "instance exception may not have a separate value");
21227 type = (PyObject*) Py_TYPE(value);
21228 }
else if (PyExceptionClass_Check(type)) {
21229 PyObject *instance_class = NULL;
21230 if (value && PyExceptionInstance_Check(value)) {
21231 instance_class = (PyObject*) Py_TYPE(value);
21232 if (instance_class != type) {
21233 int is_subclass = PyObject_IsSubclass(instance_class, type);
21234 if (!is_subclass) {
21235 instance_class = NULL;
21236 }
else if (unlikely(is_subclass == -1)) {
21239 type = instance_class;
21243 if (!instance_class) {
21246 args = PyTuple_New(0);
21247 else if (PyTuple_Check(value)) {
21251 args = PyTuple_Pack(1, value);
21254 owned_instance = PyObject_Call(type, args, NULL);
21256 if (!owned_instance)
21258 value = owned_instance;
21259 if (!PyExceptionInstance_Check(value)) {
21260 PyErr_Format(PyExc_TypeError,
21261 "calling %R should have returned an instance of "
21262 "BaseException, not %R",
21263 type, Py_TYPE(value));
21268 PyErr_SetString(PyExc_TypeError,
21269 "raise: exception class must be a subclass of BaseException");
21273 PyObject *fixed_cause;
21274 if (cause == Py_None) {
21275 fixed_cause = NULL;
21276 }
else if (PyExceptionClass_Check(cause)) {
21277 fixed_cause = PyObject_CallObject(cause, NULL);
21278 if (fixed_cause == NULL)
21280 }
else if (PyExceptionInstance_Check(cause)) {
21281 fixed_cause = cause;
21282 Py_INCREF(fixed_cause);
21284 PyErr_SetString(PyExc_TypeError,
21285 "exception causes must derive from "
21289 PyException_SetCause(value, fixed_cause);
21291 PyErr_SetObject(type, value);
21293#if CYTHON_COMPILING_IN_PYPY
21294 PyObject *tmp_type, *tmp_value, *tmp_tb;
21295 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
21297 PyErr_Restore(tmp_type, tmp_value, tb);
21298 Py_XDECREF(tmp_tb);
21300 PyThreadState *tstate = __Pyx_PyThreadState_Current;
21301 PyObject* tmp_tb = tstate->curexc_traceback;
21302 if (tb != tmp_tb) {
21304 tstate->curexc_traceback = tb;
21305 Py_XDECREF(tmp_tb);
21310 Py_XDECREF(owned_instance);
21316static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
21318 if (unlikely(!type)) {
21319 PyErr_SetString(PyExc_SystemError,
"Missing type object");
21323 #if PY_MAJOR_VERSION == 2
21324 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
21328 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
21330 PyErr_Format(PyExc_TypeError,
21331 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
21332 name,
type->tp_name, Py_TYPE(obj)->tp_name);
21337static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
21338#if CYTHON_COMPILING_IN_PYPY
21339 return PyObject_RichCompareBool(s1, s2, equals);
21342 return (equals == Py_EQ);
21343 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
21344 const char *ps1, *ps2;
21345 Py_ssize_t length = PyBytes_GET_SIZE(s1);
21346 if (length != PyBytes_GET_SIZE(s2))
21347 return (equals == Py_NE);
21348 ps1 = PyBytes_AS_STRING(s1);
21349 ps2 = PyBytes_AS_STRING(s2);
21350 if (ps1[0] != ps2[0]) {
21351 return (equals == Py_NE);
21352 }
else if (length == 1) {
21353 return (equals == Py_EQ);
21356#if CYTHON_USE_UNICODE_INTERNALS
21357 Py_hash_t hash1, hash2;
21358 hash1 = ((PyBytesObject*)s1)->ob_shash;
21359 hash2 = ((PyBytesObject*)s2)->ob_shash;
21360 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
21361 return (equals == Py_NE);
21364 result = memcmp(ps1, ps2, (
size_t)length);
21365 return (equals == Py_EQ) ? (
result == 0) : (
result != 0);
21367 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
21368 return (equals == Py_NE);
21369 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
21370 return (equals == Py_NE);
21373 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
21376 result = __Pyx_PyObject_IsTrue(py_result);
21377 Py_DECREF(py_result);
21384static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
21385#if CYTHON_COMPILING_IN_PYPY
21386 return PyObject_RichCompareBool(s1, s2, equals);
21388#if PY_MAJOR_VERSION < 3
21389 PyObject* owned_ref = NULL;
21391 int s1_is_unicode, s2_is_unicode;
21395 s1_is_unicode = PyUnicode_CheckExact(s1);
21396 s2_is_unicode = PyUnicode_CheckExact(s2);
21397#if PY_MAJOR_VERSION < 3
21398 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
21399 owned_ref = PyUnicode_FromObject(s2);
21400 if (unlikely(!owned_ref))
21404 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
21405 owned_ref = PyUnicode_FromObject(s1);
21406 if (unlikely(!owned_ref))
21410 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
21411 return __Pyx_PyBytes_Equals(s1, s2, equals);
21414 if (s1_is_unicode & s2_is_unicode) {
21417 void *data1, *data2;
21418 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
21420 length = __Pyx_PyUnicode_GET_LENGTH(s1);
21421 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
21424#if CYTHON_USE_UNICODE_INTERNALS
21426 Py_hash_t hash1, hash2;
21427 #if CYTHON_PEP393_ENABLED
21428 hash1 = ((PyASCIIObject*)s1)->hash;
21429 hash2 = ((PyASCIIObject*)s2)->hash;
21431 hash1 = ((PyUnicodeObject*)s1)->hash;
21432 hash2 = ((PyUnicodeObject*)s2)->hash;
21434 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
21439 kind = __Pyx_PyUnicode_KIND(s1);
21440 if (kind != __Pyx_PyUnicode_KIND(s2)) {
21443 data1 = __Pyx_PyUnicode_DATA(s1);
21444 data2 = __Pyx_PyUnicode_DATA(s2);
21445 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
21447 }
else if (length == 1) {
21450 int result = memcmp(data1, data2, (
size_t)(length * kind));
21451 #if PY_MAJOR_VERSION < 3
21452 Py_XDECREF(owned_ref);
21454 return (equals == Py_EQ) ? (
result == 0) : (
result != 0);
21456 }
else if ((s1 == Py_None) & s2_is_unicode) {
21458 }
else if ((s2 == Py_None) & s1_is_unicode) {
21462 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
21463 #if PY_MAJOR_VERSION < 3
21464 Py_XDECREF(owned_ref);
21468 result = __Pyx_PyObject_IsTrue(py_result);
21469 Py_DECREF(py_result);
21473 #if PY_MAJOR_VERSION < 3
21474 Py_XDECREF(owned_ref);
21476 return (equals == Py_EQ);
21478 #if PY_MAJOR_VERSION < 3
21479 Py_XDECREF(owned_ref);
21481 return (equals == Py_NE);
21486static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
21487#if CYTHON_USE_TYPE_SLOTS
21488#if PY_MAJOR_VERSION >= 3
21489 if (likely(PyUnicode_Check(n)))
21491 if (likely(PyString_Check(n)))
21493 return __Pyx_PyObject_GetAttrStr(o, n);
21495 return PyObject_GetAttr(o, n);
21499static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
21500 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
21501 const char* encoding,
const char* errors,
21502 PyObject* (*decode_func)(
const char *s, Py_ssize_t size,
const char *errors)) {
21504 if (unlikely((start < 0) | (stop < 0))) {
21505 size_t slen = strlen(cstring);
21506 if (unlikely(slen > (
size_t) PY_SSIZE_T_MAX)) {
21507 PyErr_SetString(PyExc_OverflowError,
21508 "c-string too long to convert to Python");
21511 length = (Py_ssize_t) slen;
21520 if (unlikely(stop <= start))
21521 return __Pyx_NewRef(__pyx_empty_unicode);
21522 length = stop - start;
21525 return decode_func(cstring, length, errors);
21527 return PyUnicode_Decode(cstring, length, encoding, errors);
21532static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
21533 __Pyx_PyThreadState_declare
21534 __Pyx_PyThreadState_assign
21535 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
21537 __Pyx_PyErr_Clear();
21541static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
21542 PyObject *r = __Pyx_GetAttr(o, n);
21543 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
21547static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
21548 PyErr_Format(PyExc_ValueError,
21549 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
21553static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
21554 PyErr_Format(PyExc_ValueError,
21555 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
21556 index, (index == 1) ?
"" :
"s");
21560static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void) {
21561 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
21565static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
21566 if (unlikely(!type)) {
21567 PyErr_SetString(PyExc_SystemError,
"Missing type object");
21570 if (likely(__Pyx_TypeCheck(obj, type)))
21572 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
21573 Py_TYPE(obj)->tp_name,
type->tp_name);
21578#if CYTHON_FAST_THREAD_STATE
21579static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
21580 PyObject *tmp_type, *tmp_value, *tmp_tb;
21581 #if CYTHON_USE_EXC_INFO_STACK
21582 _PyErr_StackItem *exc_info = tstate->exc_info;
21583 tmp_type = exc_info->exc_type;
21584 tmp_value = exc_info->exc_value;
21585 tmp_tb = exc_info->exc_traceback;
21586 exc_info->exc_type = *
type;
21587 exc_info->exc_value = *value;
21588 exc_info->exc_traceback = *tb;
21590 tmp_type = tstate->exc_type;
21591 tmp_value = tstate->exc_value;
21592 tmp_tb = tstate->exc_traceback;
21593 tstate->exc_type = *
type;
21594 tstate->exc_value = *value;
21595 tstate->exc_traceback = *tb;
21598 *value = tmp_value;
21602static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
21603 PyObject *tmp_type, *tmp_value, *tmp_tb;
21604 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
21605 PyErr_SetExcInfo(*type, *value, *tb);
21607 *value = tmp_value;
21613static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
21614 PyObject *empty_list = 0;
21615 PyObject *
module = 0;
21616 PyObject *global_dict = 0;
21617 PyObject *empty_dict = 0;
21619 #if PY_MAJOR_VERSION < 3
21620 PyObject *py_import;
21621 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
21628 empty_list = PyList_New(0);
21633 global_dict = PyModule_GetDict(__pyx_m);
21636 empty_dict = PyDict_New();
21640 #if PY_MAJOR_VERSION >= 3
21642 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
21643 module = PyImport_ImportModuleLevelObject(
21644 name, global_dict, empty_dict, list, 1);
21646 if (!PyErr_ExceptionMatches(PyExc_ImportError))
21655 #if PY_MAJOR_VERSION < 3
21656 PyObject *py_level = PyInt_FromLong(level);
21659 module = PyObject_CallFunctionObjArgs(py_import,
21660 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
21661 Py_DECREF(py_level);
21663 module = PyImport_ImportModuleLevelObject(
21664 name, global_dict, empty_dict, list, level);
21669 #if PY_MAJOR_VERSION < 3
21670 Py_XDECREF(py_import);
21672 Py_XDECREF(empty_list);
21673 Py_XDECREF(empty_dict);
21678#if CYTHON_COMPILING_IN_CPYTHON
21679static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
21685 return b == &PyBaseObject_Type;
21687static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
21689 if (a == b)
return 1;
21693 n = PyTuple_GET_SIZE(mro);
21694 for (i = 0; i < n; i++) {
21695 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
21700 return __Pyx_InBases(a, b);
21702#if PY_MAJOR_VERSION == 2
21703static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
21704 PyObject *exception, *value, *tb;
21706 __Pyx_PyThreadState_declare
21707 __Pyx_PyThreadState_assign
21708 __Pyx_ErrFetch(&exception, &value, &tb);
21709 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
21710 if (unlikely(res == -1)) {
21711 PyErr_WriteUnraisable(err);
21715 res = PyObject_IsSubclass(err, exc_type2);
21716 if (unlikely(res == -1)) {
21717 PyErr_WriteUnraisable(err);
21721 __Pyx_ErrRestore(exception, value, tb);
21725static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
21726 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
21728 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
21733static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
21735 assert(PyExceptionClass_Check(exc_type));
21736 n = PyTuple_GET_SIZE(tuple);
21737#if PY_MAJOR_VERSION >= 3
21738 for (i=0; i<n; i++) {
21739 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
21742 for (i=0; i<n; i++) {
21743 PyObject *t = PyTuple_GET_ITEM(tuple, i);
21744 #if PY_MAJOR_VERSION < 3
21745 if (likely(exc_type == t))
return 1;
21747 if (likely(PyExceptionClass_Check(t))) {
21748 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
21754static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
21755 if (likely(err == exc_type))
return 1;
21756 if (likely(PyExceptionClass_Check(err))) {
21757 if (likely(PyExceptionClass_Check(exc_type))) {
21758 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
21759 }
else if (likely(PyTuple_Check(exc_type))) {
21760 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
21764 return PyErr_GivenExceptionMatches(err, exc_type);
21766static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
21767 assert(PyExceptionClass_Check(exc_type1));
21768 assert(PyExceptionClass_Check(exc_type2));
21769 if (likely(err == exc_type1 || err == exc_type2))
return 1;
21770 if (likely(PyExceptionClass_Check(err))) {
21771 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
21773 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
21778static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
21779 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
21780 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
21781 PyErr_Format(PyExc_ImportError,
21782 #
if PY_MAJOR_VERSION < 3
21783 "cannot import name %.230s", PyString_AS_STRING(name));
21785 "cannot import name %S",
name);
21792static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *o, PyObject *n) {
21794 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
21795 PyErr_SetString(PyExc_TypeError,
21796 "hasattr(): attribute name must be string");
21799 r = __Pyx_GetAttr(o, n);
21800 if (unlikely(!r)) {
21810#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
21811static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
21812 PyErr_Format(PyExc_AttributeError,
21813#
if PY_MAJOR_VERSION >= 3
21814 "'%.50s' object has no attribute '%U'",
21815 tp->tp_name, attr_name);
21817 "'%.50s' object has no attribute '%.400s'",
21818 tp->tp_name, PyString_AS_STRING(attr_name));
21822static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
21824 PyTypeObject *tp = Py_TYPE(obj);
21825 if (unlikely(!PyString_Check(attr_name))) {
21826 return PyObject_GenericGetAttr(obj, attr_name);
21828 assert(!tp->tp_dictoffset);
21829 descr = _PyType_Lookup(tp, attr_name);
21830 if (unlikely(!descr)) {
21831 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
21834 #if PY_MAJOR_VERSION < 3
21835 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
21838 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
21840 PyObject *res = f(descr, obj, (PyObject *)tp);
21850#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
21851static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
21852 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
21853 return PyObject_GenericGetAttr(obj, attr_name);
21855 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
21860static int __Pyx_SetVtable(PyObject *dict,
void *vtable) {
21861#if PY_VERSION_HEX >= 0x02070000
21862 PyObject *ob = PyCapsule_New(vtable, 0, 0);
21864 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
21868 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
21878static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(
void) {
21879 __Pyx_PyThreadState_declare
21880 __Pyx_PyThreadState_assign
21881 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
21882 __Pyx_PyErr_Clear();
21884static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
21886#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
21887 PyTypeObject* tp = Py_TYPE(obj);
21888 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
21889 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
21892 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
21893 if (unlikely(!result)) {
21894 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
21900static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
21902 PyObject *name_attr;
21903 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
21904 if (likely(name_attr)) {
21905 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
21909 if (unlikely(ret < 0)) {
21913 Py_XDECREF(name_attr);
21916static int __Pyx_setup_reduce(PyObject* type_obj) {
21918 PyObject *object_reduce = NULL;
21919 PyObject *object_reduce_ex = NULL;
21920 PyObject *reduce = NULL;
21921 PyObject *reduce_ex = NULL;
21922 PyObject *reduce_cython = NULL;
21923 PyObject *setstate = NULL;
21924 PyObject *setstate_cython = NULL;
21925#if CYTHON_USE_PYTYPE_LOOKUP
21926 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
21928 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
21930#if CYTHON_USE_PYTYPE_LOOKUP
21931 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
21933 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
21935 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex);
if (unlikely(!reduce_ex))
goto __PYX_BAD;
21936 if (reduce_ex == object_reduce_ex) {
21937#if CYTHON_USE_PYTYPE_LOOKUP
21938 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
21940 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
21942 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce);
if (unlikely(!reduce))
goto __PYX_BAD;
21943 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
21944 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
21945 if (likely(reduce_cython)) {
21946 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
21947 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
21948 }
else if (reduce == object_reduce || PyErr_Occurred()) {
21951 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
21952 if (!setstate) PyErr_Clear();
21953 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
21954 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
21955 if (likely(setstate_cython)) {
21956 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
21957 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
21958 }
else if (!setstate || PyErr_Occurred()) {
21962 PyType_Modified((PyTypeObject*)type_obj);
21967 if (!PyErr_Occurred())
21968 PyErr_Format(PyExc_RuntimeError,
"Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
21971#if !CYTHON_USE_PYTYPE_LOOKUP
21972 Py_XDECREF(object_reduce);
21973 Py_XDECREF(object_reduce_ex);
21975 Py_XDECREF(reduce);
21976 Py_XDECREF(reduce_ex);
21977 Py_XDECREF(reduce_cython);
21978 Py_XDECREF(setstate);
21979 Py_XDECREF(setstate_cython);
21984#ifndef __PYX_HAVE_RT_ImportType
21985#define __PYX_HAVE_RT_ImportType
21986static PyTypeObject *__Pyx_ImportType(PyObject *module,
const char *module_name,
const char *class_name,
21987 size_t size,
enum __Pyx_ImportType_CheckSize check_size)
21991 Py_ssize_t basicsize;
21992#ifdef Py_LIMITED_API
21993 PyObject *py_basicsize;
21995 result = PyObject_GetAttrString(module, class_name);
21998 if (!PyType_Check(result)) {
21999 PyErr_Format(PyExc_TypeError,
22000 "%.200s.%.200s is not a type object",
22001 module_name, class_name);
22004#ifndef Py_LIMITED_API
22005 basicsize = ((PyTypeObject *)result)->tp_basicsize;
22007 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
22010 basicsize = PyLong_AsSsize_t(py_basicsize);
22011 Py_DECREF(py_basicsize);
22013 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
22016 if ((
size_t)basicsize < size) {
22017 PyErr_Format(PyExc_ValueError,
22018 "%.200s.%.200s size changed, may indicate binary incompatibility. "
22019 "Expected %zd from C header, got %zd from PyObject",
22020 module_name, class_name, size, basicsize);
22023 if (check_size == __Pyx_ImportType_CheckSize_Error && (
size_t)basicsize != size) {
22024 PyErr_Format(PyExc_ValueError,
22025 "%.200s.%.200s size changed, may indicate binary incompatibility. "
22026 "Expected %zd from C header, got %zd from PyObject",
22027 module_name, class_name, size, basicsize);
22030 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (
size_t)basicsize > size) {
22031 PyOS_snprintf(warning,
sizeof(warning),
22032 "%s.%s size changed, may indicate binary incompatibility. "
22033 "Expected %zd from C header, got %zd from PyObject",
22034 module_name, class_name, size, basicsize);
22035 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
22037 return (PyTypeObject *)
result;
22039 Py_XDECREF(result);
22045#ifndef CYTHON_CLINE_IN_TRACEBACK
22046static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate,
int c_line) {
22047 PyObject *use_cline;
22048 PyObject *ptype, *pvalue, *ptraceback;
22049#if CYTHON_COMPILING_IN_CPYTHON
22050 PyObject **cython_runtime_dict;
22052 if (unlikely(!__pyx_cython_runtime)) {
22055 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
22056#if CYTHON_COMPILING_IN_CPYTHON
22057 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
22058 if (likely(cython_runtime_dict)) {
22059 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
22060 use_cline, *cython_runtime_dict,
22061 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
22065 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
22066 if (use_cline_obj) {
22067 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
22068 Py_DECREF(use_cline_obj);
22076 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
22078 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
22081 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
22087static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
22088 int start = 0, mid = 0,
end = count - 1;
22089 if (end >= 0 && code_line > entries[end].code_line) {
22092 while (start < end) {
22093 mid = start + (
end - start) / 2;
22094 if (code_line < entries[mid].code_line) {
22096 }
else if (code_line > entries[mid].code_line) {
22102 if (code_line <= entries[mid].code_line) {
22108static PyCodeObject *__pyx_find_code_object(
int code_line) {
22109 PyCodeObject* code_object;
22111 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
22114 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
22115 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
22118 code_object = __pyx_code_cache.entries[pos].code_object;
22119 Py_INCREF(code_object);
22120 return code_object;
22122static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
22124 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
22125 if (unlikely(!code_line)) {
22128 if (unlikely(!entries)) {
22129 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
22130 if (likely(entries)) {
22131 __pyx_code_cache.entries = entries;
22132 __pyx_code_cache.max_count = 64;
22133 __pyx_code_cache.count = 1;
22134 entries[0].code_line = code_line;
22135 entries[0].code_object = code_object;
22136 Py_INCREF(code_object);
22140 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
22141 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
22142 PyCodeObject* tmp = entries[pos].code_object;
22143 entries[pos].code_object = code_object;
22147 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
22148 int new_max = __pyx_code_cache.max_count + 64;
22149 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
22150 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
22151 if (unlikely(!entries)) {
22154 __pyx_code_cache.entries = entries;
22155 __pyx_code_cache.max_count = new_max;
22157 for (i=__pyx_code_cache.count; i>pos; i--) {
22158 entries[i] = entries[i-1];
22160 entries[pos].code_line = code_line;
22161 entries[pos].code_object = code_object;
22162 __pyx_code_cache.count++;
22163 Py_INCREF(code_object);
22167#include "compile.h"
22168#include "frameobject.h"
22169#include "traceback.h"
22170static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
22171 const char *funcname,
int c_line,
22172 int py_line,
const char *filename) {
22173 PyCodeObject *py_code = NULL;
22174 PyObject *py_funcname = NULL;
22175 #if PY_MAJOR_VERSION < 3
22176 PyObject *py_srcfile = NULL;
22177 py_srcfile = PyString_FromString(filename);
22178 if (!py_srcfile)
goto bad;
22181 #if PY_MAJOR_VERSION < 3
22182 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
22183 if (!py_funcname)
goto bad;
22185 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
22186 if (!py_funcname)
goto bad;
22187 funcname = PyUnicode_AsUTF8(py_funcname);
22188 if (!funcname)
goto bad;
22192 #if PY_MAJOR_VERSION < 3
22193 py_funcname = PyString_FromString(funcname);
22194 if (!py_funcname)
goto bad;
22197 #if PY_MAJOR_VERSION < 3
22198 py_code = __Pyx_PyCode_New(
22215 Py_DECREF(py_srcfile);
22217 py_code = PyCode_NewEmpty(filename, funcname, py_line);
22219 Py_XDECREF(py_funcname);
22222 Py_XDECREF(py_funcname);
22223 #if PY_MAJOR_VERSION < 3
22224 Py_XDECREF(py_srcfile);
22228static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
22229 int py_line,
const char *filename) {
22230 PyCodeObject *py_code = 0;
22231 PyFrameObject *py_frame = 0;
22232 PyThreadState *tstate = __Pyx_PyThreadState_Current;
22234 c_line = __Pyx_CLineForTraceback(tstate, c_line);
22236 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
22238 py_code = __Pyx_CreateCodeObjectForTraceback(
22239 funcname, c_line, py_line, filename);
22240 if (!py_code)
goto bad;
22241 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
22243 py_frame = PyFrame_New(
22249 if (!py_frame)
goto bad;
22250 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
22251 PyTraceBack_Here(py_frame);
22253 Py_XDECREF(py_code);
22254 Py_XDECREF(py_frame);
22257#if PY_MAJOR_VERSION < 3
22258static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags) {
22259 if (PyObject_CheckBuffer(obj))
return PyObject_GetBuffer(obj, view, flags);
22260 if (__Pyx_TypeCheck(obj, __pyx_array_type))
return __pyx_array_getbuffer(obj, view, flags);
22261 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type))
return __pyx_memoryview_getbuffer(obj, view, flags);
22262 PyErr_Format(PyExc_TypeError,
"'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
22265static void __Pyx_ReleaseBuffer(Py_buffer *view) {
22266 PyObject *obj = view->obj;
22268 if (PyObject_CheckBuffer(obj)) {
22269 PyBuffer_Release(view);
22281__pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim)
22283 int i, index, step, start;
22284 Py_ssize_t itemsize = mvs.memview->view.itemsize;
22285 if (order ==
'F') {
22292 for (i = 0; i < ndim; i++) {
22293 index = start + step * i;
22294 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
22296 itemsize *= mvs.shape[index];
22303__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
22304 void **out_start,
void **out_end,
22305 int ndim,
size_t itemsize)
22309 start =
end = slice->data;
22310 for (i = 0; i < ndim; i++) {
22311 Py_ssize_t stride = slice->strides[i];
22312 Py_ssize_t extent = slice->shape[i];
22314 *out_start = *out_end = start;
22318 end += stride * (extent - 1);
22320 start += stride * (extent - 1);
22323 *out_start = start;
22324 *out_end =
end + itemsize;
22327__pyx_slices_overlap(__Pyx_memviewslice *slice1,
22328 __Pyx_memviewslice *slice2,
22329 int ndim,
size_t itemsize)
22331 void *start1, *end1, *start2, *end2;
22332 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
22333 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
22334 return (start1 < end2) && (start2 < end1);
22338static CYTHON_INLINE PyObject *
22339__pyx_capsule_create(
void *p, CYTHON_UNUSED
const char *sig)
22342#if PY_VERSION_HEX >= 0x02070000
22343 cobj = PyCapsule_New(p, sig, NULL);
22345 cobj = PyCObject_FromVoidPtr(p, NULL);
22351static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void)
22357 S.u32 = 0x01020304;
22358 return S.u8[0] == 4;
22362static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
22363 __Pyx_BufFmt_StackElem* stack,
22364 __Pyx_TypeInfo* type) {
22365 stack[0].field = &ctx->root;
22366 stack[0].parent_offset = 0;
22367 ctx->root.type =
type;
22368 ctx->root.name =
"buffer dtype";
22369 ctx->root.offset = 0;
22371 ctx->head->field = &ctx->root;
22372 ctx->fmt_offset = 0;
22373 ctx->head->parent_offset = 0;
22374 ctx->new_packmode =
'@';
22375 ctx->enc_packmode =
'@';
22376 ctx->new_count = 1;
22377 ctx->enc_count = 0;
22379 ctx->is_complex = 0;
22380 ctx->is_valid_array = 0;
22381 ctx->struct_alignment = 0;
22382 while (
type->typegroup ==
'S') {
22384 ctx->head->field =
type->fields;
22385 ctx->head->parent_offset = 0;
22389static int __Pyx_BufFmt_ParseNumber(
const char** ts) {
22391 const char* t = *ts;
22392 if (*t <
'0' || *t >
'9') {
22395 count = *t++ -
'0';
22396 while (*t >=
'0' && *t <=
'9') {
22398 count += *t++ -
'0';
22404static int __Pyx_BufFmt_ExpectNumber(
const char **ts) {
22405 int number = __Pyx_BufFmt_ParseNumber(ts);
22407 PyErr_Format(PyExc_ValueError,\
22408 "Does not understand character buffer dtype format string ('%c')", **ts);
22411static void __Pyx_BufFmt_RaiseUnexpectedChar(
char ch) {
22412 PyErr_Format(PyExc_ValueError,
22413 "Unexpected format string character: '%c'", ch);
22415static const char* __Pyx_BufFmt_DescribeTypeChar(
char ch,
int is_complex) {
22417 case '?':
return "'bool'";
22418 case 'c':
return "'char'";
22419 case 'b':
return "'signed char'";
22420 case 'B':
return "'unsigned char'";
22421 case 'h':
return "'short'";
22422 case 'H':
return "'unsigned short'";
22423 case 'i':
return "'int'";
22424 case 'I':
return "'unsigned int'";
22425 case 'l':
return "'long'";
22426 case 'L':
return "'unsigned long'";
22427 case 'q':
return "'long long'";
22428 case 'Q':
return "'unsigned long long'";
22429 case 'f':
return (is_complex ?
"'complex float'" :
"'float'");
22430 case 'd':
return (is_complex ?
"'complex double'" :
"'double'");
22431 case 'g':
return (is_complex ?
"'complex long double'" :
"'long double'");
22432 case 'T':
return "a struct";
22433 case 'O':
return "Python object";
22434 case 'P':
return "a pointer";
22435 case 's':
case 'p':
return "a string";
22436 case 0:
return "end";
22437 default:
return "unparseable format string";
22440static size_t __Pyx_BufFmt_TypeCharToStandardSize(
char ch,
int is_complex) {
22442 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
22443 case 'h':
case 'H':
return 2;
22444 case 'i':
case 'I':
case 'l':
case 'L':
return 4;
22445 case 'q':
case 'Q':
return 8;
22446 case 'f':
return (is_complex ? 8 : 4);
22447 case 'd':
return (is_complex ? 16 : 8);
22449 PyErr_SetString(PyExc_ValueError,
"Python does not define a standard format string size for long double ('g')..");
22452 case 'O':
case 'P':
return sizeof(
void*);
22454 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22458static size_t __Pyx_BufFmt_TypeCharToNativeSize(
char ch,
int is_complex) {
22460 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
22461 case 'h':
case 'H':
return sizeof(short);
22462 case 'i':
case 'I':
return sizeof(
int);
22463 case 'l':
case 'L':
return sizeof(long);
22464 #ifdef HAVE_LONG_LONG
22465 case 'q':
case 'Q':
return sizeof(PY_LONG_LONG);
22467 case 'f':
return sizeof(float) * (is_complex ? 2 : 1);
22468 case 'd':
return sizeof(double) * (is_complex ? 2 : 1);
22469 case 'g':
return sizeof(
long double) * (is_complex ? 2 : 1);
22470 case 'O':
case 'P':
return sizeof(
void*);
22472 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22477typedef struct {
char c;
short x; } __Pyx_st_short;
22478typedef struct {
char c;
int x; } __Pyx_st_int;
22479typedef struct {
char c;
long x; } __Pyx_st_long;
22480typedef struct {
char c;
float x; } __Pyx_st_float;
22481typedef struct {
char c;
double x; } __Pyx_st_double;
22482typedef struct {
char c;
long double x; } __Pyx_st_longdouble;
22483typedef struct {
char c;
void *x; } __Pyx_st_void_p;
22484#ifdef HAVE_LONG_LONG
22485typedef struct {
char c; PY_LONG_LONG x; } __Pyx_st_longlong;
22487static size_t __Pyx_BufFmt_TypeCharToAlignment(
char ch, CYTHON_UNUSED
int is_complex) {
22489 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
22490 case 'h':
case 'H':
return sizeof(__Pyx_st_short) -
sizeof(
short);
22491 case 'i':
case 'I':
return sizeof(__Pyx_st_int) -
sizeof(
int);
22492 case 'l':
case 'L':
return sizeof(__Pyx_st_long) -
sizeof(
long);
22493#ifdef HAVE_LONG_LONG
22494 case 'q':
case 'Q':
return sizeof(__Pyx_st_longlong) -
sizeof(PY_LONG_LONG);
22496 case 'f':
return sizeof(__Pyx_st_float) -
sizeof(
float);
22497 case 'd':
return sizeof(__Pyx_st_double) -
sizeof(
double);
22498 case 'g':
return sizeof(__Pyx_st_longdouble) -
sizeof(
long double);
22499 case 'P':
case 'O':
return sizeof(__Pyx_st_void_p) -
sizeof(
void*);
22501 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22509typedef struct {
short x;
char c; } __Pyx_pad_short;
22510typedef struct {
int x;
char c; } __Pyx_pad_int;
22511typedef struct {
long x;
char c; } __Pyx_pad_long;
22512typedef struct {
float x;
char c; } __Pyx_pad_float;
22513typedef struct {
double x;
char c; } __Pyx_pad_double;
22514typedef struct {
long double x;
char c; } __Pyx_pad_longdouble;
22515typedef struct {
void *x;
char c; } __Pyx_pad_void_p;
22516#ifdef HAVE_LONG_LONG
22517typedef struct { PY_LONG_LONG x;
char c; } __Pyx_pad_longlong;
22519static size_t __Pyx_BufFmt_TypeCharToPadding(
char ch, CYTHON_UNUSED
int is_complex) {
22521 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
22522 case 'h':
case 'H':
return sizeof(__Pyx_pad_short) -
sizeof(
short);
22523 case 'i':
case 'I':
return sizeof(__Pyx_pad_int) -
sizeof(
int);
22524 case 'l':
case 'L':
return sizeof(__Pyx_pad_long) -
sizeof(
long);
22525#ifdef HAVE_LONG_LONG
22526 case 'q':
case 'Q':
return sizeof(__Pyx_pad_longlong) -
sizeof(PY_LONG_LONG);
22528 case 'f':
return sizeof(__Pyx_pad_float) -
sizeof(
float);
22529 case 'd':
return sizeof(__Pyx_pad_double) -
sizeof(
double);
22530 case 'g':
return sizeof(__Pyx_pad_longdouble) -
sizeof(
long double);
22531 case 'P':
case 'O':
return sizeof(__Pyx_pad_void_p) -
sizeof(
void*);
22533 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22537static char __Pyx_BufFmt_TypeCharToGroup(
char ch,
int is_complex) {
22541 case 'b':
case 'h':
case 'i':
22542 case 'l':
case 'q':
case 's':
case 'p':
22544 case '?':
case 'B':
case 'H':
case 'I':
case 'L':
case 'Q':
22546 case 'f':
case 'd':
case 'g':
22547 return (is_complex ?
'C' :
'R');
22553 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22558static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
22559 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
22560 const char* expected;
22562 if (ctx->head == NULL) {
22566 expected = ctx->head->field->type->name;
22569 PyErr_Format(PyExc_ValueError,
22570 "Buffer dtype mismatch, expected %s%s%s but got %s",
22571 quote, expected, quote,
22572 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
22574 __Pyx_StructField* field = ctx->head->field;
22575 __Pyx_StructField* parent = (ctx->head - 1)->field;
22576 PyErr_Format(PyExc_ValueError,
22577 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
22578 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
22579 parent->type->name, field->name);
22582static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
22584 size_t size, offset, arraysize = 1;
22585 if (ctx->enc_type == 0)
return 0;
22586 if (ctx->head->field->type->arraysize[0]) {
22588 if (ctx->enc_type ==
's' || ctx->enc_type ==
'p') {
22589 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
22591 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
22592 PyErr_Format(PyExc_ValueError,
22593 "Expected a dimension of size %zu, got %zu",
22594 ctx->head->field->type->arraysize[0], ctx->enc_count);
22598 if (!ctx->is_valid_array) {
22599 PyErr_Format(PyExc_ValueError,
"Expected %d dimensions, got %d",
22600 ctx->head->field->type->ndim, ndim);
22603 for (i = 0; i < ctx->head->field->type->ndim; i++) {
22604 arraysize *= ctx->head->field->type->arraysize[i];
22606 ctx->is_valid_array = 0;
22607 ctx->enc_count = 1;
22609 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
22611 __Pyx_StructField* field = ctx->head->field;
22612 __Pyx_TypeInfo*
type = field->type;
22613 if (ctx->enc_packmode ==
'@' || ctx->enc_packmode ==
'^') {
22614 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
22616 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
22618 if (ctx->enc_packmode ==
'@') {
22619 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
22620 size_t align_mod_offset;
22621 if (align_at == 0)
return -1;
22622 align_mod_offset = ctx->fmt_offset % align_at;
22623 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
22624 if (ctx->struct_alignment == 0)
22625 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
22628 if (
type->size != size ||
type->typegroup != group) {
22629 if (
type->typegroup ==
'C' &&
type->fields != NULL) {
22630 size_t parent_offset = ctx->head->parent_offset + field->offset;
22632 ctx->head->field =
type->fields;
22633 ctx->head->parent_offset = parent_offset;
22636 if ((
type->typegroup ==
'H' || group ==
'H') &&
type->size == size) {
22638 __Pyx_BufFmt_RaiseExpected(ctx);
22642 offset = ctx->head->parent_offset + field->offset;
22643 if (ctx->fmt_offset != offset) {
22644 PyErr_Format(PyExc_ValueError,
22645 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T
"d but %" CYTHON_FORMAT_SSIZE_T
"d expected",
22646 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
22649 ctx->fmt_offset += size;
22651 ctx->fmt_offset += (arraysize - 1) * size;
22654 if (field == &ctx->root) {
22656 if (ctx->enc_count != 0) {
22657 __Pyx_BufFmt_RaiseExpected(ctx);
22662 ctx->head->field = ++field;
22663 if (field->type == NULL) {
22665 field = ctx->head->field;
22667 }
else if (field->type->typegroup ==
'S') {
22668 size_t parent_offset = ctx->head->parent_offset + field->offset;
22669 if (field->type->fields->type == NULL)
continue;
22670 field = field->type->fields;
22672 ctx->head->field = field;
22673 ctx->head->parent_offset = parent_offset;
22679 }
while (ctx->enc_count);
22681 ctx->is_complex = 0;
22685__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx,
const char** tsp)
22687 const char *ts = *tsp;
22688 int i = 0, number, ndim;
22690 if (ctx->new_count != 1) {
22691 PyErr_SetString(PyExc_ValueError,
22692 "Cannot handle repeated arrays in format string");
22695 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
22696 ndim = ctx->head->field->type->ndim;
22697 while (*ts && *ts !=
')') {
22699 case ' ':
case '\f':
case '\r':
case '\n':
case '\t':
case '\v':
continue;
22702 number = __Pyx_BufFmt_ExpectNumber(&ts);
22703 if (number == -1)
return NULL;
22704 if (i < ndim && (
size_t) number != ctx->head->field->type->arraysize[i])
22705 return PyErr_Format(PyExc_ValueError,
22706 "Expected a dimension of size %zu, got %d",
22707 ctx->head->field->type->arraysize[i], number);
22708 if (*ts !=
',' && *ts !=
')')
22709 return PyErr_Format(PyExc_ValueError,
22710 "Expected a comma in format string, got '%c'", *ts);
22711 if (*ts ==
',') ts++;
22715 return PyErr_Format(PyExc_ValueError,
"Expected %d dimension(s), got %d",
22716 ctx->head->field->type->ndim, i);
22718 PyErr_SetString(PyExc_ValueError,
22719 "Unexpected end of format string, expected ')'");
22722 ctx->is_valid_array = 1;
22723 ctx->new_count = 1;
22727static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts) {
22732 if (ctx->enc_type != 0 && ctx->head == NULL) {
22733 __Pyx_BufFmt_RaiseExpected(ctx);
22736 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
22737 if (ctx->head != NULL) {
22738 __Pyx_BufFmt_RaiseExpected(ctx);
22748 if (!__Pyx_Is_Little_Endian()) {
22749 PyErr_SetString(PyExc_ValueError,
"Little-endian buffer not supported on big-endian compiler");
22752 ctx->new_packmode =
'=';
22757 if (__Pyx_Is_Little_Endian()) {
22758 PyErr_SetString(PyExc_ValueError,
"Big-endian buffer not supported on little-endian compiler");
22761 ctx->new_packmode =
'=';
22767 ctx->new_packmode = *ts++;
22771 const char* ts_after_sub;
22772 size_t i, struct_count = ctx->new_count;
22773 size_t struct_alignment = ctx->struct_alignment;
22774 ctx->new_count = 1;
22777 PyErr_SetString(PyExc_ValueError,
"Buffer acquisition: Expected '{' after 'T'");
22780 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
22782 ctx->enc_count = 0;
22783 ctx->struct_alignment = 0;
22786 for (i = 0; i != struct_count; ++i) {
22787 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
22788 if (!ts_after_sub)
return NULL;
22791 if (struct_alignment) ctx->struct_alignment = struct_alignment;
22796 size_t alignment = ctx->struct_alignment;
22798 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
22800 if (alignment && ctx->fmt_offset % alignment) {
22801 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
22806 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
22807 ctx->fmt_offset += ctx->new_count;
22808 ctx->new_count = 1;
22809 ctx->enc_count = 0;
22811 ctx->enc_packmode = ctx->new_packmode;
22817 if (*ts !=
'f' && *ts !=
'd' && *ts !=
'g') {
22818 __Pyx_BufFmt_RaiseUnexpectedChar(
'Z');
22821 CYTHON_FALLTHROUGH;
22822 case '?':
case 'c':
case 'b':
case 'B':
case 'h':
case 'H':
case 'i':
case 'I':
22823 case 'l':
case 'L':
case 'q':
case 'Q':
22824 case 'f':
case 'd':
case 'g':
22825 case 'O':
case 'p':
22826 if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
22827 (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
22828 ctx->enc_count += ctx->new_count;
22829 ctx->new_count = 1;
22834 CYTHON_FALLTHROUGH;
22836 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
22837 ctx->enc_count = ctx->new_count;
22838 ctx->enc_packmode = ctx->new_packmode;
22839 ctx->enc_type = *ts;
22840 ctx->is_complex = got_Z;
22842 ctx->new_count = 1;
22847 while(*ts !=
':') ++ts;
22851 if (!__pyx_buffmt_parse_array(ctx, &ts))
return NULL;
22855 int number = __Pyx_BufFmt_ExpectNumber(&ts);
22856 if (number == -1)
return NULL;
22857 ctx->new_count = (size_t)number;
22865__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
22872 if (a->size != b->size || a->typegroup != b->typegroup ||
22873 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
22874 if (a->typegroup ==
'H' || b->typegroup ==
'H') {
22875 return a->size == b->size;
22881 for (i = 0; i < a->ndim; i++)
22882 if (a->arraysize[i] != b->arraysize[i])
22885 if (a->typegroup ==
'S') {
22886 if (a->flags != b->flags)
22888 if (a->fields || b->fields) {
22889 if (!(a->fields && b->fields))
22891 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
22892 __Pyx_StructField *field_a = a->fields + i;
22893 __Pyx_StructField *field_b = b->fields + i;
22894 if (field_a->offset != field_b->offset ||
22895 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
22898 return !a->fields[i].type && !b->fields[i].type;
22906__pyx_check_strides(Py_buffer *buf,
int dim,
int ndim,
int spec)
22908 if (buf->shape[dim] <= 1)
22910 if (buf->strides) {
22911 if (spec & __Pyx_MEMVIEW_CONTIG) {
22912 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
22913 if (unlikely(buf->strides[dim] !=
sizeof(
void *))) {
22914 PyErr_Format(PyExc_ValueError,
22915 "Buffer is not indirectly contiguous "
22916 "in dimension %d.", dim);
22919 }
else if (unlikely(buf->strides[dim] != buf->itemsize)) {
22920 PyErr_SetString(PyExc_ValueError,
22921 "Buffer and memoryview are not contiguous "
22922 "in the same dimension.");
22926 if (spec & __Pyx_MEMVIEW_FOLLOW) {
22927 Py_ssize_t stride = buf->strides[
dim];
22930 if (unlikely(stride < buf->itemsize)) {
22931 PyErr_SetString(PyExc_ValueError,
22932 "Buffer and memoryview are not contiguous "
22933 "in the same dimension.");
22938 if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
22939 PyErr_Format(PyExc_ValueError,
22940 "C-contiguous buffer is not contiguous in "
22941 "dimension %d", dim);
22943 }
else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
22944 PyErr_Format(PyExc_ValueError,
22945 "C-contiguous buffer is not indirect in "
22946 "dimension %d", dim);
22948 }
else if (unlikely(buf->suboffsets)) {
22949 PyErr_SetString(PyExc_ValueError,
22950 "Buffer exposes suboffsets but no strides");
22959__pyx_check_suboffsets(Py_buffer *buf,
int dim, CYTHON_UNUSED
int ndim,
int spec)
22961 if (spec & __Pyx_MEMVIEW_DIRECT) {
22962 if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
22963 PyErr_Format(PyExc_ValueError,
22964 "Buffer not compatible with direct access "
22965 "in dimension %d.", dim);
22969 if (spec & __Pyx_MEMVIEW_PTR) {
22970 if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
22971 PyErr_Format(PyExc_ValueError,
22972 "Buffer is not indirectly accessible "
22973 "in dimension %d.", dim);
22982__pyx_verify_contig(Py_buffer *buf,
int ndim,
int c_or_f_flag)
22985 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
22986 Py_ssize_t stride = 1;
22987 for (i = 0; i < ndim; i++) {
22988 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
22989 PyErr_SetString(PyExc_ValueError,
22990 "Buffer not fortran contiguous.");
22993 stride = stride * buf->shape[i];
22995 }
else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
22996 Py_ssize_t stride = 1;
22997 for (i = ndim - 1; i >- 1; i--) {
22998 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
22999 PyErr_SetString(PyExc_ValueError,
23000 "Buffer not C contiguous.");
23003 stride = stride * buf->shape[i];
23010static int __Pyx_ValidateAndInit_memviewslice(
23015 __Pyx_TypeInfo *dtype,
23016 __Pyx_BufFmt_StackElem stack[],
23017 __Pyx_memviewslice *memviewslice,
23018 PyObject *original_obj)
23020 struct __pyx_memoryview_obj *memview, *new_memview;
23021 __Pyx_RefNannyDeclarations
23023 int i, spec = 0, retval = -1;
23024 __Pyx_BufFmt_Context ctx;
23025 int from_memoryview = __pyx_memoryview_check(original_obj);
23026 __Pyx_RefNannySetupContext(
"ValidateAndInit_memviewslice", 0);
23027 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((
struct __pyx_memoryview_obj *)
23028 original_obj)->typeinfo)) {
23029 memview = (
struct __pyx_memoryview_obj *) original_obj;
23030 new_memview = NULL;
23032 memview = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
23033 original_obj, buf_flags, 0, dtype);
23034 new_memview = memview;
23035 if (unlikely(!memview))
23038 buf = &memview->view;
23039 if (unlikely(buf->ndim != ndim)) {
23040 PyErr_Format(PyExc_ValueError,
23041 "Buffer has wrong number of dimensions (expected %d, got %d)",
23046 __Pyx_BufFmt_Init(&ctx, stack, dtype);
23047 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format)))
goto fail;
23049 if (unlikely((
unsigned) buf->itemsize != dtype->size)) {
23050 PyErr_Format(PyExc_ValueError,
23051 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T
"u byte%s) "
23052 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T
"u byte%s)",
23054 (buf->itemsize > 1) ?
"s" :
"",
23057 (dtype->size > 1) ?
"s" :
"");
23060 if (buf->len > 0) {
23061 for (i = 0; i < ndim; i++) {
23062 spec = axes_specs[i];
23063 if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
23065 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
23068 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
23071 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
23072 new_memview != NULL) == -1)) {
23078 Py_XDECREF(new_memview);
23081 __Pyx_RefNannyFinishContext();
23086 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj,
int writable_flag) {
23087 __Pyx_memviewslice
result = { 0, 0, { 0 }, { 0 }, { 0 } };
23088 __Pyx_BufFmt_StackElem stack[1];
23089 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
23091 if (obj == Py_None) {
23092 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
23095 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
23096 PyBUF_RECORDS_RO | writable_flag, 2,
23097 &__Pyx_TypeInfo_float, stack,
23099 if (unlikely(retcode == -1))
23109 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_long(PyObject *obj,
int writable_flag) {
23110 __Pyx_memviewslice
result = { 0, 0, { 0 }, { 0 }, { 0 } };
23111 __Pyx_BufFmt_StackElem stack[1];
23112 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
23114 if (obj == Py_None) {
23115 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
23118 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
23119 PyBUF_RECORDS_RO | writable_flag, 1,
23120 &__Pyx_TypeInfo_long, stack,
23122 if (unlikely(retcode == -1))
23132 #if CYTHON_CCOMPLEX
23134 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
23135 return ::std::complex< float >(x, y);
23138 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
23139 return x + y*(__pyx_t_float_complex)_Complex_I;
23143 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
23144 __pyx_t_float_complex z;
23152 #if CYTHON_CCOMPLEX
23154 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
23155 return (a.real == b.real) && (a.imag == b.imag);
23157 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
23158 __pyx_t_float_complex z;
23159 z.real = a.real + b.real;
23160 z.imag = a.imag + b.imag;
23163 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
23164 __pyx_t_float_complex z;
23165 z.real = a.real - b.real;
23166 z.imag = a.imag - b.imag;
23169 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
23170 __pyx_t_float_complex z;
23171 z.real = a.real * b.real - a.imag * b.imag;
23172 z.imag = a.real * b.imag + a.imag * b.real;
23176 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
23178 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
23179 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
23180 if (b.real == 0 && b.imag == 0) {
23181 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
23183 float r = b.imag / b.real;
23184 float s = (float)(1.0) / (b.real + b.imag * r);
23185 return __pyx_t_float_complex_from_parts(
23186 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
23189 float r = b.real / b.imag;
23190 float s = (float)(1.0) / (b.imag + b.real * r);
23191 return __pyx_t_float_complex_from_parts(
23192 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
23196 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
23198 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
23200 float denom = b.real * b.real + b.imag * b.imag;
23201 return __pyx_t_float_complex_from_parts(
23202 (a.real * b.real + a.imag * b.imag) / denom,
23203 (a.imag * b.real - a.real * b.imag) / denom);
23207 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
23208 __pyx_t_float_complex z;
23213 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
23214 return (a.real == 0) && (a.imag == 0);
23216 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
23217 __pyx_t_float_complex z;
23223 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex z) {
23224 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
23225 return sqrtf(z.real*z.real + z.imag*z.imag);
23227 return hypotf(z.real, z.imag);
23230 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
23231 __pyx_t_float_complex z;
23232 float r, lnr, theta, z_r, z_theta;
23233 if (b.imag == 0 && b.real == (
int)b.real) {
23235 float denom = a.real * a.real + a.imag * a.imag;
23236 a.real = a.real / denom;
23237 a.imag = -a.imag / denom;
23240 switch ((
int)b.real) {
23248 return __Pyx_c_prod_float(a, a);
23250 z = __Pyx_c_prod_float(a, a);
23251 return __Pyx_c_prod_float(z, a);
23253 z = __Pyx_c_prod_float(a, a);
23254 return __Pyx_c_prod_float(z, z);
23260 }
else if (b.imag == 0) {
23261 z.real = powf(a.real, b.real);
23264 }
else if (a.real > 0) {
23269 theta = atan2f(0.0, -1.0);
23272 r = __Pyx_c_abs_float(a);
23273 theta = atan2f(a.imag, a.real);
23276 z_r = expf(lnr * b.real - theta * b.imag);
23277 z_theta = theta * b.real + lnr * b.imag;
23278 z.real = z_r * cosf(z_theta);
23279 z.imag = z_r * sinf(z_theta);
23286 #if CYTHON_CCOMPLEX
23288 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
23289 return ::std::complex< double >(x, y);
23292 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
23293 return x + y*(__pyx_t_double_complex)_Complex_I;
23297 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
23298 __pyx_t_double_complex z;
23306 #if CYTHON_CCOMPLEX
23308 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
23309 return (a.real == b.real) && (a.imag == b.imag);
23311 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
23312 __pyx_t_double_complex z;
23313 z.real = a.real + b.real;
23314 z.imag = a.imag + b.imag;
23317 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
23318 __pyx_t_double_complex z;
23319 z.real = a.real - b.real;
23320 z.imag = a.imag - b.imag;
23323 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
23324 __pyx_t_double_complex z;
23325 z.real = a.real * b.real - a.imag * b.imag;
23326 z.imag = a.real * b.imag + a.imag * b.real;
23330 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
23332 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
23333 }
else if (fabs(b.real) >= fabs(b.imag)) {
23334 if (b.real == 0 && b.imag == 0) {
23335 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
23337 double r = b.imag / b.real;
23338 double s = (double)(1.0) / (b.real + b.imag * r);
23339 return __pyx_t_double_complex_from_parts(
23340 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
23343 double r = b.real / b.imag;
23344 double s = (double)(1.0) / (b.imag + b.real * r);
23345 return __pyx_t_double_complex_from_parts(
23346 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
23350 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
23352 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
23354 double denom = b.real * b.real + b.imag * b.imag;
23355 return __pyx_t_double_complex_from_parts(
23356 (a.real * b.real + a.imag * b.imag) / denom,
23357 (a.imag * b.real - a.real * b.imag) / denom);
23361 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
23362 __pyx_t_double_complex z;
23367 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
23368 return (a.real == 0) && (a.imag == 0);
23370 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
23371 __pyx_t_double_complex z;
23377 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex z) {
23378 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
23379 return sqrt(z.real*z.real + z.imag*z.imag);
23381 return hypot(z.real, z.imag);
23384 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
23385 __pyx_t_double_complex z;
23386 double r, lnr, theta, z_r, z_theta;
23387 if (b.imag == 0 && b.real == (
int)b.real) {
23389 double denom = a.real * a.real + a.imag * a.imag;
23390 a.real = a.real / denom;
23391 a.imag = -a.imag / denom;
23394 switch ((
int)b.real) {
23402 return __Pyx_c_prod_double(a, a);
23404 z = __Pyx_c_prod_double(a, a);
23405 return __Pyx_c_prod_double(z, a);
23407 z = __Pyx_c_prod_double(a, a);
23408 return __Pyx_c_prod_double(z, z);
23414 }
else if (b.imag == 0) {
23415 z.real = pow(a.real, b.real);
23418 }
else if (a.real > 0) {
23423 theta = atan2(0.0, -1.0);
23426 r = __Pyx_c_abs_double(a);
23427 theta = atan2(a.imag, a.real);
23430 z_r = exp(lnr * b.real - theta * b.imag);
23431 z_theta = theta * b.real + lnr * b.imag;
23432 z.real = z_r * cos(z_theta);
23433 z.imag = z_r * sin(z_theta);
23440 static CYTHON_INLINE PyObject *__pyx_memview_get_float(
const char *itemp) {
23441 return (PyObject *) PyFloat_FromDouble(*(
float *) itemp);
23443static CYTHON_INLINE
int __pyx_memview_set_float(
const char *itemp, PyObject *obj) {
23444 float value = __pyx_PyFloat_AsFloat(obj);
23445 if ((value == (
float)-1) && PyErr_Occurred())
23447 *(
float *) itemp = value;
23452 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
23453 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
23454#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
23455 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
23456#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
23458 func_type value = func_value;\
23459 if (sizeof(target_type) < sizeof(func_type)) {\
23460 if (unlikely(value != (func_type) (target_type) value)) {\
23461 func_type zero = 0;\
23462 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
23463 return (target_type) -1;\
23464 if (is_unsigned && unlikely(value < zero))\
23465 goto raise_neg_overflow;\
23467 goto raise_overflow;\
23470 return (target_type) value;\
23474 static CYTHON_INLINE PyObject *__pyx_memview_get_long(
const char *itemp) {
23475 return (PyObject *) __Pyx_PyInt_From_long(*(
long *) itemp);
23477static CYTHON_INLINE
int __pyx_memview_set_long(
const char *itemp, PyObject *obj) {
23478 long value = __Pyx_PyInt_As_long(obj);
23479 if ((value == (
long)-1) && PyErr_Occurred())
23481 *(
long *) itemp = value;
23486 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_long(PyObject *obj,
int writable_flag) {
23487 __Pyx_memviewslice
result = { 0, 0, { 0 }, { 0 }, { 0 } };
23488 __Pyx_BufFmt_StackElem stack[1];
23489 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
23491 if (obj == Py_None) {
23492 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
23495 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
23496 PyBUF_RECORDS_RO | writable_flag, 2,
23497 &__Pyx_TypeInfo_long, stack,
23499 if (unlikely(retcode == -1))
23509 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj,
int writable_flag) {
23510 __Pyx_memviewslice
result = { 0, 0, { 0 }, { 0 }, { 0 } };
23511 __Pyx_BufFmt_StackElem stack[1];
23512 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
23514 if (obj == Py_None) {
23515 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
23518 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
23519 PyBUF_RECORDS_RO | writable_flag, 1,
23520 &__Pyx_TypeInfo_float, stack,
23522 if (unlikely(retcode == -1))
23532 static __Pyx_memviewslice
23533__pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
23534 const char *mode,
int ndim,
23535 size_t sizeof_dtype,
int contig_flag,
23536 int dtype_is_object)
23538 __Pyx_RefNannyDeclarations
23540 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
23541 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
23542 Py_buffer *buf = &from_memview->view;
23543 PyObject *shape_tuple = NULL;
23544 PyObject *temp_int = NULL;
23545 struct __pyx_array_obj *array_obj = NULL;
23546 struct __pyx_memoryview_obj *memview_obj = NULL;
23547 __Pyx_RefNannySetupContext(
"__pyx_memoryview_copy_new_contig", 0);
23548 for (i = 0; i < ndim; i++) {
23549 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
23550 PyErr_Format(PyExc_ValueError,
"Cannot copy memoryview slice with "
23551 "indirect dimensions (axis %d)", i);
23555 shape_tuple = PyTuple_New(ndim);
23556 if (unlikely(!shape_tuple)) {
23559 __Pyx_GOTREF(shape_tuple);
23560 for(i = 0; i < ndim; i++) {
23561 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
23562 if(unlikely(!temp_int)) {
23565 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
23569 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (
char *) mode, NULL);
23570 if (unlikely(!array_obj)) {
23573 __Pyx_GOTREF(array_obj);
23574 memview_obj = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
23575 (PyObject *) array_obj, contig_flag,
23577 from_mvs->memview->typeinfo);
23578 if (unlikely(!memview_obj))
23580 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
23582 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
23583 dtype_is_object) < 0))
23587 __Pyx_XDECREF(new_mvs.memview);
23588 new_mvs.memview = NULL;
23589 new_mvs.data = NULL;
23591 __Pyx_XDECREF(shape_tuple);
23592 __Pyx_XDECREF(temp_int);
23593 __Pyx_XDECREF(array_obj);
23594 __Pyx_RefNannyFinishContext();
23599 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
23600#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23601#pragma GCC diagnostic push
23602#pragma GCC diagnostic ignored "-Wconversion"
23604 const long neg_one = (long) -1, const_zero = (
long) 0;
23605#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23606#pragma GCC diagnostic pop
23608 const int is_unsigned = neg_one > const_zero;
23610 if (
sizeof(
long) <
sizeof(long)) {
23611 return PyInt_FromLong((
long) value);
23612 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
23613 return PyLong_FromUnsignedLong((
unsigned long) value);
23614#ifdef HAVE_LONG_LONG
23615 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
23616 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
23620 if (
sizeof(
long) <=
sizeof(
long)) {
23621 return PyInt_FromLong((
long) value);
23622#ifdef HAVE_LONG_LONG
23623 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
23624 return PyLong_FromLongLong((PY_LONG_LONG) value);
23629 int one = 1;
int little = (
int)*(
unsigned char *)&one;
23630 unsigned char *bytes = (
unsigned char *)&value;
23631 return _PyLong_FromByteArray(bytes,
sizeof(
long),
23632 little, !is_unsigned);
23637 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
23638#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23639#pragma GCC diagnostic push
23640#pragma GCC diagnostic ignored "-Wconversion"
23642 const long neg_one = (long) -1, const_zero = (
long) 0;
23643#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23644#pragma GCC diagnostic pop
23646 const int is_unsigned = neg_one > const_zero;
23647#if PY_MAJOR_VERSION < 3
23648 if (likely(PyInt_Check(x))) {
23649 if (
sizeof(
long) <
sizeof(long)) {
23650 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
23652 long val = PyInt_AS_LONG(x);
23653 if (is_unsigned && unlikely(val < 0)) {
23654 goto raise_neg_overflow;
23660 if (likely(PyLong_Check(x))) {
23662#if CYTHON_USE_PYLONG_INTERNALS
23663 const digit* digits = ((PyLongObject*)x)->ob_digit;
23664 switch (Py_SIZE(x)) {
23665 case 0:
return (
long) 0;
23666 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
23668 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
23669 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23670 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23671 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
23672 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
23677 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
23678 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23679 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23680 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
23681 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
23686 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
23687 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23688 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23689 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
23690 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
23696#if CYTHON_COMPILING_IN_CPYTHON
23697 if (unlikely(Py_SIZE(x) < 0)) {
23698 goto raise_neg_overflow;
23702 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
23703 if (unlikely(result < 0))
23705 if (unlikely(result == 1))
23706 goto raise_neg_overflow;
23709 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
23710 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
23711#ifdef HAVE_LONG_LONG
23712 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
23713 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
23717#if CYTHON_USE_PYLONG_INTERNALS
23718 const digit* digits = ((PyLongObject*)x)->ob_digit;
23719 switch (Py_SIZE(x)) {
23720 case 0:
return (
long) 0;
23721 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
23722 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
23724 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
23725 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23726 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23727 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23728 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
23733 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
23734 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23735 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23736 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23737 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
23742 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
23743 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23744 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23745 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23746 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23751 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
23752 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23753 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23754 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23755 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
23760 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
23761 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23762 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23763 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
23764 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
23769 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
23770 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23771 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23772 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
23773 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
23779 if (
sizeof(
long) <=
sizeof(long)) {
23780 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
23781#ifdef HAVE_LONG_LONG
23782 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
23783 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
23788#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
23789 PyErr_SetString(PyExc_RuntimeError,
23790 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
23793 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
23794 #if PY_MAJOR_VERSION < 3
23795 if (likely(v) && !PyLong_Check(v)) {
23797 v = PyNumber_Long(tmp);
23802 int one = 1;
int is_little = (
int)*(
unsigned char *)&one;
23803 unsigned char *bytes = (
unsigned char *)&val;
23804 int ret = _PyLong_AsByteArray((PyLongObject *)v,
23805 bytes,
sizeof(val),
23806 is_little, !is_unsigned);
23816 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
23817 if (!tmp)
return (
long) -1;
23818 val = __Pyx_PyInt_As_long(tmp);
23823 PyErr_SetString(PyExc_OverflowError,
23824 "value too large to convert to long");
23827 PyErr_SetString(PyExc_OverflowError,
23828 "can't convert negative value to long");
23833 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
23834#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23835#pragma GCC diagnostic push
23836#pragma GCC diagnostic ignored "-Wconversion"
23838 const int neg_one = (
int) -1, const_zero = (
int) 0;
23839#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23840#pragma GCC diagnostic pop
23842 const int is_unsigned = neg_one > const_zero;
23843#if PY_MAJOR_VERSION < 3
23844 if (likely(PyInt_Check(x))) {
23845 if (
sizeof(
int) <
sizeof(long)) {
23846 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
23848 long val = PyInt_AS_LONG(x);
23849 if (is_unsigned && unlikely(val < 0)) {
23850 goto raise_neg_overflow;
23856 if (likely(PyLong_Check(x))) {
23858#if CYTHON_USE_PYLONG_INTERNALS
23859 const digit* digits = ((PyLongObject*)x)->ob_digit;
23860 switch (Py_SIZE(x)) {
23861 case 0:
return (
int) 0;
23862 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
23864 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
23865 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23866 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23867 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
23868 return (
int) (((((
int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
23873 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
23874 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23875 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23876 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
23877 return (
int) (((((((
int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
23882 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
23883 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23884 __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])))
23885 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
23886 return (
int) (((((((((
int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
23892#if CYTHON_COMPILING_IN_CPYTHON
23893 if (unlikely(Py_SIZE(x) < 0)) {
23894 goto raise_neg_overflow;
23898 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
23899 if (unlikely(result < 0))
23901 if (unlikely(result == 1))
23902 goto raise_neg_overflow;
23905 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
23906 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
23907#ifdef HAVE_LONG_LONG
23908 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
23909 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
23913#if CYTHON_USE_PYLONG_INTERNALS
23914 const digit* digits = ((PyLongObject*)x)->ob_digit;
23915 switch (Py_SIZE(x)) {
23916 case 0:
return (
int) 0;
23917 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
23918 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
23920 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
23921 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23922 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23923 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
23924 return (
int) (((
int)-1)*(((((
int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
23929 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
23930 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
23931 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23932 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
23933 return (
int) ((((((
int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
23938 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
23939 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23940 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23941 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
23942 return (
int) (((
int)-1)*(((((((
int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
23947 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
23948 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
23949 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
23950 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
23951 return (
int) ((((((((
int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
23956 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
23957 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23958 __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])))
23959 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
23960 return (
int) (((
int)-1)*(((((((((
int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
23965 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
23966 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
23967 __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])))
23968 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
23969 return (
int) ((((((((((
int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
23975 if (
sizeof(
int) <=
sizeof(long)) {
23976 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
23977#ifdef HAVE_LONG_LONG
23978 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
23979 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
23984#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
23985 PyErr_SetString(PyExc_RuntimeError,
23986 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
23989 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
23990 #if PY_MAJOR_VERSION < 3
23991 if (likely(v) && !PyLong_Check(v)) {
23993 v = PyNumber_Long(tmp);
23998 int one = 1;
int is_little = (
int)*(
unsigned char *)&one;
23999 unsigned char *bytes = (
unsigned char *)&val;
24000 int ret = _PyLong_AsByteArray((PyLongObject *)v,
24001 bytes,
sizeof(val),
24002 is_little, !is_unsigned);
24012 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
24013 if (!tmp)
return (
int) -1;
24014 val = __Pyx_PyInt_As_int(tmp);
24019 PyErr_SetString(PyExc_OverflowError,
24020 "value too large to convert to int");
24023 PyErr_SetString(PyExc_OverflowError,
24024 "can't convert negative value to int");
24029 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
24030#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24031#pragma GCC diagnostic push
24032#pragma GCC diagnostic ignored "-Wconversion"
24034 const int neg_one = (
int) -1, const_zero = (
int) 0;
24035#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24036#pragma GCC diagnostic pop
24038 const int is_unsigned = neg_one > const_zero;
24040 if (
sizeof(
int) <
sizeof(long)) {
24041 return PyInt_FromLong((
long) value);
24042 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
24043 return PyLong_FromUnsignedLong((
unsigned long) value);
24044#ifdef HAVE_LONG_LONG
24045 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
24046 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
24050 if (
sizeof(
int) <=
sizeof(
long)) {
24051 return PyInt_FromLong((
long) value);
24052#ifdef HAVE_LONG_LONG
24053 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
24054 return PyLong_FromLongLong((PY_LONG_LONG) value);
24059 int one = 1;
int little = (
int)*(
unsigned char *)&one;
24060 unsigned char *bytes = (
unsigned char *)&value;
24061 return _PyLong_FromByteArray(bytes,
sizeof(
int),
24062 little, !is_unsigned);
24067 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *x) {
24068#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24069#pragma GCC diagnostic push
24070#pragma GCC diagnostic ignored "-Wconversion"
24072 const char neg_one = (char) -1, const_zero = (
char) 0;
24073#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24074#pragma GCC diagnostic pop
24076 const int is_unsigned = neg_one > const_zero;
24077#if PY_MAJOR_VERSION < 3
24078 if (likely(PyInt_Check(x))) {
24079 if (
sizeof(
char) <
sizeof(long)) {
24080 __PYX_VERIFY_RETURN_INT(
char,
long, PyInt_AS_LONG(x))
24082 long val = PyInt_AS_LONG(x);
24083 if (is_unsigned && unlikely(val < 0)) {
24084 goto raise_neg_overflow;
24090 if (likely(PyLong_Check(x))) {
24092#if CYTHON_USE_PYLONG_INTERNALS
24093 const digit* digits = ((PyLongObject*)x)->ob_digit;
24094 switch (Py_SIZE(x)) {
24095 case 0:
return (
char) 0;
24096 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, digits[0])
24098 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
24099 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
24100 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
24101 }
else if (8 *
sizeof(
char) >= 2 * PyLong_SHIFT) {
24102 return (
char) (((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
24107 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
24108 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
24109 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
24110 }
else if (8 *
sizeof(
char) >= 3 * PyLong_SHIFT) {
24111 return (
char) (((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
24116 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
24117 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
24118 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
24119 }
else if (8 *
sizeof(
char) >= 4 * PyLong_SHIFT) {
24120 return (
char) (((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
24126#if CYTHON_COMPILING_IN_CPYTHON
24127 if (unlikely(Py_SIZE(x) < 0)) {
24128 goto raise_neg_overflow;
24132 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
24133 if (unlikely(result < 0))
24135 if (unlikely(result == 1))
24136 goto raise_neg_overflow;
24139 if (
sizeof(
char) <=
sizeof(
unsigned long)) {
24140 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned long, PyLong_AsUnsignedLong(x))
24141#ifdef HAVE_LONG_LONG
24142 }
else if (
sizeof(
char) <=
sizeof(
unsigned PY_LONG_LONG)) {
24143 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
24147#if CYTHON_USE_PYLONG_INTERNALS
24148 const digit* digits = ((PyLongObject*)x)->ob_digit;
24149 switch (Py_SIZE(x)) {
24150 case 0:
return (
char) 0;
24151 case -1: __PYX_VERIFY_RETURN_INT(
char, sdigit, (sdigit) (-(sdigit)digits[0]))
24152 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, +digits[0])
24154 if (8 *
sizeof(
char) - 1 > 1 * PyLong_SHIFT) {
24155 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
24156 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
24157 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
24158 return (
char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
24163 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
24164 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
24165 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
24166 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
24167 return (
char) ((((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
24172 if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
24173 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
24174 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
24175 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
24176 return (
char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
24181 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
24182 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
24183 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
24184 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
24185 return (
char) ((((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
24190 if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
24191 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
24192 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
24193 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
24194 return (
char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
24199 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
24200 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
24201 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
24202 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
24203 return (
char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
24209 if (
sizeof(
char) <=
sizeof(long)) {
24210 __PYX_VERIFY_RETURN_INT_EXC(
char,
long, PyLong_AsLong(x))
24211#ifdef HAVE_LONG_LONG
24212 }
else if (
sizeof(
char) <=
sizeof(PY_LONG_LONG)) {
24213 __PYX_VERIFY_RETURN_INT_EXC(
char, PY_LONG_LONG, PyLong_AsLongLong(x))
24218#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
24219 PyErr_SetString(PyExc_RuntimeError,
24220 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
24223 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
24224 #if PY_MAJOR_VERSION < 3
24225 if (likely(v) && !PyLong_Check(v)) {
24227 v = PyNumber_Long(tmp);
24232 int one = 1;
int is_little = (
int)*(
unsigned char *)&one;
24233 unsigned char *bytes = (
unsigned char *)&val;
24234 int ret = _PyLong_AsByteArray((PyLongObject *)v,
24235 bytes,
sizeof(val),
24236 is_little, !is_unsigned);
24246 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
24247 if (!tmp)
return (
char) -1;
24248 val = __Pyx_PyInt_As_char(tmp);
24253 PyErr_SetString(PyExc_OverflowError,
24254 "value too large to convert to char");
24257 PyErr_SetString(PyExc_OverflowError,
24258 "can't convert negative value to char");
24263 static int __Pyx_check_binary_version(
void) {
24264 char ctversion[4], rtversion[4];
24265 PyOS_snprintf(ctversion, 4,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
24266 PyOS_snprintf(rtversion, 4,
"%s", Py_GetVersion());
24267 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
24269 PyOS_snprintf(message,
sizeof(message),
24270 "compiletime version %s of module '%.100s' "
24271 "does not match runtime version %s",
24272 ctversion, __Pyx_MODULE_NAME, rtversion);
24273 return PyErr_WarnEx(NULL, message, 1);
24279 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
24281 #if PY_MAJOR_VERSION < 3
24282 if (t->is_unicode) {
24283 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
24284 }
else if (t->intern) {
24285 *t->p = PyString_InternFromString(t->s);
24287 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
24290 if (t->is_unicode | t->is_str) {
24292 *t->p = PyUnicode_InternFromString(t->s);
24293 }
else if (t->encoding) {
24294 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
24296 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
24299 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
24304 if (PyObject_Hash(*t->p) == -1)
24311static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
24312 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
24314static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
24316 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
24318#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
24319#if !CYTHON_PEP393_ENABLED
24320static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
24322 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
24323 if (!defenc)
return NULL;
24324 defenc_c = PyBytes_AS_STRING(defenc);
24325#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
24327 char*
end = defenc_c + PyBytes_GET_SIZE(defenc);
24329 for (c = defenc_c; c <
end; c++) {
24330 if ((
unsigned char) (*c) >= 128) {
24331 PyUnicode_AsASCIIString(o);
24337 *length = PyBytes_GET_SIZE(defenc);
24341static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
24342 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
24343#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
24344 if (likely(PyUnicode_IS_ASCII(o))) {
24345 *length = PyUnicode_GET_LENGTH(o);
24346 return PyUnicode_AsUTF8(o);
24348 PyUnicode_AsASCIIString(o);
24352 return PyUnicode_AsUTF8AndSize(o, length);
24357static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
24358#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
24360#
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
24361 __Pyx_sys_getdefaultencoding_not_ascii &&
24363 PyUnicode_Check(o)) {
24364 return __Pyx_PyUnicode_AsStringAndSize(o, length);
24367#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
24368 if (PyByteArray_Check(o)) {
24369 *length = PyByteArray_GET_SIZE(o);
24370 return PyByteArray_AS_STRING(o);
24375 int r = PyBytes_AsStringAndSize(o, &result, length);
24376 if (unlikely(r < 0)) {
24383static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
24384 int is_true = x == Py_True;
24385 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
24386 else return PyObject_IsTrue(x);
24388static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
24390 if (unlikely(!x))
return -1;
24391 retval = __Pyx_PyObject_IsTrue(x);
24395static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
24396#if PY_MAJOR_VERSION >= 3
24397 if (PyLong_Check(result)) {
24398 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
24399 "__int__ returned non-int (type %.200s). "
24400 "The ability to return an instance of a strict subclass of int "
24401 "is deprecated, and may be removed in a future version of Python.",
24402 Py_TYPE(result)->tp_name)) {
24409 PyErr_Format(PyExc_TypeError,
24410 "__%.4s__ returned non-%.4s (type %.200s)",
24411 type_name, type_name, Py_TYPE(result)->tp_name);
24415static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
24416#if CYTHON_USE_TYPE_SLOTS
24417 PyNumberMethods *m;
24419 const char *
name = NULL;
24420 PyObject *res = NULL;
24421#if PY_MAJOR_VERSION < 3
24422 if (likely(PyInt_Check(x) || PyLong_Check(x)))
24424 if (likely(PyLong_Check(x)))
24426 return __Pyx_NewRef(x);
24427#if CYTHON_USE_TYPE_SLOTS
24428 m = Py_TYPE(x)->tp_as_number;
24429 #if PY_MAJOR_VERSION < 3
24430 if (m && m->nb_int) {
24432 res = m->nb_int(x);
24434 else if (m && m->nb_long) {
24436 res = m->nb_long(x);
24439 if (likely(m && m->nb_int)) {
24441 res = m->nb_int(x);
24445 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
24446 res = PyNumber_Int(x);
24450#if PY_MAJOR_VERSION < 3
24451 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
24453 if (unlikely(!PyLong_CheckExact(res))) {
24455 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
24458 else if (!PyErr_Occurred()) {
24459 PyErr_SetString(PyExc_TypeError,
24460 "an integer is required");
24464static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
24467#if PY_MAJOR_VERSION < 3
24468 if (likely(PyInt_CheckExact(b))) {
24469 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
24470 return PyInt_AS_LONG(b);
24472 return PyInt_AsSsize_t(b);
24475 if (likely(PyLong_CheckExact(b))) {
24476 #if CYTHON_USE_PYLONG_INTERNALS
24477 const digit* digits = ((PyLongObject*)b)->ob_digit;
24478 const Py_ssize_t size = Py_SIZE(b);
24479 if (likely(__Pyx_sst_abs(size) <= 1)) {
24480 ival = likely(size) ? digits[0] : 0;
24481 if (size == -1) ival = -ival;
24486 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
24487 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
24491 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
24492 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
24496 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
24497 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
24501 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
24502 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
24506 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
24507 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
24511 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
24512 return -(Py_ssize_t) (((((((((
size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
24518 return PyLong_AsSsize_t(b);
24520 x = PyNumber_Index(b);
24522 ival = PyInt_AsSsize_t(x);
24526static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
24527 if (
sizeof(Py_hash_t) ==
sizeof(Py_ssize_t)) {
24528 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
24529#if PY_MAJOR_VERSION < 3
24530 }
else if (likely(PyInt_CheckExact(o))) {
24531 return PyInt_AS_LONG(o);
24536 x = PyNumber_Index(o);
24538 ival = PyInt_AsLong(x);
24543static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
24544 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
24546static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
24547 return PyInt_FromSize_t(ival);