Safemotion Lib
Loading...
Searching...
No Matches
roc_cy.c
Go to the documentation of this file.
1/* Generated by Cython 0.29.28 */
2
3/* BEGIN: Cython Metadata
4{
5 "distutils": {
6 "depends": [
7 "/opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h",
8 "/opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h",
9 "/opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h",
10 "/opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h",
11 "/opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h"
12 ],
13 "include_dirs": [
14 "/opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/core/include"
15 ],
16 "name": "roc_cy",
17 "sources": [
18 "roc_cy.pyx"
19 ]
20 },
21 "module_name": "roc_cy"
22}
23END: Cython Metadata */
24
25#ifndef PY_SSIZE_T_CLEAN
26#define PY_SSIZE_T_CLEAN
27#endif /* PY_SSIZE_T_CLEAN */
28#include "Python.h"
29#ifndef Py_PYTHON_H
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+.
33#else
34#define CYTHON_ABI "0_29_28"
35#define CYTHON_HEX_VERSION 0x001D1CF0
36#define CYTHON_FUTURE_DIVISION 0
37#include <stddef.h>
38#ifndef offsetof
39 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
40#endif
41#if !defined(WIN32) && !defined(MS_WINDOWS)
42 #ifndef __stdcall
43 #define __stdcall
44 #endif
45 #ifndef __cdecl
46 #define __cdecl
47 #endif
48 #ifndef __fastcall
49 #define __fastcall
50 #endif
51#endif
52#ifndef DL_IMPORT
53 #define DL_IMPORT(t) t
54#endif
55#ifndef DL_EXPORT
56 #define DL_EXPORT(t) t
57#endif
58#define __PYX_COMMA ,
59#ifndef HAVE_LONG_LONG
60 #if PY_VERSION_HEX >= 0x02070000
61 #define HAVE_LONG_LONG
62 #endif
63#endif
64#ifndef PY_LONG_LONG
65 #define PY_LONG_LONG LONG_LONG
66#endif
67#ifndef Py_HUGE_VAL
68 #define Py_HUGE_VAL HUGE_VAL
69#endif
70#ifdef PYPY_VERSION
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
83 #endif
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
116 #endif
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
125 #endif
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
132 #endif
133 #ifndef CYTHON_ASSUME_SAFE_MACROS
134 #define CYTHON_ASSUME_SAFE_MACROS 1
135 #endif
136 #ifndef CYTHON_UNPACK_METHODS
137 #define CYTHON_UNPACK_METHODS 1
138 #endif
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
151#else
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
157 #endif
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
163 #endif
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
169 #endif
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
175 #endif
176 #ifndef CYTHON_USE_PYLIST_INTERNALS
177 #define CYTHON_USE_PYLIST_INTERNALS 1
178 #endif
179 #ifndef CYTHON_USE_UNICODE_INTERNALS
180 #define CYTHON_USE_UNICODE_INTERNALS 1
181 #endif
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
187 #endif
188 #ifndef CYTHON_AVOID_BORROWED_REFS
189 #define CYTHON_AVOID_BORROWED_REFS 0
190 #endif
191 #ifndef CYTHON_ASSUME_SAFE_MACROS
192 #define CYTHON_ASSUME_SAFE_MACROS 1
193 #endif
194 #ifndef CYTHON_UNPACK_METHODS
195 #define CYTHON_UNPACK_METHODS 1
196 #endif
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
202 #endif
203 #ifndef CYTHON_FAST_PYCALL
204 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1)
205 #endif
206 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
207 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
208 #endif
209 #ifndef CYTHON_USE_TP_FINALIZE
210 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
211 #endif
212 #ifndef CYTHON_USE_DICT_VERSIONS
213 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
214 #endif
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)
220 #endif
221#endif
222#if !defined(CYTHON_FAST_PYCCALL)
223#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
224#endif
225#if CYTHON_USE_PYLONG_INTERNALS
226 #if PY_MAJOR_VERSION < 3
227 #include "longintrepr.h"
228 #endif
229 #undef SHIFT
230 #undef BASE
231 #undef MASK
232 #ifdef SIZEOF_VOID_P
233 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
234 #endif
235#endif
236#ifndef __has_attribute
237 #define __has_attribute(x) 0
238#endif
239#ifndef __has_cpp_attribute
240 #define __has_cpp_attribute(x) 0
241#endif
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
249 #else
250 #define CYTHON_RESTRICT
251 #endif
252#endif
253#ifndef CYTHON_UNUSED
254# if defined(__GNUC__)
255# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
256# define CYTHON_UNUSED __attribute__ ((__unused__))
257# else
258# define CYTHON_UNUSED
259# endif
260# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
261# define CYTHON_UNUSED __attribute__ ((__unused__))
262# else
263# define CYTHON_UNUSED
264# endif
265#endif
266#ifndef CYTHON_MAYBE_UNUSED_VAR
267# if defined(__cplusplus)
268 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
269# else
270# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
271# endif
272#endif
273#ifndef CYTHON_NCP_UNUSED
274# if CYTHON_COMPILING_IN_CPYTHON
275# define CYTHON_NCP_UNUSED
276# else
277# define CYTHON_NCP_UNUSED CYTHON_UNUSED
278# endif
279#endif
280#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
281#ifdef _MSC_VER
282 #ifndef _MSC_STDINT_H_
283 #if _MSC_VER < 1300
284 typedef unsigned char uint8_t;
285 typedef unsigned int uint32_t;
286 #else
287 typedef unsigned __int8 uint8_t;
288 typedef unsigned __int32 uint32_t;
289 #endif
290 #endif
291#else
292 #include <stdint.h>
293#endif
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]]
302 #endif
303 #endif
304 #ifndef CYTHON_FALLTHROUGH
305 #if __has_attribute(fallthrough)
306 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
307 #else
308 #define CYTHON_FALLTHROUGH
309 #endif
310 #endif
311 #if defined(__clang__ ) && defined(__apple_build_version__)
312 #if __apple_build_version__ < 7000000
313 #undef CYTHON_FALLTHROUGH
314 #define CYTHON_FALLTHROUGH
315 #endif
316 #endif
317#endif
318
319#ifndef CYTHON_INLINE
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
328 #else
329 #define CYTHON_INLINE
330 #endif
331#endif
332
333#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
334 #define Py_OptimizeFlag 0
335#endif
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
343#else
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; // unfortunately __pyx_empty_tuple isn't available here
383 if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
384 Py_XDECREF((PyObject*)co);
385 co = (PyCodeObject*)call_result;
386 call_result = NULL;
387 if (0) {
388 cleanup_code_too:
389 Py_XDECREF((PyObject*)co);
390 co = NULL;
391 }
392 end:
393 Py_XDECREF(kwds);
394 Py_XDECREF(argcount);
395 Py_XDECREF(posonlyargcount);
396 Py_XDECREF(kwonlyargcount);
397 Py_XDECREF(nlocals);
398 Py_XDECREF(stacksize);
399 Py_XDECREF(replace);
400 Py_XDECREF(call_result);
401 Py_XDECREF(empty);
402 if (type) {
403 PyErr_Restore(type, value, traceback);
404 }
405 return co;
406 }
407#else
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)
410#endif
411 #define __Pyx_DefaultClassType PyType_Type
412#endif
413#ifndef Py_TPFLAGS_CHECKTYPES
414 #define Py_TPFLAGS_CHECKTYPES 0
415#endif
416#ifndef Py_TPFLAGS_HAVE_INDEX
417 #define Py_TPFLAGS_HAVE_INDEX 0
418#endif
419#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
420 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
421#endif
422#ifndef Py_TPFLAGS_HAVE_FINALIZE
423 #define Py_TPFLAGS_HAVE_FINALIZE 0
424#endif
425#ifndef METH_STACKLESS
426 #define METH_STACKLESS 0
427#endif
428#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
429 #ifndef METH_FASTCALL
430 #define METH_FASTCALL 0x80
431 #endif
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);
435#else
436 #define __Pyx_PyCFunctionFast _PyCFunctionFast
437 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
438#endif
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)))))
442#else
443#define __Pyx_PyFastCFunction_Check(func) 0
444#endif
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)
449#endif
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)
454#endif
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)
458#else
459 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
460 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
461#endif
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()
468#else
469 #define __Pyx_PyThreadState_Current _PyThreadState_Current
470#endif
471#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
472#include "pythread.h"
473#define Py_tss_NEEDS_INIT 0
474typedef int Py_tss_t;
475static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
476 *key = PyThread_create_key();
477 return 0;
478}
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;
482 return key;
483}
484static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
485 PyObject_Free(key);
486}
487static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
488 return *key != Py_tss_NEEDS_INIT;
489}
490static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
491 PyThread_delete_key(*key);
492 *key = Py_tss_NEEDS_INIT;
493}
494static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
495 return PyThread_set_key_value(*key, value);
496}
497static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
498 return PyThread_get_key_value(*key);
499}
500#endif
501#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
502#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
503#else
504#define __Pyx_PyDict_NewPresized(n) PyDict_New()
505#endif
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)
509#else
510 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
511 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
512#endif
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)
515#else
516#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
517#endif
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)))
523 #else
524 #define __Pyx_PyUnicode_READY(op) (0)
525 #endif
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))
536 #else
537 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
538 #endif
539 #else
540 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
541 #endif
542#else
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))
556#endif
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)
560#else
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))
564#endif
565#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
566 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
567#endif
568#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
569 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
570#endif
571#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
572 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
573#endif
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)
578#else
579 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
580#endif
581#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
582 #define PyObject_ASCII(o) PyObject_Repr(o)
583#endif
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
592#endif
593#endif
594#if PY_MAJOR_VERSION >= 3
595 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
596 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
597#else
598 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
599 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
600#endif
601#ifndef PySet_CheckExact
602 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
603#endif
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)
607#else
608 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
609 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
610#endif
611#if CYTHON_ASSUME_SAFE_MACROS
612 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
613#else
614 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
615#endif
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
632#endif
633#if PY_MAJOR_VERSION >= 3
634 #define PyBoolObject PyLongObject
635#endif
636#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
637 #ifndef PyUnicode_InternFromString
638 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
639 #endif
640#endif
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
645#else
646 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
647 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
648#endif
649#if PY_MAJOR_VERSION >= 3
650 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
651#else
652 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
653#endif
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)
658 #else
659 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
660 #endif
661#else
662 #define __Pyx_PyType_AsAsync(obj) NULL
663#endif
664#ifndef __Pyx_PyAsyncMethodsStruct
665 typedef struct {
666 unaryfunc am_await;
667 unaryfunc am_aiter;
668 unaryfunc am_anext;
669 } __Pyx_PyAsyncMethodsStruct;
670#endif
671
672#if defined(WIN32) || defined(MS_WINDOWS)
673 #define _USE_MATH_DEFINES
674#endif
675#include <math.h>
676#ifdef NAN
677#define __PYX_NAN() ((float) NAN)
678#else
679static CYTHON_INLINE float __PYX_NAN() {
680 float value;
681 memset(&value, 0xFF, sizeof(value));
682 return value;
683}
684#endif
685#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
686#define __Pyx_truncl trunc
687#else
688#define __Pyx_truncl truncl
689#endif
690
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; }
695
696#ifndef __PYX_EXTERN_C
697 #ifdef __cplusplus
698 #define __PYX_EXTERN_C extern "C"
699 #else
700 #define __PYX_EXTERN_C extern
701 #endif
702#endif
703
704#define __PYX_HAVE__roc_cy
705#define __PYX_HAVE_API__roc_cy
706/* Early includes */
707#include <string.h>
708#include <stdio.h>
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"
714
715 /* NumPy API declarations from "numpy/__init__.pxd" */
716
717#include "pythread.h"
718#include <stdlib.h>
719#include "pystate.h"
720#ifdef _OPENMP
721#include <omp.h>
722#endif /* _OPENMP */
723
724#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
725#define CYTHON_WITHOUT_ASSERTIONS
726#endif
727
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;
730
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;
751}
752#if defined (__cplusplus) && __cplusplus >= 201103L
753 #include <cstdlib>
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)
765#else
766 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
767#endif
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
778#else
779 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
780 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
781#endif
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;
800 while (*u_end++) ;
801 return (size_t)(u_end - u - 1);
802}
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))
819#else
820#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
821#endif
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))
825#else
826#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
827#endif
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) {
832 PyObject* sys;
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");
838 if (!sys) goto bad;
839 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
840 Py_DECREF(sys);
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;
846 } else {
847 char ascii_chars[128];
848 int c;
849 for (c = 0; c < 128; c++) {
850 ascii_chars[c] = c;
851 }
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) {
857 PyErr_Format(
858 PyExc_ValueError,
859 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
860 default_encoding_c);
861 goto bad;
862 }
863 Py_DECREF(ascii_chars_u);
864 Py_DECREF(ascii_chars_b);
865 }
866 Py_DECREF(default_encoding);
867 return 0;
868bad:
869 Py_XDECREF(default_encoding);
870 Py_XDECREF(ascii_chars_u);
871 Py_XDECREF(ascii_chars_b);
872 return -1;
873}
874#endif
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)
877#else
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) {
882 PyObject* sys;
883 PyObject* default_encoding = NULL;
884 char* default_encoding_c;
885 sys = PyImport_ImportModule("sys");
886 if (!sys) goto bad;
887 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
888 Py_DECREF(sys);
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);
896 return 0;
897bad:
898 Py_XDECREF(default_encoding);
899 return -1;
900}
901#endif
902#endif
903
904
905/* Test for GCC > 2.95 */
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)
909#else /* !__GNUC__ or GCC < 2.95 */
910 #define likely(x) (x)
911 #define unlikely(x) (x)
912#endif /* __GNUC__ */
913static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
914
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;
926
927/* Header.proto */
928#if !defined(CYTHON_CCOMPLEX)
929 #if defined(__cplusplus)
930 #define CYTHON_CCOMPLEX 1
931 #elif defined(_Complex_I)
932 #define CYTHON_CCOMPLEX 1
933 #else
934 #define CYTHON_CCOMPLEX 0
935 #endif
936#endif
937#if CYTHON_CCOMPLEX
938 #ifdef __cplusplus
939 #include <complex>
940 #else
941 #include <complex.h>
942 #endif
943#endif
944#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
945 #undef _Complex_I
946 #define _Complex_I 1.0fj
947#endif
948
949
950static const char *__pyx_f[] = {
951 "roc_cy.pyx",
952 "__init__.pxd",
953 "stringsource",
954 "type.pxd",
955};
956/* MemviewSliceStruct.proto */
957struct __pyx_memoryview_obj;
958typedef struct {
959 struct __pyx_memoryview_obj *memview;
960 char *data;
961 Py_ssize_t shape[8];
962 Py_ssize_t strides[8];
963 Py_ssize_t suboffsets[8];
964} __Pyx_memviewslice;
965#define __Pyx_MemoryView_Len(m) (m.shape[0])
966
967/* Atomics.proto */
968#include <pythread.h>
969#ifndef CYTHON_ATOMICS
970 #define CYTHON_ATOMICS 1
971#endif
972#define __pyx_atomic_int_type int
973#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
974 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
975 !defined(__i386__)
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"
980 #endif
981#elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
982 #include <Windows.h>
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")
989 #endif
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"
995 #endif
996#else
997 #undef CYTHON_ATOMICS
998 #define CYTHON_ATOMICS 0
999 #ifdef __PYX_DEBUG_ATOMICS
1000 #warning "Not using atomics"
1001 #endif
1002#endif
1003typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
1004#if CYTHON_ATOMICS
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)
1009#else
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)
1014#endif
1015
1016/* ForceInitThreads.proto */
1017#ifndef __PYX_FORCE_INIT_THREADS
1018 #define __PYX_FORCE_INIT_THREADS 0
1019#endif
1020
1021/* NoFastGil.proto */
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()
1027
1028/* BufferFormatStructs.proto */
1029#define IS_UNSIGNED(type) (((type) -1) > 0)
1030struct __Pyx_StructField_;
1031#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
1032typedef struct {
1033 const char* name;
1034 struct __Pyx_StructField_* fields;
1035 size_t size;
1036 size_t arraysize[8];
1037 int ndim;
1038 char typegroup;
1039 char is_unsigned;
1040 int flags;
1041} __Pyx_TypeInfo;
1042typedef struct __Pyx_StructField_ {
1043 __Pyx_TypeInfo* type;
1044 const char* name;
1045 size_t offset;
1046} __Pyx_StructField;
1047typedef struct {
1048 __Pyx_StructField* field;
1049 size_t parent_offset;
1050} __Pyx_BufFmt_StackElem;
1051typedef struct {
1052 __Pyx_StructField root;
1053 __Pyx_BufFmt_StackElem* head;
1054 size_t fmt_offset;
1055 size_t new_count, enc_count;
1056 size_t struct_alignment;
1057 int is_complex;
1058 char enc_type;
1059 char new_packmode;
1060 char enc_packmode;
1061 char is_valid_array;
1062} __Pyx_BufFmt_Context;
1063
1064
1065/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":690
1066 * # in Cython to enable them only on the right systems.
1067 *
1068 * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
1069 * ctypedef npy_int16 int16_t
1070 * ctypedef npy_int32 int32_t
1071 */
1072typedef npy_int8 __pyx_t_5numpy_int8_t;
1073
1074/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":691
1075 *
1076 * ctypedef npy_int8 int8_t
1077 * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
1078 * ctypedef npy_int32 int32_t
1079 * ctypedef npy_int64 int64_t
1080 */
1081typedef npy_int16 __pyx_t_5numpy_int16_t;
1082
1083/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":692
1084 * ctypedef npy_int8 int8_t
1085 * ctypedef npy_int16 int16_t
1086 * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
1087 * ctypedef npy_int64 int64_t
1088 * #ctypedef npy_int96 int96_t
1089 */
1090typedef npy_int32 __pyx_t_5numpy_int32_t;
1091
1092/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":693
1093 * ctypedef npy_int16 int16_t
1094 * ctypedef npy_int32 int32_t
1095 * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
1096 * #ctypedef npy_int96 int96_t
1097 * #ctypedef npy_int128 int128_t
1098 */
1099typedef npy_int64 __pyx_t_5numpy_int64_t;
1100
1101/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":697
1102 * #ctypedef npy_int128 int128_t
1103 *
1104 * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
1105 * ctypedef npy_uint16 uint16_t
1106 * ctypedef npy_uint32 uint32_t
1107 */
1108typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1109
1110/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":698
1111 *
1112 * ctypedef npy_uint8 uint8_t
1113 * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
1114 * ctypedef npy_uint32 uint32_t
1115 * ctypedef npy_uint64 uint64_t
1116 */
1117typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1118
1119/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":699
1120 * ctypedef npy_uint8 uint8_t
1121 * ctypedef npy_uint16 uint16_t
1122 * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
1123 * ctypedef npy_uint64 uint64_t
1124 * #ctypedef npy_uint96 uint96_t
1125 */
1126typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1127
1128/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":700
1129 * ctypedef npy_uint16 uint16_t
1130 * ctypedef npy_uint32 uint32_t
1131 * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
1132 * #ctypedef npy_uint96 uint96_t
1133 * #ctypedef npy_uint128 uint128_t
1134 */
1135typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1136
1137/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":704
1138 * #ctypedef npy_uint128 uint128_t
1139 *
1140 * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
1141 * ctypedef npy_float64 float64_t
1142 * #ctypedef npy_float80 float80_t
1143 */
1144typedef npy_float32 __pyx_t_5numpy_float32_t;
1145
1146/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":705
1147 *
1148 * ctypedef npy_float32 float32_t
1149 * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
1150 * #ctypedef npy_float80 float80_t
1151 * #ctypedef npy_float128 float128_t
1152 */
1153typedef npy_float64 __pyx_t_5numpy_float64_t;
1154
1155/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":714
1156 * # The int types are mapped a bit surprising --
1157 * # numpy.int corresponds to 'l' and numpy.long to 'q'
1158 * ctypedef npy_long int_t # <<<<<<<<<<<<<<
1159 * ctypedef npy_longlong long_t
1160 * ctypedef npy_longlong longlong_t
1161 */
1162typedef npy_long __pyx_t_5numpy_int_t;
1163
1164/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":715
1165 * # numpy.int corresponds to 'l' and numpy.long to 'q'
1166 * ctypedef npy_long int_t
1167 * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1168 * ctypedef npy_longlong longlong_t
1169 *
1170 */
1171typedef npy_longlong __pyx_t_5numpy_long_t;
1172
1173/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":716
1174 * ctypedef npy_long int_t
1175 * ctypedef npy_longlong long_t
1176 * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1177 *
1178 * ctypedef npy_ulong uint_t
1179 */
1180typedef npy_longlong __pyx_t_5numpy_longlong_t;
1181
1182/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":718
1183 * ctypedef npy_longlong longlong_t
1184 *
1185 * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1186 * ctypedef npy_ulonglong ulong_t
1187 * ctypedef npy_ulonglong ulonglong_t
1188 */
1189typedef npy_ulong __pyx_t_5numpy_uint_t;
1190
1191/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":719
1192 *
1193 * ctypedef npy_ulong uint_t
1194 * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1195 * ctypedef npy_ulonglong ulonglong_t
1196 *
1197 */
1198typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1199
1200/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":720
1201 * ctypedef npy_ulong uint_t
1202 * ctypedef npy_ulonglong ulong_t
1203 * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1204 *
1205 * ctypedef npy_intp intp_t
1206 */
1207typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1208
1209/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":722
1210 * ctypedef npy_ulonglong ulonglong_t
1211 *
1212 * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1213 * ctypedef npy_uintp uintp_t
1214 *
1215 */
1216typedef npy_intp __pyx_t_5numpy_intp_t;
1217
1218/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":723
1219 *
1220 * ctypedef npy_intp intp_t
1221 * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1222 *
1223 * ctypedef npy_double float_t
1224 */
1225typedef npy_uintp __pyx_t_5numpy_uintp_t;
1226
1227/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":725
1228 * ctypedef npy_uintp uintp_t
1229 *
1230 * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1231 * ctypedef npy_double double_t
1232 * ctypedef npy_longdouble longdouble_t
1233 */
1234typedef npy_double __pyx_t_5numpy_float_t;
1235
1236/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":726
1237 *
1238 * ctypedef npy_double float_t
1239 * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1240 * ctypedef npy_longdouble longdouble_t
1241 *
1242 */
1243typedef npy_double __pyx_t_5numpy_double_t;
1244
1245/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":727
1246 * ctypedef npy_double float_t
1247 * ctypedef npy_double double_t
1248 * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1249 *
1250 * ctypedef npy_cfloat cfloat_t
1251 */
1252typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1253/* Declarations.proto */
1254#if CYTHON_CCOMPLEX
1255 #ifdef __cplusplus
1256 typedef ::std::complex< float > __pyx_t_float_complex;
1257 #else
1258 typedef float _Complex __pyx_t_float_complex;
1259 #endif
1260#else
1261 typedef struct { float real, imag; } __pyx_t_float_complex;
1262#endif
1263static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1264
1265/* Declarations.proto */
1266#if CYTHON_CCOMPLEX
1267 #ifdef __cplusplus
1268 typedef ::std::complex< double > __pyx_t_double_complex;
1269 #else
1270 typedef double _Complex __pyx_t_double_complex;
1271 #endif
1272#else
1273 typedef struct { double real, imag; } __pyx_t_double_complex;
1274#endif
1275static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1276
1277
1278/*--- Type declarations ---*/
1279struct __pyx_array_obj;
1280struct __pyx_MemviewEnum_obj;
1281struct __pyx_memoryview_obj;
1282struct __pyx_memoryviewslice_obj;
1283
1284/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":729
1285 * ctypedef npy_longdouble longdouble_t
1286 *
1287 * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1288 * ctypedef npy_cdouble cdouble_t
1289 * ctypedef npy_clongdouble clongdouble_t
1290 */
1291typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1292
1293/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":730
1294 *
1295 * ctypedef npy_cfloat cfloat_t
1296 * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1297 * ctypedef npy_clongdouble clongdouble_t
1298 *
1299 */
1300typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1301
1302/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":731
1303 * ctypedef npy_cfloat cfloat_t
1304 * ctypedef npy_cdouble cdouble_t
1305 * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1306 *
1307 * ctypedef npy_cdouble complex_t
1308 */
1309typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1310
1311/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":733
1312 * ctypedef npy_clongdouble clongdouble_t
1313 *
1314 * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1315 *
1316 * cdef inline object PyArray_MultiIterNew1(a):
1317 */
1318typedef npy_cdouble __pyx_t_5numpy_complex_t;
1319
1320/* "View.MemoryView":105
1321 *
1322 * @cname("__pyx_array")
1323 * cdef class array: # <<<<<<<<<<<<<<
1324 *
1325 * cdef:
1326 */
1327struct __pyx_array_obj {
1328 PyObject_HEAD
1329 struct __pyx_vtabstruct_array *__pyx_vtab;
1330 char *data;
1331 Py_ssize_t len;
1332 char *format;
1333 int ndim;
1334 Py_ssize_t *_shape;
1335 Py_ssize_t *_strides;
1336 Py_ssize_t itemsize;
1337 PyObject *mode;
1338 PyObject *_format;
1339 void (*callback_free_data)(void *);
1340 int free_data;
1341 int dtype_is_object;
1342};
1343
1344
1345/* "View.MemoryView":279
1346 *
1347 * @cname('__pyx_MemviewEnum')
1348 * cdef class Enum(object): # <<<<<<<<<<<<<<
1349 * cdef object name
1350 * def __init__(self, name):
1351 */
1352struct __pyx_MemviewEnum_obj {
1353 PyObject_HEAD
1354 PyObject *name;
1355};
1356
1357
1358/* "View.MemoryView":330
1359 *
1360 * @cname('__pyx_memoryview')
1361 * cdef class memoryview(object): # <<<<<<<<<<<<<<
1362 *
1363 * cdef object obj
1364 */
1365struct __pyx_memoryview_obj {
1366 PyObject_HEAD
1367 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1368 PyObject *obj;
1369 PyObject *_size;
1370 PyObject *_array_interface;
1371 PyThread_type_lock lock;
1372 __pyx_atomic_int acquisition_count[2];
1373 __pyx_atomic_int *acquisition_count_aligned_p;
1374 Py_buffer view;
1375 int flags;
1376 int dtype_is_object;
1377 __Pyx_TypeInfo *typeinfo;
1378};
1379
1380
1381/* "View.MemoryView":965
1382 *
1383 * @cname('__pyx_memoryviewslice')
1384 * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1385 * "Internal class for passing memoryview slices to Python"
1386 *
1387 */
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 *);
1394};
1395
1396
1397
1398/* "View.MemoryView":105
1399 *
1400 * @cname("__pyx_array")
1401 * cdef class array: # <<<<<<<<<<<<<<
1402 *
1403 * cdef:
1404 */
1405
1406struct __pyx_vtabstruct_array {
1407 PyObject *(*get_memview)(struct __pyx_array_obj *);
1408};
1409static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1410
1411
1412/* "View.MemoryView":330
1413 *
1414 * @cname('__pyx_memoryview')
1415 * cdef class memoryview(object): # <<<<<<<<<<<<<<
1416 *
1417 * cdef object obj
1418 */
1419
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 *);
1428};
1429static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1430
1431
1432/* "View.MemoryView":965
1433 *
1434 * @cname('__pyx_memoryviewslice')
1435 * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1436 * "Internal class for passing memoryview slices to Python"
1437 *
1438 */
1439
1440struct __pyx_vtabstruct__memoryviewslice {
1441 struct __pyx_vtabstruct_memoryview __pyx_base;
1442};
1443static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1444
1445/* --- Runtime support code (head) --- */
1446/* Refnanny.proto */
1447#ifndef CYTHON_REFNANNY
1448 #define CYTHON_REFNANNY 0
1449#endif
1450#if CYTHON_REFNANNY
1451 typedef struct {
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;
1462#ifdef WITH_THREAD
1463 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1464 if (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);\
1468 } else {\
1469 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1470 }
1471#else
1472 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1473 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1474#endif
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)
1485#else
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)
1497#endif
1498#define __Pyx_XDECREF_SET(r, v) do {\
1499 PyObject *tmp = (PyObject *) r;\
1500 r = v; __Pyx_XDECREF(tmp);\
1501 } while (0)
1502#define __Pyx_DECREF_SET(r, v) do {\
1503 PyObject *tmp = (PyObject *) r;\
1504 r = v; __Pyx_DECREF(tmp);\
1505 } while (0)
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)
1508
1509/* PyObjectGetAttrStr.proto */
1510#if CYTHON_USE_TYPE_SLOTS
1511static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1512#else
1513#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1514#endif
1515
1516/* GetBuiltinName.proto */
1517static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1518
1519/* MemviewSliceInit.proto */
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,
1531 int ndim,
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);
1544
1545/* PyDictVersioning.proto */
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;\
1557 } else {\
1558 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1559 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1560 }\
1561}
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);
1565#else
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);
1569#endif
1570
1571/* GetModuleGlobalName.proto */
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);\
1579}
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);\
1584}
1585static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1586#else
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);
1590#endif
1591
1592/* PyObjectCall.proto */
1593#if CYTHON_COMPILING_IN_CPYTHON
1594static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1595#else
1596#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1597#endif
1598
1599/* PyCFunctionFastCall.proto */
1600#if CYTHON_FAST_PYCCALL
1601static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1602#else
1603#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1604#endif
1605
1606/* PyFunctionFastCall.proto */
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);
1612#else
1613#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1614#endif
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)
1619#endif
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))
1628#endif // CYTHON_FAST_PYCALL
1629#endif
1630
1631/* PyObjectCall2Args.proto */
1632static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1633
1634/* PyObjectCallMethO.proto */
1635#if CYTHON_COMPILING_IN_CPYTHON
1636static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1637#endif
1638
1639/* PyObjectCallOneArg.proto */
1640static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1641
1642/* GetItemInt.proto */
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);
1663
1664/* ObjectGetItem.proto */
1665#if CYTHON_USE_TYPE_SLOTS
1666static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1667#else
1668#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1669#endif
1670
1671/* PyIntBinop.proto */
1672#if !CYTHON_COMPILING_IN_PYPY
1673static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1674#else
1675#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1676 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1677#endif
1678
1679/* RaiseArgTupleInvalid.proto */
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);
1682
1683/* RaiseDoubleKeywords.proto */
1684static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1685
1686/* ParseKeywords.proto */
1687static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1688 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1689 const char* function_name);
1690
1691/* None.proto */
1692static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1693
1694/* GetTopmostException.proto */
1695#if CYTHON_USE_EXC_INFO_STACK
1696static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1697#endif
1698
1699/* PyThreadStateGet.proto */
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
1704#else
1705#define __Pyx_PyThreadState_declare
1706#define __Pyx_PyThreadState_assign
1707#define __Pyx_PyErr_Occurred() PyErr_Occurred()
1708#endif
1709
1710/* SaveResetException.proto */
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);
1716#else
1717#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1718#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1719#endif
1720
1721/* PyErrExceptionMatches.proto */
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);
1725#else
1726#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1727#endif
1728
1729/* GetException.proto */
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);
1733#else
1734static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1735#endif
1736
1737/* PyErrFetchRestore.proto */
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))
1748#else
1749#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1750#endif
1751#else
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)
1760#endif
1761
1762/* RaiseException.proto */
1763static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1764
1765/* ArgTypeTest.proto */
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);
1770
1771/* IncludeStringH.proto */
1772#include <string.h>
1773
1774/* BytesEquals.proto */
1775static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1776
1777/* UnicodeEquals.proto */
1778static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1779
1780/* StrEquals.proto */
1781#if PY_MAJOR_VERSION >= 3
1782#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1783#else
1784#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1785#endif
1786
1787/* UnaryNegOverflows.proto */
1788#define UNARY_NEG_WOULD_OVERFLOW(x)\
1789 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1790
1791static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1792static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1793/* GetAttr.proto */
1794static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1795
1796/* decode_c_string_utf16.proto */
1797static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1798 int byteorder = 0;
1799 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1800}
1801static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1802 int byteorder = -1;
1803 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1804}
1805static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1806 int byteorder = 1;
1807 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1808}
1809
1810/* decode_c_string.proto */
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));
1815
1816/* GetAttr3.proto */
1817static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1818
1819/* RaiseTooManyValuesToUnpack.proto */
1820static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1821
1822/* RaiseNeedMoreValuesToUnpack.proto */
1823static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1824
1825/* RaiseNoneIterError.proto */
1826static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1827
1828/* ExtTypeTest.proto */
1829static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1830
1831/* SwapException.proto */
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);
1835#else
1836static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1837#endif
1838
1839/* Import.proto */
1840static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1841
1842/* FastTypeChecks.proto */
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);
1848#else
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))
1852#endif
1853#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1854
1855static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1856/* ListCompAppend.proto */
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)) {
1862 Py_INCREF(x);
1863 PyList_SET_ITEM(list, len, x);
1864 __Pyx_SET_SIZE(list, len + 1);
1865 return 0;
1866 }
1867 return PyList_Append(list, x);
1868}
1869#else
1870#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1871#endif
1872
1873/* ListExtend.proto */
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))
1878 return -1;
1879 Py_DECREF(none);
1880 return 0;
1881#else
1882 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1883#endif
1884}
1885
1886/* ListAppend.proto */
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))) {
1892 Py_INCREF(x);
1893 PyList_SET_ITEM(list, len, x);
1894 __Pyx_SET_SIZE(list, len + 1);
1895 return 0;
1896 }
1897 return PyList_Append(list, x);
1898}
1899#else
1900#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1901#endif
1902
1903/* ImportFrom.proto */
1904static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1905
1906/* HasAttr.proto */
1907static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1908
1909/* PyObject_GenericGetAttrNoDict.proto */
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);
1912#else
1913#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1914#endif
1915
1916/* PyObject_GenericGetAttr.proto */
1917#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1918static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1919#else
1920#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1921#endif
1922
1923/* SetVTable.proto */
1924static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1925
1926/* PyObjectGetAttrStrNoError.proto */
1927static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1928
1929/* SetupReduce.proto */
1930static int __Pyx_setup_reduce(PyObject* type_obj);
1931
1932/* TypeImport.proto */
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
1939};
1940static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1941#endif
1942
1943/* CLineInTraceback.proto */
1944#ifdef CYTHON_CLINE_IN_TRACEBACK
1945#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1946#else
1947static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1948#endif
1949
1950/* CodeObjectCache.proto */
1951typedef struct {
1952 PyCodeObject* code_object;
1953 int code_line;
1954} __Pyx_CodeObjectCacheEntry;
1955struct __Pyx_CodeObjectCache {
1956 int count;
1957 int max_count;
1958 __Pyx_CodeObjectCacheEntry* entries;
1959};
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);
1964
1965/* AddTraceback.proto */
1966static void __Pyx_AddTraceback(const char *funcname, int c_line,
1967 int py_line, const char *filename);
1968
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);
1972#else
1973 #define __Pyx_GetBuffer PyObject_GetBuffer
1974 #define __Pyx_ReleaseBuffer PyBuffer_Release
1975#endif
1976
1977
1978/* BufferStructDeclare.proto */
1979typedef struct {
1980 Py_ssize_t shape, strides, suboffsets;
1981} __Pyx_Buf_DimInfo;
1982typedef struct {
1983 size_t refcount;
1984 Py_buffer pybuffer;
1985} __Pyx_Buffer;
1986typedef struct {
1987 __Pyx_Buffer *rcbuffer;
1988 char *data;
1989 __Pyx_Buf_DimInfo diminfo[8];
1990} __Pyx_LocalBuf_ND;
1991
1992/* MemviewSliceIsContig.proto */
1993static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
1994
1995/* OverlappingSlices.proto */
1996static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
1997 __Pyx_memviewslice *slice2,
1998 int ndim, size_t itemsize);
1999
2000/* Capsule.proto */
2001static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2002
2003/* IsLittleEndian.proto */
2004static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
2005
2006/* BufferFormatCheck.proto */
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);
2011
2012/* TypeInfoCompare.proto */
2013static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2014
2015/* MemviewSliceValidateAndInit.proto */
2016static int __Pyx_ValidateAndInit_memviewslice(
2017 int *axes_specs,
2018 int c_or_f_flag,
2019 int buf_flags,
2020 int ndim,
2021 __Pyx_TypeInfo *dtype,
2022 __Pyx_BufFmt_StackElem stack[],
2023 __Pyx_memviewslice *memviewslice,
2024 PyObject *original_obj);
2025
2026/* ObjectToMemviewSlice.proto */
2027static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *, int writable_flag);
2028
2029/* ObjectToMemviewSlice.proto */
2030static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_long(PyObject *, int writable_flag);
2031
2032/* RealImag.proto */
2033#if CYTHON_CCOMPLEX
2034 #ifdef __cplusplus
2035 #define __Pyx_CREAL(z) ((z).real())
2036 #define __Pyx_CIMAG(z) ((z).imag())
2037 #else
2038 #define __Pyx_CREAL(z) (__real__(z))
2039 #define __Pyx_CIMAG(z) (__imag__(z))
2040 #endif
2041#else
2042 #define __Pyx_CREAL(z) ((z).real)
2043 #define __Pyx_CIMAG(z) ((z).imag)
2044#endif
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))
2049#else
2050 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2051 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2052#endif
2053
2054/* Arithmetic.proto */
2055#if CYTHON_CCOMPLEX
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))
2062 #ifdef __cplusplus
2063 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2064 #define __Pyx_c_conj_float(z) (::std::conj(z))
2065 #if 1
2066 #define __Pyx_c_abs_float(z) (::std::abs(z))
2067 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2068 #endif
2069 #else
2070 #define __Pyx_c_is_zero_float(z) ((z)==0)
2071 #define __Pyx_c_conj_float(z) (conjf(z))
2072 #if 1
2073 #define __Pyx_c_abs_float(z) (cabsf(z))
2074 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2075 #endif
2076 #endif
2077#else
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);
2086 #if 1
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);
2089 #endif
2090#endif
2091
2092/* Arithmetic.proto */
2093#if CYTHON_CCOMPLEX
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))
2100 #ifdef __cplusplus
2101 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2102 #define __Pyx_c_conj_double(z) (::std::conj(z))
2103 #if 1
2104 #define __Pyx_c_abs_double(z) (::std::abs(z))
2105 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2106 #endif
2107 #else
2108 #define __Pyx_c_is_zero_double(z) ((z)==0)
2109 #define __Pyx_c_conj_double(z) (conj(z))
2110 #if 1
2111 #define __Pyx_c_abs_double(z) (cabs(z))
2112 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2113 #endif
2114 #endif
2115#else
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);
2124 #if 1
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);
2127 #endif
2128#endif
2129
2130/* MemviewDtypeToObject.proto */
2131static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp);
2132static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *obj);
2133
2134/* GCCDiagnostics.proto */
2135#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2136#define __Pyx_HAS_GCC_DIAGNOSTIC
2137#endif
2138
2139/* MemviewDtypeToObject.proto */
2140static CYTHON_INLINE PyObject *__pyx_memview_get_long(const char *itemp);
2141static CYTHON_INLINE int __pyx_memview_set_long(const char *itemp, PyObject *obj);
2142
2143/* ObjectToMemviewSlice.proto */
2144static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_long(PyObject *, int writable_flag);
2145
2146/* ObjectToMemviewSlice.proto */
2147static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *, int writable_flag);
2148
2149/* MemviewSliceCopyTemplate.proto */
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);
2155
2156/* CIntToPy.proto */
2157static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2158
2159/* CIntFromPy.proto */
2160static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2161
2162/* CIntFromPy.proto */
2163static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2164
2165/* CIntToPy.proto */
2166static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2167
2168/* CIntFromPy.proto */
2169static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2170
2171/* CheckBinaryVersion.proto */
2172static int __Pyx_check_binary_version(void);
2173
2174/* InitStrings.proto */
2175static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2176
2177static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2178static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2179static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2180static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
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); /* proto*/
2182static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2183static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2184static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2185static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2186static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2187
2188/* Module declarations from 'cython.view' */
2189
2190/* Module declarations from 'cython' */
2191
2192/* Module declarations from 'cpython.buffer' */
2193
2194/* Module declarations from 'libc.string' */
2195
2196/* Module declarations from 'libc.stdio' */
2197
2198/* Module declarations from '__builtin__' */
2199
2200/* Module declarations from 'cpython.type' */
2201static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2202
2203/* Module declarations from 'cpython' */
2204
2205/* Module declarations from 'cpython.object' */
2206
2207/* Module declarations from 'cpython.ref' */
2208
2209/* Module declarations from 'cpython.mem' */
2210
2211/* Module declarations from 'numpy' */
2212
2213/* Module declarations from 'numpy' */
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;
2229
2230/* Module declarations from 'roc_cy' */
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); /*proto*/
2243static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2244static void *__pyx_align_pointer(void *, size_t); /*proto*/
2245static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2246static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2247static PyObject *_unellipsify(PyObject *, int); /*proto*/
2248static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2249static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
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); /*proto*/
2251static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2252static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2253static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2254static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2255static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2256static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2257static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2258static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2259static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2260static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2261static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2262static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2263static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2264static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2265static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2266static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2267static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2268static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2269static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2270static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2271static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2272static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2273static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2274static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2275static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
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;
2281
2282/* Implementation of 'roc_cy' */
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); /* proto */
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); /* proto */
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); /* proto */
2517static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2518static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2519static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2520static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2521static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
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); /* proto */
2523static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
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); /* proto */
2525static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2526static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2527static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2528static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
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); /* proto */
2530static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2531static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
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); /* proto */
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); /* proto */
2534static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2535static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2536static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2537static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2538static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2539static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2540static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2541static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2542static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2543static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2544static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2545static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2546static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2547static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2548static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2549static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2550static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
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); /* proto */
2552static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2553static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2554static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
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); /* proto */
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); /* proto */
2557static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2558static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2559static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2560static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
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;
2592/* Late includes */
2593
2594/* "roc_cy.pyx":20
2595 *
2596 * # Main interface
2597 * cpdef evaluate_roc_cy(float[:,:] distmat, float[:,:] q_feats, float[:,:] g_feats, long[:] q_pids, long[:]g_pids, # <<<<<<<<<<<<<<
2598 * long[:]q_camids, long[:]g_camids):
2599 *
2600 */
2601
2602static PyObject *__pyx_pw_6roc_cy_1evaluate_roc_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
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) {
2604 long __pyx_v_num_q;
2605 long __pyx_v_num_g;
2606 long __pyx_v_dim;
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;
2614 long __pyx_v_q_idx;
2615 long __pyx_v_q_pid;
2616 long __pyx_v_q_camid;
2617 long __pyx_v_g_idx;
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 } };
2638 long __pyx_t_11;
2639 long __pyx_t_12;
2640 long __pyx_t_13;
2641 Py_ssize_t __pyx_t_14;
2642 long __pyx_t_15;
2643 long __pyx_t_16;
2644 long __pyx_t_17;
2645 Py_ssize_t __pyx_t_18;
2646 Py_ssize_t __pyx_t_19;
2647 int __pyx_t_20;
2648 int __pyx_t_21;
2649 Py_ssize_t __pyx_t_22;
2650 PyObject *(*__pyx_t_23)(PyObject *);
2651 Py_ssize_t __pyx_t_24;
2652 float __pyx_t_25;
2653 int __pyx_t_26;
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);
2667
2668 /* "roc_cy.pyx":23
2669 * long[:]q_camids, long[:]g_camids):
2670 *
2671 * distmat = np.asarray(distmat, dtype=np.float32) # <<<<<<<<<<<<<<
2672 * q_feats = np.asarray(q_feats, dtype=np.float32)
2673 * g_feats = np.asarray(g_feats, dtype=np.float32)
2674 */
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);
2686 __pyx_t_1 = 0;
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;
2707
2708 /* "roc_cy.pyx":24
2709 *
2710 * distmat = np.asarray(distmat, dtype=np.float32)
2711 * q_feats = np.asarray(q_feats, dtype=np.float32) # <<<<<<<<<<<<<<
2712 * g_feats = np.asarray(g_feats, dtype=np.float32)
2713 * q_pids = np.asarray(q_pids, dtype=np.int64)
2714 */
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);
2726 __pyx_t_5 = 0;
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;
2747
2748 /* "roc_cy.pyx":25
2749 * distmat = np.asarray(distmat, dtype=np.float32)
2750 * q_feats = np.asarray(q_feats, dtype=np.float32)
2751 * g_feats = np.asarray(g_feats, dtype=np.float32) # <<<<<<<<<<<<<<
2752 * q_pids = np.asarray(q_pids, dtype=np.int64)
2753 * g_pids = np.asarray(g_pids, dtype=np.int64)
2754 */
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);
2766 __pyx_t_4 = 0;
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;
2787
2788 /* "roc_cy.pyx":26
2789 * q_feats = np.asarray(q_feats, dtype=np.float32)
2790 * g_feats = np.asarray(g_feats, dtype=np.float32)
2791 * q_pids = np.asarray(q_pids, dtype=np.int64) # <<<<<<<<<<<<<<
2792 * g_pids = np.asarray(g_pids, dtype=np.int64)
2793 * q_camids = np.asarray(q_camids, dtype=np.int64)
2794 */
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);
2806 __pyx_t_2 = 0;
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;
2827
2828 /* "roc_cy.pyx":27
2829 * g_feats = np.asarray(g_feats, dtype=np.float32)
2830 * q_pids = np.asarray(q_pids, dtype=np.int64)
2831 * g_pids = np.asarray(g_pids, dtype=np.int64) # <<<<<<<<<<<<<<
2832 * q_camids = np.asarray(q_camids, dtype=np.int64)
2833 * g_camids = np.asarray(g_camids, dtype=np.int64)
2834 */
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);
2846 __pyx_t_1 = 0;
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;
2867
2868 /* "roc_cy.pyx":28
2869 * q_pids = np.asarray(q_pids, dtype=np.int64)
2870 * g_pids = np.asarray(g_pids, dtype=np.int64)
2871 * q_camids = np.asarray(q_camids, dtype=np.int64) # <<<<<<<<<<<<<<
2872 * g_camids = np.asarray(g_camids, dtype=np.int64)
2873 *
2874 */
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);
2886 __pyx_t_5 = 0;
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;
2907
2908 /* "roc_cy.pyx":29
2909 * g_pids = np.asarray(g_pids, dtype=np.int64)
2910 * q_camids = np.asarray(q_camids, dtype=np.int64)
2911 * g_camids = np.asarray(g_camids, dtype=np.int64) # <<<<<<<<<<<<<<
2912 *
2913 * cdef long num_q = distmat.shape[0]
2914 */
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);
2926 __pyx_t_4 = 0;
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;
2947
2948 /* "roc_cy.pyx":31
2949 * g_camids = np.asarray(g_camids, dtype=np.int64)
2950 *
2951 * cdef long num_q = distmat.shape[0] # <<<<<<<<<<<<<<
2952 * cdef long num_g = distmat.shape[1]
2953 * cdef long dim = q_feats.shape[1]
2954 */
2955 __pyx_v_num_q = (__pyx_v_distmat.shape[0]);
2956
2957 /* "roc_cy.pyx":32
2958 *
2959 * cdef long num_q = distmat.shape[0]
2960 * cdef long num_g = distmat.shape[1] # <<<<<<<<<<<<<<
2961 * cdef long dim = q_feats.shape[1]
2962 *
2963 */
2964 __pyx_v_num_g = (__pyx_v_distmat.shape[1]);
2965
2966 /* "roc_cy.pyx":33
2967 * cdef long num_q = distmat.shape[0]
2968 * cdef long num_g = distmat.shape[1]
2969 * cdef long dim = q_feats.shape[1] # <<<<<<<<<<<<<<
2970 *
2971 * cdef long[:,:] indices
2972 */
2973 __pyx_v_dim = (__pyx_v_q_feats.shape[1]);
2974
2975 /* "roc_cy.pyx":36
2976 *
2977 * cdef long[:,:] indices
2978 * cdef index = faiss.IndexFlatL2(dim) # <<<<<<<<<<<<<<
2979 * index.add(np.asarray(g_feats))
2980 *
2981 */
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);
2989 __pyx_t_5 = NULL;
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);
2997 }
2998 }
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;
3006 __pyx_t_2 = 0;
3007
3008 /* "roc_cy.pyx":37
3009 * cdef long[:,:] indices
3010 * cdef index = faiss.IndexFlatL2(dim)
3011 * index.add(np.asarray(g_feats)) # <<<<<<<<<<<<<<
3012 *
3013 * indices = index.search(np.asarray(q_feats), k=num_g)[1]
3014 */
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);
3024 __pyx_t_8 = NULL;
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);
3032 }
3033 }
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;
3040 __pyx_t_1 = NULL;
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);
3048 }
3049 }
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;
3057
3058 /* "roc_cy.pyx":39
3059 * index.add(np.asarray(g_feats))
3060 *
3061 * indices = index.search(np.asarray(q_feats), k=num_g)[1] # <<<<<<<<<<<<<<
3062 *
3063 * cdef:
3064 */
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);
3074 __pyx_t_5 = NULL;
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);
3082 }
3083 }
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);
3094 __pyx_t_3 = 0;
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;
3114
3115 /* "roc_cy.pyx":42
3116 *
3117 * cdef:
3118 * long[:,:] matches = (np.asarray(g_pids)[np.asarray(indices)] == np.asarray(q_pids)[:, np.newaxis]).astype(np.int64) # <<<<<<<<<<<<<<
3119 *
3120 * float[:] pos = np.zeros(num_q*num_g, dtype=np.float32)
3121 */
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);
3129 __pyx_t_5 = NULL;
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);
3137 }
3138 }
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);
3152 __pyx_t_8 = NULL;
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);
3160 }
3161 }
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);
3179 __pyx_t_8 = NULL;
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);
3187 }
3188 }
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);
3207 __pyx_t_4 = 0;
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;
3223 __pyx_t_1 = NULL;
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);
3231 }
3232 }
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;
3244
3245 /* "roc_cy.pyx":44
3246 * long[:,:] matches = (np.asarray(g_pids)[np.asarray(indices)] == np.asarray(q_pids)[:, np.newaxis]).astype(np.int64)
3247 *
3248 * float[:] pos = np.zeros(num_q*num_g, dtype=np.float32) # <<<<<<<<<<<<<<
3249 * float[:] neg = np.zeros(num_q*num_g, dtype=np.float32)
3250 *
3251 */
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);
3263 __pyx_t_3 = 0;
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;
3283
3284 /* "roc_cy.pyx":45
3285 *
3286 * float[:] pos = np.zeros(num_q*num_g, dtype=np.float32)
3287 * float[:] neg = np.zeros(num_q*num_g, dtype=np.float32) # <<<<<<<<<<<<<<
3288 *
3289 * long valid_pos = 0
3290 */
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);
3302 __pyx_t_2 = 0;
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;
3322
3323 /* "roc_cy.pyx":47
3324 * float[:] neg = np.zeros(num_q*num_g, dtype=np.float32)
3325 *
3326 * long valid_pos = 0 # <<<<<<<<<<<<<<
3327 * long valid_neg = 0
3328 * long ind
3329 */
3330 __pyx_v_valid_pos = 0;
3331
3332 /* "roc_cy.pyx":48
3333 *
3334 * long valid_pos = 0
3335 * long valid_neg = 0 # <<<<<<<<<<<<<<
3336 * long ind
3337 *
3338 */
3339 __pyx_v_valid_neg = 0;
3340
3341 /* "roc_cy.pyx":52
3342 *
3343 * long q_idx, q_pid, q_camid, g_idx
3344 * long[:] order = np.zeros(num_g, dtype=np.int64) # <<<<<<<<<<<<<<
3345 *
3346 * float[:] raw_cmc = np.zeros(num_g, dtype=np.float32) # binary vector, positions with value 1 are correct matches
3347 */
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);
3359 __pyx_t_1 = 0;
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;
3379
3380 /* "roc_cy.pyx":54
3381 * long[:] order = np.zeros(num_g, dtype=np.int64)
3382 *
3383 * float[:] raw_cmc = np.zeros(num_g, dtype=np.float32) # binary vector, positions with value 1 are correct matches # <<<<<<<<<<<<<<
3384 * long[:] sort_idx = np.zeros(num_g, dtype=np.int64)
3385 *
3386 */
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);
3398 __pyx_t_4 = 0;
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;
3418
3419 /* "roc_cy.pyx":55
3420 *
3421 * float[:] raw_cmc = np.zeros(num_g, dtype=np.float32) # binary vector, positions with value 1 are correct matches
3422 * long[:] sort_idx = np.zeros(num_g, dtype=np.int64) # <<<<<<<<<<<<<<
3423 *
3424 * long idx
3425 */
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);
3437 __pyx_t_3 = 0;
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;
3457
3458 /* "roc_cy.pyx":59
3459 * long idx
3460 *
3461 * for q_idx in range(num_q): # <<<<<<<<<<<<<<
3462 * # get query pid and camid
3463 * q_pid = q_pids[q_idx]
3464 */
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;
3469
3470 /* "roc_cy.pyx":61
3471 * for q_idx in range(num_q):
3472 * # get query pid and camid
3473 * q_pid = q_pids[q_idx] # <<<<<<<<<<<<<<
3474 * q_camid = q_camids[q_idx]
3475 *
3476 */
3477 __pyx_t_14 = __pyx_v_q_idx;
3478 __pyx_v_q_pid = (*((long *) ( /* dim=0 */ (__pyx_v_q_pids.data + __pyx_t_14 * __pyx_v_q_pids.strides[0]) )));
3479
3480 /* "roc_cy.pyx":62
3481 * # get query pid and camid
3482 * q_pid = q_pids[q_idx]
3483 * q_camid = q_camids[q_idx] # <<<<<<<<<<<<<<
3484 *
3485 * for g_idx in range(num_g):
3486 */
3487 __pyx_t_14 = __pyx_v_q_idx;
3488 __pyx_v_q_camid = (*((long *) ( /* dim=0 */ (__pyx_v_q_camids.data + __pyx_t_14 * __pyx_v_q_camids.strides[0]) )));
3489
3490 /* "roc_cy.pyx":64
3491 * q_camid = q_camids[q_idx]
3492 *
3493 * for g_idx in range(num_g): # <<<<<<<<<<<<<<
3494 * order[g_idx] = indices[q_idx, g_idx]
3495 * num_g_real = 0
3496 */
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;
3501
3502 /* "roc_cy.pyx":65
3503 *
3504 * for g_idx in range(num_g):
3505 * order[g_idx] = indices[q_idx, g_idx] # <<<<<<<<<<<<<<
3506 * num_g_real = 0
3507 *
3508 */
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 *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_19 * __pyx_v_order.strides[0]) )) = (*((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_14 * __pyx_v_indices.strides[0]) ) + __pyx_t_18 * __pyx_v_indices.strides[1]) )));
3513 }
3514
3515 /* "roc_cy.pyx":66
3516 * for g_idx in range(num_g):
3517 * order[g_idx] = indices[q_idx, g_idx]
3518 * num_g_real = 0 # <<<<<<<<<<<<<<
3519 *
3520 * # remove gallery samples that have the same pid and camid with query
3521 */
3522 __Pyx_INCREF(__pyx_int_0);
3523 __Pyx_XDECREF_SET(__pyx_v_num_g_real, __pyx_int_0);
3524
3525 /* "roc_cy.pyx":69
3526 *
3527 * # remove gallery samples that have the same pid and camid with query
3528 * for g_idx in range(num_g): # <<<<<<<<<<<<<<
3529 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid):
3530 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
3531 */
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;
3536
3537 /* "roc_cy.pyx":70
3538 * # remove gallery samples that have the same pid and camid with query
3539 * for g_idx in range(num_g):
3540 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid): # <<<<<<<<<<<<<<
3541 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
3542 * sort_idx[num_g_real] = order[g_idx]
3543 */
3544 __pyx_t_18 = __pyx_v_g_idx;
3545 __pyx_t_14 = (*((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_18 * __pyx_v_order.strides[0]) )));
3546 __pyx_t_21 = (((*((long *) ( /* dim=0 */ (__pyx_v_g_pids.data + __pyx_t_14 * __pyx_v_g_pids.strides[0]) ))) != __pyx_v_q_pid) != 0);
3547 if (!__pyx_t_21) {
3548 } else {
3549 __pyx_t_20 = __pyx_t_21;
3550 goto __pyx_L10_bool_binop_done;
3551 }
3552 __pyx_t_18 = __pyx_v_g_idx;
3553 __pyx_t_14 = (*((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_18 * __pyx_v_order.strides[0]) )));
3554 __pyx_t_21 = (((*((long *) ( /* dim=0 */ (__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:;
3557 if (__pyx_t_20) {
3558
3559 /* "roc_cy.pyx":71
3560 * for g_idx in range(num_g):
3561 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid):
3562 * raw_cmc[num_g_real] = matches[q_idx][g_idx] # <<<<<<<<<<<<<<
3563 * sort_idx[num_g_real] = order[g_idx]
3564 * num_g_real += 1
3565 */
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 *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_19 * __pyx_v_raw_cmc.strides[0]) )) = (*((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_matches.data + __pyx_t_18 * __pyx_v_matches.strides[0]) ) + __pyx_t_14 * __pyx_v_matches.strides[1]) )));
3571
3572 /* "roc_cy.pyx":72
3573 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid):
3574 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
3575 * sort_idx[num_g_real] = order[g_idx] # <<<<<<<<<<<<<<
3576 * num_g_real += 1
3577 *
3578 */
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 *) ( /* dim=0 */ (__pyx_v_sort_idx.data + __pyx_t_18 * __pyx_v_sort_idx.strides[0]) )) = (*((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_14 * __pyx_v_order.strides[0]) )));
3583
3584 /* "roc_cy.pyx":73
3585 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
3586 * sort_idx[num_g_real] = order[g_idx]
3587 * num_g_real += 1 # <<<<<<<<<<<<<<
3588 *
3589 * q_dist = distmat[q_idx]
3590 */
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);
3594 __pyx_t_2 = 0;
3595
3596 /* "roc_cy.pyx":70
3597 * # remove gallery samples that have the same pid and camid with query
3598 * for g_idx in range(num_g):
3599 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid): # <<<<<<<<<<<<<<
3600 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
3601 * sort_idx[num_g_real] = order[g_idx]
3602 */
3603 }
3604 }
3605
3606 /* "roc_cy.pyx":75
3607 * num_g_real += 1
3608 *
3609 * q_dist = distmat[q_idx] # <<<<<<<<<<<<<<
3610 *
3611 * for valid_idx in range(num_g_real):
3612 */
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);
3616 {
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;
3620}
3621
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;
3625
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);
3632 __pyx_t_2 = 0;
3633
3634 /* "roc_cy.pyx":77
3635 * q_dist = distmat[q_idx]
3636 *
3637 * for valid_idx in range(num_g_real): # <<<<<<<<<<<<<<
3638 * if raw_cmc[valid_idx] == 1:
3639 * pos[valid_pos] = q_dist[sort_idx[valid_idx]]
3640 */
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;
3645 __pyx_t_23 = NULL;
3646 } else {
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)
3650 }
3651 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3652 for (;;) {
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)
3658 #else
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);
3661 #endif
3662 } else {
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)
3666 #else
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);
3669 #endif
3670 }
3671 } else {
3672 __pyx_t_2 = __pyx_t_23(__pyx_t_3);
3673 if (unlikely(!__pyx_t_2)) {
3674 PyObject* exc_type = PyErr_Occurred();
3675 if (exc_type) {
3676 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3677 else __PYX_ERR(0, 77, __pyx_L1_error)
3678 }
3679 break;
3680 }
3681 __Pyx_GOTREF(__pyx_t_2);
3682 }
3683 __Pyx_XDECREF_SET(__pyx_v_valid_idx, __pyx_t_2);
3684 __pyx_t_2 = 0;
3685
3686 /* "roc_cy.pyx":78
3687 *
3688 * for valid_idx in range(num_g_real):
3689 * if raw_cmc[valid_idx] == 1: # <<<<<<<<<<<<<<
3690 * pos[valid_pos] = q_dist[sort_idx[valid_idx]]
3691 * valid_pos += 1
3692 */
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 *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_14 * __pyx_v_raw_cmc.strides[0]) ))) == 1.0) != 0);
3696 if (__pyx_t_20) {
3697
3698 /* "roc_cy.pyx":79
3699 * for valid_idx in range(num_g_real):
3700 * if raw_cmc[valid_idx] == 1:
3701 * pos[valid_pos] = q_dist[sort_idx[valid_idx]] # <<<<<<<<<<<<<<
3702 * valid_pos += 1
3703 * elif raw_cmc[valid_idx] == 0:
3704 */
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 *) ( /* dim=0 */ (__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 *) ( /* dim=0 */ (__pyx_v_pos.data + __pyx_t_14 * __pyx_v_pos.strides[0]) )) = __pyx_t_25;
3714
3715 /* "roc_cy.pyx":80
3716 * if raw_cmc[valid_idx] == 1:
3717 * pos[valid_pos] = q_dist[sort_idx[valid_idx]]
3718 * valid_pos += 1 # <<<<<<<<<<<<<<
3719 * elif raw_cmc[valid_idx] == 0:
3720 * neg[valid_neg] = q_dist[sort_idx[valid_idx]]
3721 */
3722 __pyx_v_valid_pos = (__pyx_v_valid_pos + 1);
3723
3724 /* "roc_cy.pyx":78
3725 *
3726 * for valid_idx in range(num_g_real):
3727 * if raw_cmc[valid_idx] == 1: # <<<<<<<<<<<<<<
3728 * pos[valid_pos] = q_dist[sort_idx[valid_idx]]
3729 * valid_pos += 1
3730 */
3731 goto __pyx_L14;
3732 }
3733
3734 /* "roc_cy.pyx":81
3735 * pos[valid_pos] = q_dist[sort_idx[valid_idx]]
3736 * valid_pos += 1
3737 * elif raw_cmc[valid_idx] == 0: # <<<<<<<<<<<<<<
3738 * neg[valid_neg] = q_dist[sort_idx[valid_idx]]
3739 * valid_neg += 1
3740 */
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 *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_14 * __pyx_v_raw_cmc.strides[0]) ))) == 0.0) != 0);
3744 if (__pyx_t_20) {
3745
3746 /* "roc_cy.pyx":82
3747 * valid_pos += 1
3748 * elif raw_cmc[valid_idx] == 0:
3749 * neg[valid_neg] = q_dist[sort_idx[valid_idx]] # <<<<<<<<<<<<<<
3750 * valid_neg += 1
3751 *
3752 */
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 *) ( /* dim=0 */ (__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 *) ( /* dim=0 */ (__pyx_v_neg.data + __pyx_t_14 * __pyx_v_neg.strides[0]) )) = __pyx_t_25;
3762
3763 /* "roc_cy.pyx":83
3764 * elif raw_cmc[valid_idx] == 0:
3765 * neg[valid_neg] = q_dist[sort_idx[valid_idx]]
3766 * valid_neg += 1 # <<<<<<<<<<<<<<
3767 *
3768 * cdef float[:] scores = np.hstack((pos[:valid_pos], neg[:valid_neg]))
3769 */
3770 __pyx_v_valid_neg = (__pyx_v_valid_neg + 1);
3771
3772 /* "roc_cy.pyx":81
3773 * pos[valid_pos] = q_dist[sort_idx[valid_idx]]
3774 * valid_pos += 1
3775 * elif raw_cmc[valid_idx] == 0: # <<<<<<<<<<<<<<
3776 * neg[valid_neg] = q_dist[sort_idx[valid_idx]]
3777 * valid_neg += 1
3778 */
3779 }
3780 __pyx_L14:;
3781
3782 /* "roc_cy.pyx":77
3783 * q_dist = distmat[q_idx]
3784 *
3785 * for valid_idx in range(num_g_real): # <<<<<<<<<<<<<<
3786 * if raw_cmc[valid_idx] == 1:
3787 * pos[valid_pos] = q_dist[sort_idx[valid_idx]]
3788 */
3789 }
3790 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3791 }
3792
3793 /* "roc_cy.pyx":85
3794 * valid_neg += 1
3795 *
3796 * cdef float[:] scores = np.hstack((pos[:valid_pos], neg[:valid_neg])) # <<<<<<<<<<<<<<
3797 * cdef float[:] labels = np.hstack((np.zeros(valid_pos, dtype=np.float32),
3798 * np.ones(valid_neg, dtype=np.float32)))
3799 */
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);
3808 __pyx_t_26 = -1;
3809 if (unlikely(__pyx_memoryview_slice_memviewslice(
3810 &__pyx_t_10,
3811 __pyx_v_pos.shape[0], __pyx_v_pos.strides[0], __pyx_v_pos.suboffsets[0],
3812 0,
3813 0,
3814 &__pyx_t_26,
3815 0,
3816 __pyx_v_valid_pos,
3817 0,
3818 0,
3819 1,
3820 0,
3821 1) < 0))
3822{
3823 __PYX_ERR(0, 85, __pyx_L1_error)
3824}
3825
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);
3834 __pyx_t_26 = -1;
3835 if (unlikely(__pyx_memoryview_slice_memviewslice(
3836 &__pyx_t_10,
3837 __pyx_v_neg.shape[0], __pyx_v_neg.strides[0], __pyx_v_neg.suboffsets[0],
3838 0,
3839 0,
3840 &__pyx_t_26,
3841 0,
3842 __pyx_v_valid_neg,
3843 0,
3844 0,
3845 1,
3846 0,
3847 1) < 0))
3848{
3849 __PYX_ERR(0, 85, __pyx_L1_error)
3850}
3851
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);
3863 __pyx_t_2 = 0;
3864 __pyx_t_4 = 0;
3865 __pyx_t_4 = NULL;
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);
3873 }
3874 }
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;
3886
3887 /* "roc_cy.pyx":86
3888 *
3889 * cdef float[:] scores = np.hstack((pos[:valid_pos], neg[:valid_neg]))
3890 * cdef float[:] labels = np.hstack((np.zeros(valid_pos, dtype=np.float32), # <<<<<<<<<<<<<<
3891 * np.ones(valid_neg, dtype=np.float32)))
3892 * return np.asarray(scores), np.asarray(labels)
3893 */
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);
3910 __pyx_t_5 = 0;
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;
3925
3926 /* "roc_cy.pyx":87
3927 * cdef float[:] scores = np.hstack((pos[:valid_pos], neg[:valid_neg]))
3928 * cdef float[:] labels = np.hstack((np.zeros(valid_pos, dtype=np.float32),
3929 * np.ones(valid_neg, dtype=np.float32))) # <<<<<<<<<<<<<<
3930 * return np.asarray(scores), np.asarray(labels)
3931 *
3932 */
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);
3944 __pyx_t_5 = 0;
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;
3959
3960 /* "roc_cy.pyx":86
3961 *
3962 * cdef float[:] scores = np.hstack((pos[:valid_pos], neg[:valid_neg]))
3963 * cdef float[:] labels = np.hstack((np.zeros(valid_pos, dtype=np.float32), # <<<<<<<<<<<<<<
3964 * np.ones(valid_neg, dtype=np.float32)))
3965 * return np.asarray(scores), np.asarray(labels)
3966 */
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);
3973 __pyx_t_27 = 0;
3974 __pyx_t_28 = 0;
3975 __pyx_t_28 = NULL;
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);
3983 }
3984 }
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;
3996
3997 /* "roc_cy.pyx":88
3998 * cdef float[:] labels = np.hstack((np.zeros(valid_pos, dtype=np.float32),
3999 * np.ones(valid_neg, dtype=np.float32)))
4000 * return np.asarray(scores), np.asarray(labels) # <<<<<<<<<<<<<<
4001 *
4002 *
4003 */
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);
4012 __pyx_t_28 = NULL;
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);
4020 }
4021 }
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);
4035 __pyx_t_27 = NULL;
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);
4043 }
4044 }
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);
4057 __pyx_t_3 = 0;
4058 __pyx_t_5 = 0;
4059 __pyx_r = __pyx_t_28;
4060 __pyx_t_28 = 0;
4061 goto __pyx_L0;
4062
4063 /* "roc_cy.pyx":20
4064 *
4065 * # Main interface
4066 * cpdef evaluate_roc_cy(float[:,:] distmat, float[:,:] q_feats, float[:,:] g_feats, long[:] q_pids, long[:]g_pids, # <<<<<<<<<<<<<<
4067 * long[:]q_camids, long[:]g_camids):
4068 *
4069 */
4070
4071 /* function exit code */
4072 __pyx_L1_error:;
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);
4086 __pyx_r = 0;
4087 __pyx_L0:;
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();
4110 return __pyx_r;
4111}
4112
4113/* Python wrapper */
4114static PyObject *__pyx_pw_6roc_cy_1evaluate_roc_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
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);
4129 {
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)) {
4133 Py_ssize_t kw_args;
4134 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4135 switch (pos_args) {
4136 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4137 CYTHON_FALLTHROUGH;
4138 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4139 CYTHON_FALLTHROUGH;
4140 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4141 CYTHON_FALLTHROUGH;
4142 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4143 CYTHON_FALLTHROUGH;
4144 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4145 CYTHON_FALLTHROUGH;
4146 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4147 CYTHON_FALLTHROUGH;
4148 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4149 CYTHON_FALLTHROUGH;
4150 case 0: break;
4151 default: goto __pyx_L5_argtuple_error;
4152 }
4153 kw_args = PyDict_Size(__pyx_kwds);
4154 switch (pos_args) {
4155 case 0:
4156 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distmat)) != 0)) kw_args--;
4157 else goto __pyx_L5_argtuple_error;
4158 CYTHON_FALLTHROUGH;
4159 case 1:
4160 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_feats)) != 0)) kw_args--;
4161 else {
4162 __Pyx_RaiseArgtupleInvalid("evaluate_roc_cy", 1, 7, 7, 1); __PYX_ERR(0, 20, __pyx_L3_error)
4163 }
4164 CYTHON_FALLTHROUGH;
4165 case 2:
4166 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_feats)) != 0)) kw_args--;
4167 else {
4168 __Pyx_RaiseArgtupleInvalid("evaluate_roc_cy", 1, 7, 7, 2); __PYX_ERR(0, 20, __pyx_L3_error)
4169 }
4170 CYTHON_FALLTHROUGH;
4171 case 3:
4172 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_pids)) != 0)) kw_args--;
4173 else {
4174 __Pyx_RaiseArgtupleInvalid("evaluate_roc_cy", 1, 7, 7, 3); __PYX_ERR(0, 20, __pyx_L3_error)
4175 }
4176 CYTHON_FALLTHROUGH;
4177 case 4:
4178 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_pids)) != 0)) kw_args--;
4179 else {
4180 __Pyx_RaiseArgtupleInvalid("evaluate_roc_cy", 1, 7, 7, 4); __PYX_ERR(0, 20, __pyx_L3_error)
4181 }
4182 CYTHON_FALLTHROUGH;
4183 case 5:
4184 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_camids)) != 0)) kw_args--;
4185 else {
4186 __Pyx_RaiseArgtupleInvalid("evaluate_roc_cy", 1, 7, 7, 5); __PYX_ERR(0, 20, __pyx_L3_error)
4187 }
4188 CYTHON_FALLTHROUGH;
4189 case 6:
4190 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_camids)) != 0)) kw_args--;
4191 else {
4192 __Pyx_RaiseArgtupleInvalid("evaluate_roc_cy", 1, 7, 7, 6); __PYX_ERR(0, 20, __pyx_L3_error)
4193 }
4194 }
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)
4197 }
4198 } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
4199 goto __pyx_L5_argtuple_error;
4200 } else {
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);
4208 }
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)
4216 }
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)
4220 __pyx_L3_error:;
4221 __Pyx_AddTraceback("roc_cy.evaluate_roc_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
4222 __Pyx_RefNannyFinishContext();
4223 return NULL;
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);
4226
4227 /* function exit code */
4228 __Pyx_RefNannyFinishContext();
4229 return __pyx_r;
4230}
4231
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;
4251 __pyx_t_1 = 0;
4252 goto __pyx_L0;
4253
4254 /* function exit code */
4255 __pyx_L1_error:;
4256 __Pyx_XDECREF(__pyx_t_1);
4257 __Pyx_AddTraceback("roc_cy.evaluate_roc_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
4258 __pyx_r = NULL;
4259 __pyx_L0:;
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();
4269 return __pyx_r;
4270}
4271
4272/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":735
4273 * ctypedef npy_cdouble complex_t
4274 *
4275 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
4276 * return PyArray_MultiIterNew(1, <void*>a)
4277 *
4278 */
4279
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);
4288
4289 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":736
4290 *
4291 * cdef inline object PyArray_MultiIterNew1(a):
4292 * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
4293 *
4294 * cdef inline object PyArray_MultiIterNew2(a, b):
4295 */
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;
4300 __pyx_t_1 = 0;
4301 goto __pyx_L0;
4302
4303 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":735
4304 * ctypedef npy_cdouble complex_t
4305 *
4306 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
4307 * return PyArray_MultiIterNew(1, <void*>a)
4308 *
4309 */
4310
4311 /* function exit code */
4312 __pyx_L1_error:;
4313 __Pyx_XDECREF(__pyx_t_1);
4314 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
4315 __pyx_r = 0;
4316 __pyx_L0:;
4317 __Pyx_XGIVEREF(__pyx_r);
4318 __Pyx_RefNannyFinishContext();
4319 return __pyx_r;
4320}
4321
4322/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":738
4323 * return PyArray_MultiIterNew(1, <void*>a)
4324 *
4325 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
4326 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4327 *
4328 */
4329
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);
4338
4339 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":739
4340 *
4341 * cdef inline object PyArray_MultiIterNew2(a, b):
4342 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
4343 *
4344 * cdef inline object PyArray_MultiIterNew3(a, b, c):
4345 */
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;
4350 __pyx_t_1 = 0;
4351 goto __pyx_L0;
4352
4353 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":738
4354 * return PyArray_MultiIterNew(1, <void*>a)
4355 *
4356 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
4357 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4358 *
4359 */
4360
4361 /* function exit code */
4362 __pyx_L1_error:;
4363 __Pyx_XDECREF(__pyx_t_1);
4364 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
4365 __pyx_r = 0;
4366 __pyx_L0:;
4367 __Pyx_XGIVEREF(__pyx_r);
4368 __Pyx_RefNannyFinishContext();
4369 return __pyx_r;
4370}
4371
4372/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":741
4373 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4374 *
4375 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
4376 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4377 *
4378 */
4379
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);
4388
4389 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":742
4390 *
4391 * cdef inline object PyArray_MultiIterNew3(a, b, c):
4392 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
4393 *
4394 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
4395 */
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;
4400 __pyx_t_1 = 0;
4401 goto __pyx_L0;
4402
4403 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":741
4404 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
4405 *
4406 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
4407 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4408 *
4409 */
4410
4411 /* function exit code */
4412 __pyx_L1_error:;
4413 __Pyx_XDECREF(__pyx_t_1);
4414 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
4415 __pyx_r = 0;
4416 __pyx_L0:;
4417 __Pyx_XGIVEREF(__pyx_r);
4418 __Pyx_RefNannyFinishContext();
4419 return __pyx_r;
4420}
4421
4422/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":744
4423 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4424 *
4425 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
4426 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4427 *
4428 */
4429
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);
4438
4439 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":745
4440 *
4441 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
4442 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
4443 *
4444 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
4445 */
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;
4450 __pyx_t_1 = 0;
4451 goto __pyx_L0;
4452
4453 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":744
4454 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
4455 *
4456 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
4457 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4458 *
4459 */
4460
4461 /* function exit code */
4462 __pyx_L1_error:;
4463 __Pyx_XDECREF(__pyx_t_1);
4464 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
4465 __pyx_r = 0;
4466 __pyx_L0:;
4467 __Pyx_XGIVEREF(__pyx_r);
4468 __Pyx_RefNannyFinishContext();
4469 return __pyx_r;
4470}
4471
4472/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":747
4473 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4474 *
4475 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
4476 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4477 *
4478 */
4479
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);
4488
4489 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":748
4490 *
4491 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
4492 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
4493 *
4494 * cdef inline tuple PyDataType_SHAPE(dtype d):
4495 */
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;
4500 __pyx_t_1 = 0;
4501 goto __pyx_L0;
4502
4503 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":747
4504 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
4505 *
4506 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
4507 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4508 *
4509 */
4510
4511 /* function exit code */
4512 __pyx_L1_error:;
4513 __Pyx_XDECREF(__pyx_t_1);
4514 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
4515 __pyx_r = 0;
4516 __pyx_L0:;
4517 __Pyx_XGIVEREF(__pyx_r);
4518 __Pyx_RefNannyFinishContext();
4519 return __pyx_r;
4520}
4521
4522/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":750
4523 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4524 *
4525 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
4526 * if PyDataType_HASSUBARRAY(d):
4527 * return <tuple>d.subarray.shape
4528 */
4529
4530static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
4531 PyObject *__pyx_r = NULL;
4532 __Pyx_RefNannyDeclarations
4533 int __pyx_t_1;
4534 __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
4535
4536 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":751
4537 *
4538 * cdef inline tuple PyDataType_SHAPE(dtype d):
4539 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
4540 * return <tuple>d.subarray.shape
4541 * else:
4542 */
4543 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
4544 if (__pyx_t_1) {
4545
4546 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":752
4547 * cdef inline tuple PyDataType_SHAPE(dtype d):
4548 * if PyDataType_HASSUBARRAY(d):
4549 * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
4550 * else:
4551 * return ()
4552 */
4553 __Pyx_XDECREF(__pyx_r);
4554 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
4555 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
4556 goto __pyx_L0;
4557
4558 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":751
4559 *
4560 * cdef inline tuple PyDataType_SHAPE(dtype d):
4561 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
4562 * return <tuple>d.subarray.shape
4563 * else:
4564 */
4565 }
4566
4567 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":754
4568 * return <tuple>d.subarray.shape
4569 * else:
4570 * return () # <<<<<<<<<<<<<<
4571 *
4572 *
4573 */
4574 /*else*/ {
4575 __Pyx_XDECREF(__pyx_r);
4576 __Pyx_INCREF(__pyx_empty_tuple);
4577 __pyx_r = __pyx_empty_tuple;
4578 goto __pyx_L0;
4579 }
4580
4581 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":750
4582 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
4583 *
4584 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
4585 * if PyDataType_HASSUBARRAY(d):
4586 * return <tuple>d.subarray.shape
4587 */
4588
4589 /* function exit code */
4590 __pyx_L0:;
4591 __Pyx_XGIVEREF(__pyx_r);
4592 __Pyx_RefNannyFinishContext();
4593 return __pyx_r;
4594}
4595
4596/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":929
4597 * int _import_umath() except -1
4598 *
4599 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
4600 * Py_INCREF(base) # important to do this before stealing the reference below!
4601 * PyArray_SetBaseObject(arr, base)
4602 */
4603
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);
4607
4608 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":930
4609 *
4610 * cdef inline void set_array_base(ndarray arr, object base):
4611 * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
4612 * PyArray_SetBaseObject(arr, base)
4613 *
4614 */
4615 Py_INCREF(__pyx_v_base);
4616
4617 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":931
4618 * cdef inline void set_array_base(ndarray arr, object base):
4619 * Py_INCREF(base) # important to do this before stealing the reference below!
4620 * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
4621 *
4622 * cdef inline object get_array_base(ndarray arr):
4623 */
4624 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
4625
4626 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":929
4627 * int _import_umath() except -1
4628 *
4629 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
4630 * Py_INCREF(base) # important to do this before stealing the reference below!
4631 * PyArray_SetBaseObject(arr, base)
4632 */
4633
4634 /* function exit code */
4635 __Pyx_RefNannyFinishContext();
4636}
4637
4638/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":933
4639 * PyArray_SetBaseObject(arr, base)
4640 *
4641 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
4642 * base = PyArray_BASE(arr)
4643 * if base is NULL:
4644 */
4645
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
4650 int __pyx_t_1;
4651 __Pyx_RefNannySetupContext("get_array_base", 0);
4652
4653 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":934
4654 *
4655 * cdef inline object get_array_base(ndarray arr):
4656 * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
4657 * if base is NULL:
4658 * return None
4659 */
4660 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
4661
4662 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":935
4663 * cdef inline object get_array_base(ndarray arr):
4664 * base = PyArray_BASE(arr)
4665 * if base is NULL: # <<<<<<<<<<<<<<
4666 * return None
4667 * return <object>base
4668 */
4669 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
4670 if (__pyx_t_1) {
4671
4672 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":936
4673 * base = PyArray_BASE(arr)
4674 * if base is NULL:
4675 * return None # <<<<<<<<<<<<<<
4676 * return <object>base
4677 *
4678 */
4679 __Pyx_XDECREF(__pyx_r);
4680 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4681 goto __pyx_L0;
4682
4683 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":935
4684 * cdef inline object get_array_base(ndarray arr):
4685 * base = PyArray_BASE(arr)
4686 * if base is NULL: # <<<<<<<<<<<<<<
4687 * return None
4688 * return <object>base
4689 */
4690 }
4691
4692 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":937
4693 * if base is NULL:
4694 * return None
4695 * return <object>base # <<<<<<<<<<<<<<
4696 *
4697 * # Versions of the import_* functions which are more suitable for
4698 */
4699 __Pyx_XDECREF(__pyx_r);
4700 __Pyx_INCREF(((PyObject *)__pyx_v_base));
4701 __pyx_r = ((PyObject *)__pyx_v_base);
4702 goto __pyx_L0;
4703
4704 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":933
4705 * PyArray_SetBaseObject(arr, base)
4706 *
4707 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
4708 * base = PyArray_BASE(arr)
4709 * if base is NULL:
4710 */
4711
4712 /* function exit code */
4713 __pyx_L0:;
4714 __Pyx_XGIVEREF(__pyx_r);
4715 __Pyx_RefNannyFinishContext();
4716 return __pyx_r;
4717}
4718
4719/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":941
4720 * # Versions of the import_* functions which are more suitable for
4721 * # Cython code.
4722 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
4723 * try:
4724 * __pyx_import_array()
4725 */
4726
4727static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
4728 int __pyx_r;
4729 __Pyx_RefNannyDeclarations
4730 PyObject *__pyx_t_1 = NULL;
4731 PyObject *__pyx_t_2 = NULL;
4732 PyObject *__pyx_t_3 = NULL;
4733 int __pyx_t_4;
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);
4742
4743 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":942
4744 * # Cython code.
4745 * cdef inline int import_array() except -1:
4746 * try: # <<<<<<<<<<<<<<
4747 * __pyx_import_array()
4748 * except Exception:
4749 */
4750 {
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);
4757 /*try:*/ {
4758
4759 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":943
4760 * cdef inline int import_array() except -1:
4761 * try:
4762 * __pyx_import_array() # <<<<<<<<<<<<<<
4763 * except Exception:
4764 * raise ImportError("numpy.core.multiarray failed to import")
4765 */
4766 __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
4767
4768 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":942
4769 * # Cython code.
4770 * cdef inline int import_array() except -1:
4771 * try: # <<<<<<<<<<<<<<
4772 * __pyx_import_array()
4773 * except Exception:
4774 */
4775 }
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;
4780 __pyx_L3_error:;
4781
4782 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":944
4783 * try:
4784 * __pyx_import_array()
4785 * except Exception: # <<<<<<<<<<<<<<
4786 * raise ImportError("numpy.core.multiarray failed to import")
4787 *
4788 */
4789 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4790 if (__pyx_t_4) {
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);
4796
4797 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":945
4798 * __pyx_import_array()
4799 * except Exception:
4800 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
4801 *
4802 * cdef inline int import_umath() except -1:
4803 */
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)
4809 }
4810 goto __pyx_L5_except_error;
4811 __pyx_L5_except_error:;
4812
4813 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":942
4814 * # Cython code.
4815 * cdef inline int import_array() except -1:
4816 * try: # <<<<<<<<<<<<<<
4817 * __pyx_import_array()
4818 * except Exception:
4819 */
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;
4825 __pyx_L8_try_end:;
4826 }
4827
4828 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":941
4829 * # Versions of the import_* functions which are more suitable for
4830 * # Cython code.
4831 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
4832 * try:
4833 * __pyx_import_array()
4834 */
4835
4836 /* function exit code */
4837 __pyx_r = 0;
4838 goto __pyx_L0;
4839 __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);
4845 __pyx_r = -1;
4846 __pyx_L0:;
4847 __Pyx_RefNannyFinishContext();
4848 return __pyx_r;
4849}
4850
4851/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":947
4852 * raise ImportError("numpy.core.multiarray failed to import")
4853 *
4854 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
4855 * try:
4856 * _import_umath()
4857 */
4858
4859static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
4860 int __pyx_r;
4861 __Pyx_RefNannyDeclarations
4862 PyObject *__pyx_t_1 = NULL;
4863 PyObject *__pyx_t_2 = NULL;
4864 PyObject *__pyx_t_3 = NULL;
4865 int __pyx_t_4;
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);
4874
4875 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":948
4876 *
4877 * cdef inline int import_umath() except -1:
4878 * try: # <<<<<<<<<<<<<<
4879 * _import_umath()
4880 * except Exception:
4881 */
4882 {
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);
4889 /*try:*/ {
4890
4891 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":949
4892 * cdef inline int import_umath() except -1:
4893 * try:
4894 * _import_umath() # <<<<<<<<<<<<<<
4895 * except Exception:
4896 * raise ImportError("numpy.core.umath failed to import")
4897 */
4898 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
4899
4900 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":948
4901 *
4902 * cdef inline int import_umath() except -1:
4903 * try: # <<<<<<<<<<<<<<
4904 * _import_umath()
4905 * except Exception:
4906 */
4907 }
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;
4912 __pyx_L3_error:;
4913
4914 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":950
4915 * try:
4916 * _import_umath()
4917 * except Exception: # <<<<<<<<<<<<<<
4918 * raise ImportError("numpy.core.umath failed to import")
4919 *
4920 */
4921 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
4922 if (__pyx_t_4) {
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);
4928
4929 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":951
4930 * _import_umath()
4931 * except Exception:
4932 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
4933 *
4934 * cdef inline int import_ufunc() except -1:
4935 */
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)
4941 }
4942 goto __pyx_L5_except_error;
4943 __pyx_L5_except_error:;
4944
4945 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":948
4946 *
4947 * cdef inline int import_umath() except -1:
4948 * try: # <<<<<<<<<<<<<<
4949 * _import_umath()
4950 * except Exception:
4951 */
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;
4957 __pyx_L8_try_end:;
4958 }
4959
4960 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":947
4961 * raise ImportError("numpy.core.multiarray failed to import")
4962 *
4963 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
4964 * try:
4965 * _import_umath()
4966 */
4967
4968 /* function exit code */
4969 __pyx_r = 0;
4970 goto __pyx_L0;
4971 __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);
4977 __pyx_r = -1;
4978 __pyx_L0:;
4979 __Pyx_RefNannyFinishContext();
4980 return __pyx_r;
4981}
4982
4983/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":953
4984 * raise ImportError("numpy.core.umath failed to import")
4985 *
4986 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
4987 * try:
4988 * _import_umath()
4989 */
4990
4991static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
4992 int __pyx_r;
4993 __Pyx_RefNannyDeclarations
4994 PyObject *__pyx_t_1 = NULL;
4995 PyObject *__pyx_t_2 = NULL;
4996 PyObject *__pyx_t_3 = NULL;
4997 int __pyx_t_4;
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);
5006
5007 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":954
5008 *
5009 * cdef inline int import_ufunc() except -1:
5010 * try: # <<<<<<<<<<<<<<
5011 * _import_umath()
5012 * except Exception:
5013 */
5014 {
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);
5021 /*try:*/ {
5022
5023 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":955
5024 * cdef inline int import_ufunc() except -1:
5025 * try:
5026 * _import_umath() # <<<<<<<<<<<<<<
5027 * except Exception:
5028 * raise ImportError("numpy.core.umath failed to import")
5029 */
5030 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
5031
5032 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":954
5033 *
5034 * cdef inline int import_ufunc() except -1:
5035 * try: # <<<<<<<<<<<<<<
5036 * _import_umath()
5037 * except Exception:
5038 */
5039 }
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;
5044 __pyx_L3_error:;
5045
5046 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":956
5047 * try:
5048 * _import_umath()
5049 * except Exception: # <<<<<<<<<<<<<<
5050 * raise ImportError("numpy.core.umath failed to import")
5051 *
5052 */
5053 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
5054 if (__pyx_t_4) {
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);
5060
5061 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":957
5062 * _import_umath()
5063 * except Exception:
5064 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
5065 *
5066 * cdef extern from *:
5067 */
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)
5073 }
5074 goto __pyx_L5_except_error;
5075 __pyx_L5_except_error:;
5076
5077 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":954
5078 *
5079 * cdef inline int import_ufunc() except -1:
5080 * try: # <<<<<<<<<<<<<<
5081 * _import_umath()
5082 * except Exception:
5083 */
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;
5089 __pyx_L8_try_end:;
5090 }
5091
5092 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":953
5093 * raise ImportError("numpy.core.umath failed to import")
5094 *
5095 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
5096 * try:
5097 * _import_umath()
5098 */
5099
5100 /* function exit code */
5101 __pyx_r = 0;
5102 goto __pyx_L0;
5103 __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);
5109 __pyx_r = -1;
5110 __pyx_L0:;
5111 __Pyx_RefNannyFinishContext();
5112 return __pyx_r;
5113}
5114
5115/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":967
5116 *
5117 *
5118 * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
5119 * """
5120 * Cython equivalent of `isinstance(obj, np.timedelta64)`
5121 */
5122
5123static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
5124 int __pyx_r;
5125 __Pyx_RefNannyDeclarations
5126 __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
5127
5128 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":979
5129 * bool
5130 * """
5131 * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<<
5132 *
5133 *
5134 */
5135 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
5136 goto __pyx_L0;
5137
5138 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":967
5139 *
5140 *
5141 * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
5142 * """
5143 * Cython equivalent of `isinstance(obj, np.timedelta64)`
5144 */
5145
5146 /* function exit code */
5147 __pyx_L0:;
5148 __Pyx_RefNannyFinishContext();
5149 return __pyx_r;
5150}
5151
5152/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":982
5153 *
5154 *
5155 * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
5156 * """
5157 * Cython equivalent of `isinstance(obj, np.datetime64)`
5158 */
5159
5160static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
5161 int __pyx_r;
5162 __Pyx_RefNannyDeclarations
5163 __Pyx_RefNannySetupContext("is_datetime64_object", 0);
5164
5165 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":994
5166 * bool
5167 * """
5168 * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<<
5169 *
5170 *
5171 */
5172 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
5173 goto __pyx_L0;
5174
5175 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":982
5176 *
5177 *
5178 * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
5179 * """
5180 * Cython equivalent of `isinstance(obj, np.datetime64)`
5181 */
5182
5183 /* function exit code */
5184 __pyx_L0:;
5185 __Pyx_RefNannyFinishContext();
5186 return __pyx_r;
5187}
5188
5189/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":997
5190 *
5191 *
5192 * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
5193 * """
5194 * returns the int64 value underlying scalar numpy datetime64 object
5195 */
5196
5197static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
5198 npy_datetime __pyx_r;
5199
5200 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1004
5201 * also needed. That can be found using `get_datetime64_unit`.
5202 * """
5203 * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<<
5204 *
5205 *
5206 */
5207 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
5208 goto __pyx_L0;
5209
5210 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":997
5211 *
5212 *
5213 * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
5214 * """
5215 * returns the int64 value underlying scalar numpy datetime64 object
5216 */
5217
5218 /* function exit code */
5219 __pyx_L0:;
5220 return __pyx_r;
5221}
5222
5223/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1007
5224 *
5225 *
5226 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
5227 * """
5228 * returns the int64 value underlying scalar numpy timedelta64 object
5229 */
5230
5231static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
5232 npy_timedelta __pyx_r;
5233
5234 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1011
5235 * returns the int64 value underlying scalar numpy timedelta64 object
5236 * """
5237 * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<<
5238 *
5239 *
5240 */
5241 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
5242 goto __pyx_L0;
5243
5244 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1007
5245 *
5246 *
5247 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
5248 * """
5249 * returns the int64 value underlying scalar numpy timedelta64 object
5250 */
5251
5252 /* function exit code */
5253 __pyx_L0:;
5254 return __pyx_r;
5255}
5256
5257/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1014
5258 *
5259 *
5260 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
5261 * """
5262 * returns the unit part of the dtype for a numpy datetime64 object.
5263 */
5264
5265static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
5266 NPY_DATETIMEUNIT __pyx_r;
5267
5268 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1018
5269 * returns the unit part of the dtype for a numpy datetime64 object.
5270 * """
5271 * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<<
5272 */
5273 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
5274 goto __pyx_L0;
5275
5276 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1014
5277 *
5278 *
5279 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
5280 * """
5281 * returns the unit part of the dtype for a numpy datetime64 object.
5282 */
5283
5284 /* function exit code */
5285 __pyx_L0:;
5286 return __pyx_r;
5287}
5288
5289/* "View.MemoryView":122
5290 * cdef bint dtype_is_object
5291 *
5292 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
5293 * mode="c", bint allocate_buffer=True):
5294 *
5295 */
5296
5297/* Python wrapper */
5298static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
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;
5308 int __pyx_r;
5309 __Pyx_RefNannyDeclarations
5310 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
5311 {
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)) {
5316 Py_ssize_t kw_args;
5317 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5318 switch (pos_args) {
5319 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5320 CYTHON_FALLTHROUGH;
5321 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5322 CYTHON_FALLTHROUGH;
5323 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5324 CYTHON_FALLTHROUGH;
5325 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5326 CYTHON_FALLTHROUGH;
5327 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5328 CYTHON_FALLTHROUGH;
5329 case 0: break;
5330 default: goto __pyx_L5_argtuple_error;
5331 }
5332 kw_args = PyDict_Size(__pyx_kwds);
5333 switch (pos_args) {
5334 case 0:
5335 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
5336 else goto __pyx_L5_argtuple_error;
5337 CYTHON_FALLTHROUGH;
5338 case 1:
5339 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
5340 else {
5341 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
5342 }
5343 CYTHON_FALLTHROUGH;
5344 case 2:
5345 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
5346 else {
5347 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
5348 }
5349 CYTHON_FALLTHROUGH;
5350 case 3:
5351 if (kw_args > 0) {
5352 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
5353 if (value) { values[3] = value; kw_args--; }
5354 }
5355 CYTHON_FALLTHROUGH;
5356 case 4:
5357 if (kw_args > 0) {
5358 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
5359 if (value) { values[4] = value; kw_args--; }
5360 }
5361 }
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)
5364 }
5365 } else {
5366 switch (PyTuple_GET_SIZE(__pyx_args)) {
5367 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5368 CYTHON_FALLTHROUGH;
5369 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5370 CYTHON_FALLTHROUGH;
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);
5374 break;
5375 default: goto __pyx_L5_argtuple_error;
5376 }
5377 }
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];
5382 if (values[4]) {
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)
5384 } else {
5385
5386 /* "View.MemoryView":123
5387 *
5388 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
5389 * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
5390 *
5391 * cdef int idx
5392 */
5393 __pyx_v_allocate_buffer = ((int)1);
5394 }
5395 }
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)
5399 __pyx_L3_error:;
5400 __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5401 __Pyx_RefNannyFinishContext();
5402 return -1;
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)
5407 }
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);
5409
5410 /* "View.MemoryView":122
5411 * cdef bint dtype_is_object
5412 *
5413 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
5414 * mode="c", bint allocate_buffer=True):
5415 *
5416 */
5417
5418 /* function exit code */
5419 goto __pyx_L0;
5420 __pyx_L1_error:;
5421 __pyx_r = -1;
5422 __pyx_L0:;
5423 __Pyx_RefNannyFinishContext();
5424 return __pyx_r;
5425}
5426
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) {
5428 int __pyx_v_idx;
5429 Py_ssize_t __pyx_v_i;
5430 Py_ssize_t __pyx_v_dim;
5431 PyObject **__pyx_v_p;
5432 char __pyx_v_order;
5433 int __pyx_r;
5434 __Pyx_RefNannyDeclarations
5435 Py_ssize_t __pyx_t_1;
5436 int __pyx_t_2;
5437 PyObject *__pyx_t_3 = NULL;
5438 int __pyx_t_4;
5439 PyObject *__pyx_t_5 = NULL;
5440 PyObject *__pyx_t_6 = NULL;
5441 char *__pyx_t_7;
5442 int __pyx_t_8;
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);
5451
5452 /* "View.MemoryView":129
5453 * cdef PyObject **p
5454 *
5455 * self.ndim = <int> len(shape) # <<<<<<<<<<<<<<
5456 * self.itemsize = itemsize
5457 *
5458 */
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)
5462 }
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);
5465
5466 /* "View.MemoryView":130
5467 *
5468 * self.ndim = <int> len(shape)
5469 * self.itemsize = itemsize # <<<<<<<<<<<<<<
5470 *
5471 * if not self.ndim:
5472 */
5473 __pyx_v_self->itemsize = __pyx_v_itemsize;
5474
5475 /* "View.MemoryView":132
5476 * self.itemsize = itemsize
5477 *
5478 * if not self.ndim: # <<<<<<<<<<<<<<
5479 * raise ValueError("Empty shape tuple for cython.array")
5480 *
5481 */
5482 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
5483 if (unlikely(__pyx_t_2)) {
5484
5485 /* "View.MemoryView":133
5486 *
5487 * if not self.ndim:
5488 * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
5489 *
5490 * if itemsize <= 0:
5491 */
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)
5497
5498 /* "View.MemoryView":132
5499 * self.itemsize = itemsize
5500 *
5501 * if not self.ndim: # <<<<<<<<<<<<<<
5502 * raise ValueError("Empty shape tuple for cython.array")
5503 *
5504 */
5505 }
5506
5507 /* "View.MemoryView":135
5508 * raise ValueError("Empty shape tuple for cython.array")
5509 *
5510 * if itemsize <= 0: # <<<<<<<<<<<<<<
5511 * raise ValueError("itemsize <= 0 for cython.array")
5512 *
5513 */
5514 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
5515 if (unlikely(__pyx_t_2)) {
5516
5517 /* "View.MemoryView":136
5518 *
5519 * if itemsize <= 0:
5520 * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
5521 *
5522 * if not isinstance(format, bytes):
5523 */
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)
5529
5530 /* "View.MemoryView":135
5531 * raise ValueError("Empty shape tuple for cython.array")
5532 *
5533 * if itemsize <= 0: # <<<<<<<<<<<<<<
5534 * raise ValueError("itemsize <= 0 for cython.array")
5535 *
5536 */
5537 }
5538
5539 /* "View.MemoryView":138
5540 * raise ValueError("itemsize <= 0 for cython.array")
5541 *
5542 * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
5543 * format = format.encode('ASCII')
5544 * self._format = format # keep a reference to the byte string
5545 */
5546 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
5547 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
5548 if (__pyx_t_4) {
5549
5550 /* "View.MemoryView":139
5551 *
5552 * if not isinstance(format, bytes):
5553 * format = format.encode('ASCII') # <<<<<<<<<<<<<<
5554 * self._format = format # keep a reference to the byte string
5555 * self.format = self._format
5556 */
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);
5559 __pyx_t_6 = NULL;
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);
5567 }
5568 }
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);
5575 __pyx_t_3 = 0;
5576
5577 /* "View.MemoryView":138
5578 * raise ValueError("itemsize <= 0 for cython.array")
5579 *
5580 * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
5581 * format = format.encode('ASCII')
5582 * self._format = format # keep a reference to the byte string
5583 */
5584 }
5585
5586 /* "View.MemoryView":140
5587 * if not isinstance(format, bytes):
5588 * format = format.encode('ASCII')
5589 * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
5590 * self.format = self._format
5591 *
5592 */
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);
5600 __pyx_t_3 = 0;
5601
5602 /* "View.MemoryView":141
5603 * format = format.encode('ASCII')
5604 * self._format = format # keep a reference to the byte string
5605 * self.format = self._format # <<<<<<<<<<<<<<
5606 *
5607 *
5608 */
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)
5612 }
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;
5615
5616 /* "View.MemoryView":144
5617 *
5618 *
5619 * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
5620 * self._strides = self._shape + self.ndim
5621 *
5622 */
5623 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
5624
5625 /* "View.MemoryView":145
5626 *
5627 * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
5628 * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
5629 *
5630 * if not self._shape:
5631 */
5632 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
5633
5634 /* "View.MemoryView":147
5635 * self._strides = self._shape + self.ndim
5636 *
5637 * if not self._shape: # <<<<<<<<<<<<<<
5638 * raise MemoryError("unable to allocate shape and strides.")
5639 *
5640 */
5641 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
5642 if (unlikely(__pyx_t_4)) {
5643
5644 /* "View.MemoryView":148
5645 *
5646 * if not self._shape:
5647 * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
5648 *
5649 *
5650 */
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)
5656
5657 /* "View.MemoryView":147
5658 * self._strides = self._shape + self.ndim
5659 *
5660 * if not self._shape: # <<<<<<<<<<<<<<
5661 * raise MemoryError("unable to allocate shape and strides.")
5662 *
5663 */
5664 }
5665
5666 /* "View.MemoryView":151
5667 *
5668 *
5669 * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
5670 * if dim <= 0:
5671 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5672 */
5673 __pyx_t_8 = 0;
5674 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
5675 for (;;) {
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)
5679 #else
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);
5682 #endif
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);
5688
5689 /* "View.MemoryView":152
5690 *
5691 * for idx, dim in enumerate(shape):
5692 * if dim <= 0: # <<<<<<<<<<<<<<
5693 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5694 * self._shape[idx] = dim
5695 */
5696 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
5697 if (unlikely(__pyx_t_4)) {
5698
5699 /* "View.MemoryView":153
5700 * for idx, dim in enumerate(shape):
5701 * if dim <= 0:
5702 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<<
5703 * self._shape[idx] = dim
5704 *
5705 */
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);
5716 __pyx_t_5 = 0;
5717 __pyx_t_6 = 0;
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)
5727
5728 /* "View.MemoryView":152
5729 *
5730 * for idx, dim in enumerate(shape):
5731 * if dim <= 0: # <<<<<<<<<<<<<<
5732 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5733 * self._shape[idx] = dim
5734 */
5735 }
5736
5737 /* "View.MemoryView":154
5738 * if dim <= 0:
5739 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5740 * self._shape[idx] = dim # <<<<<<<<<<<<<<
5741 *
5742 * cdef char order
5743 */
5744 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
5745
5746 /* "View.MemoryView":151
5747 *
5748 *
5749 * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
5750 * if dim <= 0:
5751 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
5752 */
5753 }
5754 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5755
5756 /* "View.MemoryView":157
5757 *
5758 * cdef char order
5759 * if mode == 'fortran': # <<<<<<<<<<<<<<
5760 * order = b'F'
5761 * self.mode = u'fortran'
5762 */
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)
5764 if (__pyx_t_4) {
5765
5766 /* "View.MemoryView":158
5767 * cdef char order
5768 * if mode == 'fortran':
5769 * order = b'F' # <<<<<<<<<<<<<<
5770 * self.mode = u'fortran'
5771 * elif mode == 'c':
5772 */
5773 __pyx_v_order = 'F';
5774
5775 /* "View.MemoryView":159
5776 * if mode == 'fortran':
5777 * order = b'F'
5778 * self.mode = u'fortran' # <<<<<<<<<<<<<<
5779 * elif mode == 'c':
5780 * order = b'C'
5781 */
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;
5787
5788 /* "View.MemoryView":157
5789 *
5790 * cdef char order
5791 * if mode == 'fortran': # <<<<<<<<<<<<<<
5792 * order = b'F'
5793 * self.mode = u'fortran'
5794 */
5795 goto __pyx_L10;
5796 }
5797
5798 /* "View.MemoryView":160
5799 * order = b'F'
5800 * self.mode = u'fortran'
5801 * elif mode == 'c': # <<<<<<<<<<<<<<
5802 * order = b'C'
5803 * self.mode = u'c'
5804 */
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)) {
5807
5808 /* "View.MemoryView":161
5809 * self.mode = u'fortran'
5810 * elif mode == 'c':
5811 * order = b'C' # <<<<<<<<<<<<<<
5812 * self.mode = u'c'
5813 * else:
5814 */
5815 __pyx_v_order = 'C';
5816
5817 /* "View.MemoryView":162
5818 * elif mode == 'c':
5819 * order = b'C'
5820 * self.mode = u'c' # <<<<<<<<<<<<<<
5821 * else:
5822 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
5823 */
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;
5829
5830 /* "View.MemoryView":160
5831 * order = b'F'
5832 * self.mode = u'fortran'
5833 * elif mode == 'c': # <<<<<<<<<<<<<<
5834 * order = b'C'
5835 * self.mode = u'c'
5836 */
5837 goto __pyx_L10;
5838 }
5839
5840 /* "View.MemoryView":164
5841 * self.mode = u'c'
5842 * else:
5843 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
5844 *
5845 * self.len = fill_contig_strides_array(self._shape, self._strides,
5846 */
5847 /*else*/ {
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)
5856 }
5857 __pyx_L10:;
5858
5859 /* "View.MemoryView":166
5860 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
5861 *
5862 * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
5863 * itemsize, self.ndim, order)
5864 *
5865 */
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);
5867
5868 /* "View.MemoryView":169
5869 * itemsize, self.ndim, order)
5870 *
5871 * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
5872 * self.dtype_is_object = format == b'O'
5873 * if allocate_buffer:
5874 */
5875 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
5876
5877 /* "View.MemoryView":170
5878 *
5879 * self.free_data = allocate_buffer
5880 * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
5881 * if allocate_buffer:
5882 *
5883 */
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;
5888
5889 /* "View.MemoryView":171
5890 * self.free_data = allocate_buffer
5891 * self.dtype_is_object = format == b'O'
5892 * if allocate_buffer: # <<<<<<<<<<<<<<
5893 *
5894 *
5895 */
5896 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
5897 if (__pyx_t_4) {
5898
5899 /* "View.MemoryView":174
5900 *
5901 *
5902 * self.data = <char *>malloc(self.len) # <<<<<<<<<<<<<<
5903 * if not self.data:
5904 * raise MemoryError("unable to allocate array data.")
5905 */
5906 __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
5907
5908 /* "View.MemoryView":175
5909 *
5910 * self.data = <char *>malloc(self.len)
5911 * if not self.data: # <<<<<<<<<<<<<<
5912 * raise MemoryError("unable to allocate array data.")
5913 *
5914 */
5915 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
5916 if (unlikely(__pyx_t_4)) {
5917
5918 /* "View.MemoryView":176
5919 * self.data = <char *>malloc(self.len)
5920 * if not self.data:
5921 * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
5922 *
5923 * if self.dtype_is_object:
5924 */
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)
5930
5931 /* "View.MemoryView":175
5932 *
5933 * self.data = <char *>malloc(self.len)
5934 * if not self.data: # <<<<<<<<<<<<<<
5935 * raise MemoryError("unable to allocate array data.")
5936 *
5937 */
5938 }
5939
5940 /* "View.MemoryView":178
5941 * raise MemoryError("unable to allocate array data.")
5942 *
5943 * if self.dtype_is_object: # <<<<<<<<<<<<<<
5944 * p = <PyObject **> self.data
5945 * for i in range(self.len / itemsize):
5946 */
5947 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
5948 if (__pyx_t_4) {
5949
5950 /* "View.MemoryView":179
5951 *
5952 * if self.dtype_is_object:
5953 * p = <PyObject **> self.data # <<<<<<<<<<<<<<
5954 * for i in range(self.len / itemsize):
5955 * p[i] = Py_None
5956 */
5957 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
5958
5959 /* "View.MemoryView":180
5960 * if self.dtype_is_object:
5961 * p = <PyObject **> self.data
5962 * for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
5963 * p[i] = Py_None
5964 * Py_INCREF(Py_None)
5965 */
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)
5969 }
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)
5973 }
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;
5978
5979 /* "View.MemoryView":181
5980 * p = <PyObject **> self.data
5981 * for i in range(self.len / itemsize):
5982 * p[i] = Py_None # <<<<<<<<<<<<<<
5983 * Py_INCREF(Py_None)
5984 *
5985 */
5986 (__pyx_v_p[__pyx_v_i]) = Py_None;
5987
5988 /* "View.MemoryView":182
5989 * for i in range(self.len / itemsize):
5990 * p[i] = Py_None
5991 * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
5992 *
5993 * @cname('getbuffer')
5994 */
5995 Py_INCREF(Py_None);
5996 }
5997
5998 /* "View.MemoryView":178
5999 * raise MemoryError("unable to allocate array data.")
6000 *
6001 * if self.dtype_is_object: # <<<<<<<<<<<<<<
6002 * p = <PyObject **> self.data
6003 * for i in range(self.len / itemsize):
6004 */
6005 }
6006
6007 /* "View.MemoryView":171
6008 * self.free_data = allocate_buffer
6009 * self.dtype_is_object = format == b'O'
6010 * if allocate_buffer: # <<<<<<<<<<<<<<
6011 *
6012 *
6013 */
6014 }
6015
6016 /* "View.MemoryView":122
6017 * cdef bint dtype_is_object
6018 *
6019 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
6020 * mode="c", bint allocate_buffer=True):
6021 *
6022 */
6023
6024 /* function exit code */
6025 __pyx_r = 0;
6026 goto __pyx_L0;
6027 __pyx_L1_error:;
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);
6033 __pyx_r = -1;
6034 __pyx_L0:;
6035 __Pyx_XDECREF(__pyx_v_format);
6036 __Pyx_RefNannyFinishContext();
6037 return __pyx_r;
6038}
6039
6040/* "View.MemoryView":185
6041 *
6042 * @cname('getbuffer')
6043 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
6044 * cdef int bufmode = -1
6045 * if self.mode == u"c":
6046 */
6047
6048/* Python wrapper */
6049static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
6050static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
6051 int __pyx_r;
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));
6055
6056 /* function exit code */
6057 __Pyx_RefNannyFinishContext();
6058 return __pyx_r;
6059}
6060
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;
6063 int __pyx_r;
6064 __Pyx_RefNannyDeclarations
6065 int __pyx_t_1;
6066 int __pyx_t_2;
6067 PyObject *__pyx_t_3 = NULL;
6068 char *__pyx_t_4;
6069 Py_ssize_t __pyx_t_5;
6070 int __pyx_t_6;
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");
6077 return -1;
6078 }
6079 __Pyx_RefNannySetupContext("__getbuffer__", 0);
6080 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
6081 __Pyx_GIVEREF(__pyx_v_info->obj);
6082
6083 /* "View.MemoryView":186
6084 * @cname('getbuffer')
6085 * def __getbuffer__(self, Py_buffer *info, int flags):
6086 * cdef int bufmode = -1 # <<<<<<<<<<<<<<
6087 * if self.mode == u"c":
6088 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6089 */
6090 __pyx_v_bufmode = -1;
6091
6092 /* "View.MemoryView":187
6093 * def __getbuffer__(self, Py_buffer *info, int flags):
6094 * cdef int bufmode = -1
6095 * if self.mode == u"c": # <<<<<<<<<<<<<<
6096 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6097 * elif self.mode == u"fortran":
6098 */
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);
6101 if (__pyx_t_2) {
6102
6103 /* "View.MemoryView":188
6104 * cdef int bufmode = -1
6105 * if self.mode == u"c":
6106 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
6107 * elif self.mode == u"fortran":
6108 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6109 */
6110 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6111
6112 /* "View.MemoryView":187
6113 * def __getbuffer__(self, Py_buffer *info, int flags):
6114 * cdef int bufmode = -1
6115 * if self.mode == u"c": # <<<<<<<<<<<<<<
6116 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6117 * elif self.mode == u"fortran":
6118 */
6119 goto __pyx_L3;
6120 }
6121
6122 /* "View.MemoryView":189
6123 * if self.mode == u"c":
6124 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6125 * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
6126 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6127 * if not (flags & bufmode):
6128 */
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);
6131 if (__pyx_t_1) {
6132
6133 /* "View.MemoryView":190
6134 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6135 * elif self.mode == u"fortran":
6136 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
6137 * if not (flags & bufmode):
6138 * raise ValueError("Can only create a buffer that is contiguous in memory.")
6139 */
6140 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6141
6142 /* "View.MemoryView":189
6143 * if self.mode == u"c":
6144 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6145 * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
6146 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6147 * if not (flags & bufmode):
6148 */
6149 }
6150 __pyx_L3:;
6151
6152 /* "View.MemoryView":191
6153 * elif self.mode == u"fortran":
6154 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6155 * if not (flags & bufmode): # <<<<<<<<<<<<<<
6156 * raise ValueError("Can only create a buffer that is contiguous in memory.")
6157 * info.buf = self.data
6158 */
6159 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
6160 if (unlikely(__pyx_t_1)) {
6161
6162 /* "View.MemoryView":192
6163 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6164 * if not (flags & bufmode):
6165 * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
6166 * info.buf = self.data
6167 * info.len = self.len
6168 */
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)
6174
6175 /* "View.MemoryView":191
6176 * elif self.mode == u"fortran":
6177 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
6178 * if not (flags & bufmode): # <<<<<<<<<<<<<<
6179 * raise ValueError("Can only create a buffer that is contiguous in memory.")
6180 * info.buf = self.data
6181 */
6182 }
6183
6184 /* "View.MemoryView":193
6185 * if not (flags & bufmode):
6186 * raise ValueError("Can only create a buffer that is contiguous in memory.")
6187 * info.buf = self.data # <<<<<<<<<<<<<<
6188 * info.len = self.len
6189 * info.ndim = self.ndim
6190 */
6191 __pyx_t_4 = __pyx_v_self->data;
6192 __pyx_v_info->buf = __pyx_t_4;
6193
6194 /* "View.MemoryView":194
6195 * raise ValueError("Can only create a buffer that is contiguous in memory.")
6196 * info.buf = self.data
6197 * info.len = self.len # <<<<<<<<<<<<<<
6198 * info.ndim = self.ndim
6199 * info.shape = self._shape
6200 */
6201 __pyx_t_5 = __pyx_v_self->len;
6202 __pyx_v_info->len = __pyx_t_5;
6203
6204 /* "View.MemoryView":195
6205 * info.buf = self.data
6206 * info.len = self.len
6207 * info.ndim = self.ndim # <<<<<<<<<<<<<<
6208 * info.shape = self._shape
6209 * info.strides = self._strides
6210 */
6211 __pyx_t_6 = __pyx_v_self->ndim;
6212 __pyx_v_info->ndim = __pyx_t_6;
6213
6214 /* "View.MemoryView":196
6215 * info.len = self.len
6216 * info.ndim = self.ndim
6217 * info.shape = self._shape # <<<<<<<<<<<<<<
6218 * info.strides = self._strides
6219 * info.suboffsets = NULL
6220 */
6221 __pyx_t_7 = __pyx_v_self->_shape;
6222 __pyx_v_info->shape = __pyx_t_7;
6223
6224 /* "View.MemoryView":197
6225 * info.ndim = self.ndim
6226 * info.shape = self._shape
6227 * info.strides = self._strides # <<<<<<<<<<<<<<
6228 * info.suboffsets = NULL
6229 * info.itemsize = self.itemsize
6230 */
6231 __pyx_t_7 = __pyx_v_self->_strides;
6232 __pyx_v_info->strides = __pyx_t_7;
6233
6234 /* "View.MemoryView":198
6235 * info.shape = self._shape
6236 * info.strides = self._strides
6237 * info.suboffsets = NULL # <<<<<<<<<<<<<<
6238 * info.itemsize = self.itemsize
6239 * info.readonly = 0
6240 */
6241 __pyx_v_info->suboffsets = NULL;
6242
6243 /* "View.MemoryView":199
6244 * info.strides = self._strides
6245 * info.suboffsets = NULL
6246 * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
6247 * info.readonly = 0
6248 *
6249 */
6250 __pyx_t_5 = __pyx_v_self->itemsize;
6251 __pyx_v_info->itemsize = __pyx_t_5;
6252
6253 /* "View.MemoryView":200
6254 * info.suboffsets = NULL
6255 * info.itemsize = self.itemsize
6256 * info.readonly = 0 # <<<<<<<<<<<<<<
6257 *
6258 * if flags & PyBUF_FORMAT:
6259 */
6260 __pyx_v_info->readonly = 0;
6261
6262 /* "View.MemoryView":202
6263 * info.readonly = 0
6264 *
6265 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
6266 * info.format = self.format
6267 * else:
6268 */
6269 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
6270 if (__pyx_t_1) {
6271
6272 /* "View.MemoryView":203
6273 *
6274 * if flags & PyBUF_FORMAT:
6275 * info.format = self.format # <<<<<<<<<<<<<<
6276 * else:
6277 * info.format = NULL
6278 */
6279 __pyx_t_4 = __pyx_v_self->format;
6280 __pyx_v_info->format = __pyx_t_4;
6281
6282 /* "View.MemoryView":202
6283 * info.readonly = 0
6284 *
6285 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
6286 * info.format = self.format
6287 * else:
6288 */
6289 goto __pyx_L5;
6290 }
6291
6292 /* "View.MemoryView":205
6293 * info.format = self.format
6294 * else:
6295 * info.format = NULL # <<<<<<<<<<<<<<
6296 *
6297 * info.obj = self
6298 */
6299 /*else*/ {
6300 __pyx_v_info->format = NULL;
6301 }
6302 __pyx_L5:;
6303
6304 /* "View.MemoryView":207
6305 * info.format = NULL
6306 *
6307 * info.obj = self # <<<<<<<<<<<<<<
6308 *
6309 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
6310 */
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);
6316
6317 /* "View.MemoryView":185
6318 *
6319 * @cname('getbuffer')
6320 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
6321 * cdef int bufmode = -1
6322 * if self.mode == u"c":
6323 */
6324
6325 /* function exit code */
6326 __pyx_r = 0;
6327 goto __pyx_L0;
6328 __pyx_L1_error:;
6329 __Pyx_XDECREF(__pyx_t_3);
6330 __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6331 __pyx_r = -1;
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;
6335 }
6336 goto __pyx_L2;
6337 __pyx_L0:;
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;
6341 }
6342 __pyx_L2:;
6343 __Pyx_RefNannyFinishContext();
6344 return __pyx_r;
6345}
6346
6347/* "View.MemoryView":211
6348 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
6349 *
6350 * def __dealloc__(array self): # <<<<<<<<<<<<<<
6351 * if self.callback_free_data != NULL:
6352 * self.callback_free_data(self.data)
6353 */
6354
6355/* Python wrapper */
6356static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
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));
6361
6362 /* function exit code */
6363 __Pyx_RefNannyFinishContext();
6364}
6365
6366static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
6367 __Pyx_RefNannyDeclarations
6368 int __pyx_t_1;
6369 __Pyx_RefNannySetupContext("__dealloc__", 0);
6370
6371 /* "View.MemoryView":212
6372 *
6373 * def __dealloc__(array self):
6374 * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
6375 * self.callback_free_data(self.data)
6376 * elif self.free_data:
6377 */
6378 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
6379 if (__pyx_t_1) {
6380
6381 /* "View.MemoryView":213
6382 * def __dealloc__(array self):
6383 * if self.callback_free_data != NULL:
6384 * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
6385 * elif self.free_data:
6386 * if self.dtype_is_object:
6387 */
6388 __pyx_v_self->callback_free_data(__pyx_v_self->data);
6389
6390 /* "View.MemoryView":212
6391 *
6392 * def __dealloc__(array self):
6393 * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
6394 * self.callback_free_data(self.data)
6395 * elif self.free_data:
6396 */
6397 goto __pyx_L3;
6398 }
6399
6400 /* "View.MemoryView":214
6401 * if self.callback_free_data != NULL:
6402 * self.callback_free_data(self.data)
6403 * elif self.free_data: # <<<<<<<<<<<<<<
6404 * if self.dtype_is_object:
6405 * refcount_objects_in_slice(self.data, self._shape,
6406 */
6407 __pyx_t_1 = (__pyx_v_self->free_data != 0);
6408 if (__pyx_t_1) {
6409
6410 /* "View.MemoryView":215
6411 * self.callback_free_data(self.data)
6412 * elif self.free_data:
6413 * if self.dtype_is_object: # <<<<<<<<<<<<<<
6414 * refcount_objects_in_slice(self.data, self._shape,
6415 * self._strides, self.ndim, False)
6416 */
6417 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
6418 if (__pyx_t_1) {
6419
6420 /* "View.MemoryView":216
6421 * elif self.free_data:
6422 * if self.dtype_is_object:
6423 * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<<
6424 * self._strides, self.ndim, False)
6425 * free(self.data)
6426 */
6427 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
6428
6429 /* "View.MemoryView":215
6430 * self.callback_free_data(self.data)
6431 * elif self.free_data:
6432 * if self.dtype_is_object: # <<<<<<<<<<<<<<
6433 * refcount_objects_in_slice(self.data, self._shape,
6434 * self._strides, self.ndim, False)
6435 */
6436 }
6437
6438 /* "View.MemoryView":218
6439 * refcount_objects_in_slice(self.data, self._shape,
6440 * self._strides, self.ndim, False)
6441 * free(self.data) # <<<<<<<<<<<<<<
6442 * PyObject_Free(self._shape)
6443 *
6444 */
6445 free(__pyx_v_self->data);
6446
6447 /* "View.MemoryView":214
6448 * if self.callback_free_data != NULL:
6449 * self.callback_free_data(self.data)
6450 * elif self.free_data: # <<<<<<<<<<<<<<
6451 * if self.dtype_is_object:
6452 * refcount_objects_in_slice(self.data, self._shape,
6453 */
6454 }
6455 __pyx_L3:;
6456
6457 /* "View.MemoryView":219
6458 * self._strides, self.ndim, False)
6459 * free(self.data)
6460 * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
6461 *
6462 * @property
6463 */
6464 PyObject_Free(__pyx_v_self->_shape);
6465
6466 /* "View.MemoryView":211
6467 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
6468 *
6469 * def __dealloc__(array self): # <<<<<<<<<<<<<<
6470 * if self.callback_free_data != NULL:
6471 * self.callback_free_data(self.data)
6472 */
6473
6474 /* function exit code */
6475 __Pyx_RefNannyFinishContext();
6476}
6477
6478/* "View.MemoryView":222
6479 *
6480 * @property
6481 * def memview(self): # <<<<<<<<<<<<<<
6482 * return self.get_memview()
6483 *
6484 */
6485
6486/* Python wrapper */
6487static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
6493
6494 /* function exit code */
6495 __Pyx_RefNannyFinishContext();
6496 return __pyx_r;
6497}
6498
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);
6507
6508 /* "View.MemoryView":223
6509 * @property
6510 * def memview(self):
6511 * return self.get_memview() # <<<<<<<<<<<<<<
6512 *
6513 * @cname('get_memview')
6514 */
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;
6519 __pyx_t_1 = 0;
6520 goto __pyx_L0;
6521
6522 /* "View.MemoryView":222
6523 *
6524 * @property
6525 * def memview(self): # <<<<<<<<<<<<<<
6526 * return self.get_memview()
6527 *
6528 */
6529
6530 /* function exit code */
6531 __pyx_L1_error:;
6532 __Pyx_XDECREF(__pyx_t_1);
6533 __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6534 __pyx_r = NULL;
6535 __pyx_L0:;
6536 __Pyx_XGIVEREF(__pyx_r);
6537 __Pyx_RefNannyFinishContext();
6538 return __pyx_r;
6539}
6540
6541/* "View.MemoryView":226
6542 *
6543 * @cname('get_memview')
6544 * cdef get_memview(self): # <<<<<<<<<<<<<<
6545 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
6546 * return memoryview(self, flags, self.dtype_is_object)
6547 */
6548
6549static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
6550 int __pyx_v_flags;
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);
6560
6561 /* "View.MemoryView":227
6562 * @cname('get_memview')
6563 * cdef get_memview(self):
6564 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
6565 * return memoryview(self, flags, self.dtype_is_object)
6566 *
6567 */
6568 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
6569
6570 /* "View.MemoryView":228
6571 * cdef get_memview(self):
6572 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
6573 * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
6574 *
6575 * def __len__(self):
6576 */
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);
6591 __pyx_t_1 = 0;
6592 __pyx_t_2 = 0;
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;
6597 __pyx_t_2 = 0;
6598 goto __pyx_L0;
6599
6600 /* "View.MemoryView":226
6601 *
6602 * @cname('get_memview')
6603 * cdef get_memview(self): # <<<<<<<<<<<<<<
6604 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
6605 * return memoryview(self, flags, self.dtype_is_object)
6606 */
6607
6608 /* function exit code */
6609 __pyx_L1_error:;
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);
6614 __pyx_r = 0;
6615 __pyx_L0:;
6616 __Pyx_XGIVEREF(__pyx_r);
6617 __Pyx_RefNannyFinishContext();
6618 return __pyx_r;
6619}
6620
6621/* "View.MemoryView":230
6622 * return memoryview(self, flags, self.dtype_is_object)
6623 *
6624 * def __len__(self): # <<<<<<<<<<<<<<
6625 * return self._shape[0]
6626 *
6627 */
6628
6629/* Python wrapper */
6630static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
6631static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
6632 Py_ssize_t __pyx_r;
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));
6636
6637 /* function exit code */
6638 __Pyx_RefNannyFinishContext();
6639 return __pyx_r;
6640}
6641
6642static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
6643 Py_ssize_t __pyx_r;
6644 __Pyx_RefNannyDeclarations
6645 __Pyx_RefNannySetupContext("__len__", 0);
6646
6647 /* "View.MemoryView":231
6648 *
6649 * def __len__(self):
6650 * return self._shape[0] # <<<<<<<<<<<<<<
6651 *
6652 * def __getattr__(self, attr):
6653 */
6654 __pyx_r = (__pyx_v_self->_shape[0]);
6655 goto __pyx_L0;
6656
6657 /* "View.MemoryView":230
6658 * return memoryview(self, flags, self.dtype_is_object)
6659 *
6660 * def __len__(self): # <<<<<<<<<<<<<<
6661 * return self._shape[0]
6662 *
6663 */
6664
6665 /* function exit code */
6666 __pyx_L0:;
6667 __Pyx_RefNannyFinishContext();
6668 return __pyx_r;
6669}
6670
6671/* "View.MemoryView":233
6672 * return self._shape[0]
6673 *
6674 * def __getattr__(self, attr): # <<<<<<<<<<<<<<
6675 * return getattr(self.memview, attr)
6676 *
6677 */
6678
6679/* Python wrapper */
6680static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
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));
6686
6687 /* function exit code */
6688 __Pyx_RefNannyFinishContext();
6689 return __pyx_r;
6690}
6691
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);
6701
6702 /* "View.MemoryView":234
6703 *
6704 * def __getattr__(self, attr):
6705 * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
6706 *
6707 * def __getitem__(self, item):
6708 */
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;
6716 __pyx_t_2 = 0;
6717 goto __pyx_L0;
6718
6719 /* "View.MemoryView":233
6720 * return self._shape[0]
6721 *
6722 * def __getattr__(self, attr): # <<<<<<<<<<<<<<
6723 * return getattr(self.memview, attr)
6724 *
6725 */
6726
6727 /* function exit code */
6728 __pyx_L1_error:;
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);
6732 __pyx_r = NULL;
6733 __pyx_L0:;
6734 __Pyx_XGIVEREF(__pyx_r);
6735 __Pyx_RefNannyFinishContext();
6736 return __pyx_r;
6737}
6738
6739/* "View.MemoryView":236
6740 * return getattr(self.memview, attr)
6741 *
6742 * def __getitem__(self, item): # <<<<<<<<<<<<<<
6743 * return self.memview[item]
6744 *
6745 */
6746
6747/* Python wrapper */
6748static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
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));
6754
6755 /* function exit code */
6756 __Pyx_RefNannyFinishContext();
6757 return __pyx_r;
6758}
6759
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);
6769
6770 /* "View.MemoryView":237
6771 *
6772 * def __getitem__(self, item):
6773 * return self.memview[item] # <<<<<<<<<<<<<<
6774 *
6775 * def __setitem__(self, item, value):
6776 */
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;
6784 __pyx_t_2 = 0;
6785 goto __pyx_L0;
6786
6787 /* "View.MemoryView":236
6788 * return getattr(self.memview, attr)
6789 *
6790 * def __getitem__(self, item): # <<<<<<<<<<<<<<
6791 * return self.memview[item]
6792 *
6793 */
6794
6795 /* function exit code */
6796 __pyx_L1_error:;
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);
6800 __pyx_r = NULL;
6801 __pyx_L0:;
6802 __Pyx_XGIVEREF(__pyx_r);
6803 __Pyx_RefNannyFinishContext();
6804 return __pyx_r;
6805}
6806
6807/* "View.MemoryView":239
6808 * return self.memview[item]
6809 *
6810 * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
6811 * self.memview[item] = value
6812 *
6813 */
6814
6815/* Python wrapper */
6816static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
6817static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
6818 int __pyx_r;
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));
6822
6823 /* function exit code */
6824 __Pyx_RefNannyFinishContext();
6825 return __pyx_r;
6826}
6827
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) {
6829 int __pyx_r;
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);
6836
6837 /* "View.MemoryView":240
6838 *
6839 * def __setitem__(self, item, value):
6840 * self.memview[item] = value # <<<<<<<<<<<<<<
6841 *
6842 *
6843 */
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;
6848
6849 /* "View.MemoryView":239
6850 * return self.memview[item]
6851 *
6852 * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
6853 * self.memview[item] = value
6854 *
6855 */
6856
6857 /* function exit code */
6858 __pyx_r = 0;
6859 goto __pyx_L0;
6860 __pyx_L1_error:;
6861 __Pyx_XDECREF(__pyx_t_1);
6862 __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6863 __pyx_r = -1;
6864 __pyx_L0:;
6865 __Pyx_RefNannyFinishContext();
6866 return __pyx_r;
6867}
6868
6869/* "(tree fragment)":1
6870 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
6871 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6872 * def __setstate_cython__(self, __pyx_state):
6873 */
6874
6875/* Python wrapper */
6876static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
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));
6882
6883 /* function exit code */
6884 __Pyx_RefNannyFinishContext();
6885 return __pyx_r;
6886}
6887
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);
6896
6897 /* "(tree fragment)":2
6898 * def __reduce_cython__(self):
6899 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
6900 * def __setstate_cython__(self, __pyx_state):
6901 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6902 */
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)
6908
6909 /* "(tree fragment)":1
6910 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
6911 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6912 * def __setstate_cython__(self, __pyx_state):
6913 */
6914
6915 /* function exit code */
6916 __pyx_L1_error:;
6917 __Pyx_XDECREF(__pyx_t_1);
6918 __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6919 __pyx_r = NULL;
6920 __Pyx_XGIVEREF(__pyx_r);
6921 __Pyx_RefNannyFinishContext();
6922 return __pyx_r;
6923}
6924
6925/* "(tree fragment)":3
6926 * def __reduce_cython__(self):
6927 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6928 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
6929 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6930 */
6931
6932/* Python wrapper */
6933static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
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));
6939
6940 /* function exit code */
6941 __Pyx_RefNannyFinishContext();
6942 return __pyx_r;
6943}
6944
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);
6953
6954 /* "(tree fragment)":4
6955 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6956 * def __setstate_cython__(self, __pyx_state):
6957 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
6958 */
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)
6964
6965 /* "(tree fragment)":3
6966 * def __reduce_cython__(self):
6967 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6968 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
6969 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
6970 */
6971
6972 /* function exit code */
6973 __pyx_L1_error:;
6974 __Pyx_XDECREF(__pyx_t_1);
6975 __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6976 __pyx_r = NULL;
6977 __Pyx_XGIVEREF(__pyx_r);
6978 __Pyx_RefNannyFinishContext();
6979 return __pyx_r;
6980}
6981
6982/* "View.MemoryView":244
6983 *
6984 * @cname("__pyx_array_new")
6985 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
6986 * char *mode, char *buf):
6987 * cdef array result
6988 */
6989
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
6994 int __pyx_t_1;
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);
7003
7004 /* "View.MemoryView":248
7005 * cdef array result
7006 *
7007 * if buf == NULL: # <<<<<<<<<<<<<<
7008 * result = array(shape, itemsize, format, mode.decode('ASCII'))
7009 * else:
7010 */
7011 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
7012 if (__pyx_t_1) {
7013
7014 /* "View.MemoryView":249
7015 *
7016 * if buf == NULL:
7017 * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<<
7018 * else:
7019 * result = array(shape, itemsize, format, mode.decode('ASCII'),
7020 */
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);
7038 __pyx_t_2 = 0;
7039 __pyx_t_3 = 0;
7040 __pyx_t_4 = 0;
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);
7045 __pyx_t_4 = 0;
7046
7047 /* "View.MemoryView":248
7048 * cdef array result
7049 *
7050 * if buf == NULL: # <<<<<<<<<<<<<<
7051 * result = array(shape, itemsize, format, mode.decode('ASCII'))
7052 * else:
7053 */
7054 goto __pyx_L3;
7055 }
7056
7057 /* "View.MemoryView":251
7058 * result = array(shape, itemsize, format, mode.decode('ASCII'))
7059 * else:
7060 * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
7061 * allocate_buffer=False)
7062 * result.data = buf
7063 */
7064 /*else*/ {
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);
7082 __pyx_t_4 = 0;
7083 __pyx_t_5 = 0;
7084 __pyx_t_3 = 0;
7085
7086 /* "View.MemoryView":252
7087 * else:
7088 * result = array(shape, itemsize, format, mode.decode('ASCII'),
7089 * allocate_buffer=False) # <<<<<<<<<<<<<<
7090 * result.data = buf
7091 *
7092 */
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)
7096
7097 /* "View.MemoryView":251
7098 * result = array(shape, itemsize, format, mode.decode('ASCII'))
7099 * else:
7100 * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
7101 * allocate_buffer=False)
7102 * result.data = buf
7103 */
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);
7109 __pyx_t_5 = 0;
7110
7111 /* "View.MemoryView":253
7112 * result = array(shape, itemsize, format, mode.decode('ASCII'),
7113 * allocate_buffer=False)
7114 * result.data = buf # <<<<<<<<<<<<<<
7115 *
7116 * return result
7117 */
7118 __pyx_v_result->data = __pyx_v_buf;
7119 }
7120 __pyx_L3:;
7121
7122 /* "View.MemoryView":255
7123 * result.data = buf
7124 *
7125 * return result # <<<<<<<<<<<<<<
7126 *
7127 *
7128 */
7129 __Pyx_XDECREF(((PyObject *)__pyx_r));
7130 __Pyx_INCREF(((PyObject *)__pyx_v_result));
7131 __pyx_r = __pyx_v_result;
7132 goto __pyx_L0;
7133
7134 /* "View.MemoryView":244
7135 *
7136 * @cname("__pyx_array_new")
7137 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
7138 * char *mode, char *buf):
7139 * cdef array result
7140 */
7141
7142 /* function exit code */
7143 __pyx_L1_error:;
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);
7149 __pyx_r = 0;
7150 __pyx_L0:;
7151 __Pyx_XDECREF((PyObject *)__pyx_v_result);
7152 __Pyx_XGIVEREF((PyObject *)__pyx_r);
7153 __Pyx_RefNannyFinishContext();
7154 return __pyx_r;
7155}
7156
7157/* "View.MemoryView":281
7158 * cdef class Enum(object):
7159 * cdef object name
7160 * def __init__(self, name): # <<<<<<<<<<<<<<
7161 * self.name = name
7162 * def __repr__(self):
7163 */
7164
7165/* Python wrapper */
7166static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
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;
7172 int __pyx_r;
7173 __Pyx_RefNannyDeclarations
7174 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
7175 {
7176 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
7177 PyObject* values[1] = {0};
7178 if (unlikely(__pyx_kwds)) {
7179 Py_ssize_t kw_args;
7180 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7181 switch (pos_args) {
7182 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7183 CYTHON_FALLTHROUGH;
7184 case 0: break;
7185 default: goto __pyx_L5_argtuple_error;
7186 }
7187 kw_args = PyDict_Size(__pyx_kwds);
7188 switch (pos_args) {
7189 case 0:
7190 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
7191 else goto __pyx_L5_argtuple_error;
7192 }
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)
7195 }
7196 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
7197 goto __pyx_L5_argtuple_error;
7198 } else {
7199 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7200 }
7201 __pyx_v_name = values[0];
7202 }
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)
7206 __pyx_L3_error:;
7207 __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7208 __Pyx_RefNannyFinishContext();
7209 return -1;
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);
7212
7213 /* function exit code */
7214 __Pyx_RefNannyFinishContext();
7215 return __pyx_r;
7216}
7217
7218static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
7219 int __pyx_r;
7220 __Pyx_RefNannyDeclarations
7221 __Pyx_RefNannySetupContext("__init__", 0);
7222
7223 /* "View.MemoryView":282
7224 * cdef object name
7225 * def __init__(self, name):
7226 * self.name = name # <<<<<<<<<<<<<<
7227 * def __repr__(self):
7228 * return self.name
7229 */
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;
7235
7236 /* "View.MemoryView":281
7237 * cdef class Enum(object):
7238 * cdef object name
7239 * def __init__(self, name): # <<<<<<<<<<<<<<
7240 * self.name = name
7241 * def __repr__(self):
7242 */
7243
7244 /* function exit code */
7245 __pyx_r = 0;
7246 __Pyx_RefNannyFinishContext();
7247 return __pyx_r;
7248}
7249
7250/* "View.MemoryView":283
7251 * def __init__(self, name):
7252 * self.name = name
7253 * def __repr__(self): # <<<<<<<<<<<<<<
7254 * return self.name
7255 *
7256 */
7257
7258/* Python wrapper */
7259static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
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));
7265
7266 /* function exit code */
7267 __Pyx_RefNannyFinishContext();
7268 return __pyx_r;
7269}
7270
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);
7275
7276 /* "View.MemoryView":284
7277 * self.name = name
7278 * def __repr__(self):
7279 * return self.name # <<<<<<<<<<<<<<
7280 *
7281 * cdef generic = Enum("<strided and direct or indirect>")
7282 */
7283 __Pyx_XDECREF(__pyx_r);
7284 __Pyx_INCREF(__pyx_v_self->name);
7285 __pyx_r = __pyx_v_self->name;
7286 goto __pyx_L0;
7287
7288 /* "View.MemoryView":283
7289 * def __init__(self, name):
7290 * self.name = name
7291 * def __repr__(self): # <<<<<<<<<<<<<<
7292 * return self.name
7293 *
7294 */
7295
7296 /* function exit code */
7297 __pyx_L0:;
7298 __Pyx_XGIVEREF(__pyx_r);
7299 __Pyx_RefNannyFinishContext();
7300 return __pyx_r;
7301}
7302
7303/* "(tree fragment)":1
7304 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
7305 * cdef tuple state
7306 * cdef object _dict
7307 */
7308
7309/* Python wrapper */
7310static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
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));
7316
7317 /* function exit code */
7318 __Pyx_RefNannyFinishContext();
7319 return __pyx_r;
7320}
7321
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;
7329 int __pyx_t_2;
7330 int __pyx_t_3;
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);
7337
7338 /* "(tree fragment)":5
7339 * cdef object _dict
7340 * cdef bint use_setstate
7341 * state = (self.name,) # <<<<<<<<<<<<<<
7342 * _dict = getattr(self, '__dict__', None)
7343 * if _dict is not None:
7344 */
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);
7351 __pyx_t_1 = 0;
7352
7353 /* "(tree fragment)":6
7354 * cdef bint use_setstate
7355 * state = (self.name,)
7356 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
7357 * if _dict is not None:
7358 * state += (_dict,)
7359 */
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;
7363 __pyx_t_1 = 0;
7364
7365 /* "(tree fragment)":7
7366 * state = (self.name,)
7367 * _dict = getattr(self, '__dict__', None)
7368 * if _dict is not None: # <<<<<<<<<<<<<<
7369 * state += (_dict,)
7370 * use_setstate = True
7371 */
7372 __pyx_t_2 = (__pyx_v__dict != Py_None);
7373 __pyx_t_3 = (__pyx_t_2 != 0);
7374 if (__pyx_t_3) {
7375
7376 /* "(tree fragment)":8
7377 * _dict = getattr(self, '__dict__', None)
7378 * if _dict is not None:
7379 * state += (_dict,) # <<<<<<<<<<<<<<
7380 * use_setstate = True
7381 * else:
7382 */
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));
7392 __pyx_t_4 = 0;
7393
7394 /* "(tree fragment)":9
7395 * if _dict is not None:
7396 * state += (_dict,)
7397 * use_setstate = True # <<<<<<<<<<<<<<
7398 * else:
7399 * use_setstate = self.name is not None
7400 */
7401 __pyx_v_use_setstate = 1;
7402
7403 /* "(tree fragment)":7
7404 * state = (self.name,)
7405 * _dict = getattr(self, '__dict__', None)
7406 * if _dict is not None: # <<<<<<<<<<<<<<
7407 * state += (_dict,)
7408 * use_setstate = True
7409 */
7410 goto __pyx_L3;
7411 }
7412
7413 /* "(tree fragment)":11
7414 * use_setstate = True
7415 * else:
7416 * use_setstate = self.name is not None # <<<<<<<<<<<<<<
7417 * if use_setstate:
7418 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
7419 */
7420 /*else*/ {
7421 __pyx_t_3 = (__pyx_v_self->name != Py_None);
7422 __pyx_v_use_setstate = __pyx_t_3;
7423 }
7424 __pyx_L3:;
7425
7426 /* "(tree fragment)":12
7427 * else:
7428 * use_setstate = self.name is not None
7429 * if use_setstate: # <<<<<<<<<<<<<<
7430 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
7431 * else:
7432 */
7433 __pyx_t_3 = (__pyx_v_use_setstate != 0);
7434 if (__pyx_t_3) {
7435
7436 /* "(tree fragment)":13
7437 * use_setstate = self.name is not None
7438 * if use_setstate:
7439 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<<
7440 * else:
7441 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
7442 */
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);
7466 __pyx_t_4 = 0;
7467 __pyx_t_1 = 0;
7468 __pyx_r = __pyx_t_5;
7469 __pyx_t_5 = 0;
7470 goto __pyx_L0;
7471
7472 /* "(tree fragment)":12
7473 * else:
7474 * use_setstate = self.name is not None
7475 * if use_setstate: # <<<<<<<<<<<<<<
7476 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
7477 * else:
7478 */
7479 }
7480
7481 /* "(tree fragment)":15
7482 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
7483 * else:
7484 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<<
7485 * def __setstate_cython__(self, __pyx_state):
7486 * __pyx_unpickle_Enum__set_state(self, __pyx_state)
7487 */
7488 /*else*/ {
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);
7509 __pyx_t_5 = 0;
7510 __pyx_t_1 = 0;
7511 __pyx_r = __pyx_t_4;
7512 __pyx_t_4 = 0;
7513 goto __pyx_L0;
7514 }
7515
7516 /* "(tree fragment)":1
7517 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
7518 * cdef tuple state
7519 * cdef object _dict
7520 */
7521
7522 /* function exit code */
7523 __pyx_L1_error:;
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);
7528 __pyx_r = NULL;
7529 __pyx_L0:;
7530 __Pyx_XDECREF(__pyx_v_state);
7531 __Pyx_XDECREF(__pyx_v__dict);
7532 __Pyx_XGIVEREF(__pyx_r);
7533 __Pyx_RefNannyFinishContext();
7534 return __pyx_r;
7535}
7536
7537/* "(tree fragment)":16
7538 * else:
7539 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
7540 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
7541 * __pyx_unpickle_Enum__set_state(self, __pyx_state)
7542 */
7543
7544/* Python wrapper */
7545static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
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));
7551
7552 /* function exit code */
7553 __Pyx_RefNannyFinishContext();
7554 return __pyx_r;
7555}
7556
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);
7565
7566 /* "(tree fragment)":17
7567 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
7568 * def __setstate_cython__(self, __pyx_state):
7569 * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
7570 */
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;
7575
7576 /* "(tree fragment)":16
7577 * else:
7578 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
7579 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
7580 * __pyx_unpickle_Enum__set_state(self, __pyx_state)
7581 */
7582
7583 /* function exit code */
7584 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7585 goto __pyx_L0;
7586 __pyx_L1_error:;
7587 __Pyx_XDECREF(__pyx_t_1);
7588 __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7589 __pyx_r = NULL;
7590 __pyx_L0:;
7591 __Pyx_XGIVEREF(__pyx_r);
7592 __Pyx_RefNannyFinishContext();
7593 return __pyx_r;
7594}
7595
7596/* "View.MemoryView":298
7597 *
7598 * @cname('__pyx_align_pointer')
7599 * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
7600 * "Align pointer memory on a given boundary"
7601 * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
7602 */
7603
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;
7607 void *__pyx_r;
7608 int __pyx_t_1;
7609
7610 /* "View.MemoryView":300
7611 * cdef void *align_pointer(void *memory, size_t alignment) nogil:
7612 * "Align pointer memory on a given boundary"
7613 * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory # <<<<<<<<<<<<<<
7614 * cdef size_t offset
7615 *
7616 */
7617 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
7618
7619 /* "View.MemoryView":304
7620 *
7621 * with cython.cdivision(True):
7622 * offset = aligned_p % alignment # <<<<<<<<<<<<<<
7623 *
7624 * if offset > 0:
7625 */
7626 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
7627
7628 /* "View.MemoryView":306
7629 * offset = aligned_p % alignment
7630 *
7631 * if offset > 0: # <<<<<<<<<<<<<<
7632 * aligned_p += alignment - offset
7633 *
7634 */
7635 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
7636 if (__pyx_t_1) {
7637
7638 /* "View.MemoryView":307
7639 *
7640 * if offset > 0:
7641 * aligned_p += alignment - offset # <<<<<<<<<<<<<<
7642 *
7643 * return <void *> aligned_p
7644 */
7645 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
7646
7647 /* "View.MemoryView":306
7648 * offset = aligned_p % alignment
7649 *
7650 * if offset > 0: # <<<<<<<<<<<<<<
7651 * aligned_p += alignment - offset
7652 *
7653 */
7654 }
7655
7656 /* "View.MemoryView":309
7657 * aligned_p += alignment - offset
7658 *
7659 * return <void *> aligned_p # <<<<<<<<<<<<<<
7660 *
7661 *
7662 */
7663 __pyx_r = ((void *)__pyx_v_aligned_p);
7664 goto __pyx_L0;
7665
7666 /* "View.MemoryView":298
7667 *
7668 * @cname('__pyx_align_pointer')
7669 * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
7670 * "Align pointer memory on a given boundary"
7671 * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
7672 */
7673
7674 /* function exit code */
7675 __pyx_L0:;
7676 return __pyx_r;
7677}
7678
7679/* "View.MemoryView":345
7680 * cdef __Pyx_TypeInfo *typeinfo
7681 *
7682 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
7683 * self.obj = obj
7684 * self.flags = flags
7685 */
7686
7687/* Python wrapper */
7688static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7689static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7690 PyObject *__pyx_v_obj = 0;
7691 int __pyx_v_flags;
7692 int __pyx_v_dtype_is_object;
7693 int __pyx_lineno = 0;
7694 const char *__pyx_filename = NULL;
7695 int __pyx_clineno = 0;
7696 int __pyx_r;
7697 __Pyx_RefNannyDeclarations
7698 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
7699 {
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)) {
7703 Py_ssize_t kw_args;
7704 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7705 switch (pos_args) {
7706 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7707 CYTHON_FALLTHROUGH;
7708 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7709 CYTHON_FALLTHROUGH;
7710 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7711 CYTHON_FALLTHROUGH;
7712 case 0: break;
7713 default: goto __pyx_L5_argtuple_error;
7714 }
7715 kw_args = PyDict_Size(__pyx_kwds);
7716 switch (pos_args) {
7717 case 0:
7718 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
7719 else goto __pyx_L5_argtuple_error;
7720 CYTHON_FALLTHROUGH;
7721 case 1:
7722 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
7723 else {
7724 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
7725 }
7726 CYTHON_FALLTHROUGH;
7727 case 2:
7728 if (kw_args > 0) {
7729 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
7730 if (value) { values[2] = value; kw_args--; }
7731 }
7732 }
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)
7735 }
7736 } else {
7737 switch (PyTuple_GET_SIZE(__pyx_args)) {
7738 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7739 CYTHON_FALLTHROUGH;
7740 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7741 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7742 break;
7743 default: goto __pyx_L5_argtuple_error;
7744 }
7745 }
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)
7748 if (values[2]) {
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)
7750 } else {
7751 __pyx_v_dtype_is_object = ((int)0);
7752 }
7753 }
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)
7757 __pyx_L3_error:;
7758 __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7759 __Pyx_RefNannyFinishContext();
7760 return -1;
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);
7763
7764 /* function exit code */
7765 __Pyx_RefNannyFinishContext();
7766 return __pyx_r;
7767}
7768
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) {
7770 int __pyx_r;
7771 __Pyx_RefNannyDeclarations
7772 int __pyx_t_1;
7773 int __pyx_t_2;
7774 int __pyx_t_3;
7775 int __pyx_t_4;
7776 int __pyx_lineno = 0;
7777 const char *__pyx_filename = NULL;
7778 int __pyx_clineno = 0;
7779 __Pyx_RefNannySetupContext("__cinit__", 0);
7780
7781 /* "View.MemoryView":346
7782 *
7783 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
7784 * self.obj = obj # <<<<<<<<<<<<<<
7785 * self.flags = flags
7786 * if type(self) is memoryview or obj is not None:
7787 */
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;
7793
7794 /* "View.MemoryView":347
7795 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
7796 * self.obj = obj
7797 * self.flags = flags # <<<<<<<<<<<<<<
7798 * if type(self) is memoryview or obj is not None:
7799 * __Pyx_GetBuffer(obj, &self.view, flags)
7800 */
7801 __pyx_v_self->flags = __pyx_v_flags;
7802
7803 /* "View.MemoryView":348
7804 * self.obj = obj
7805 * self.flags = flags
7806 * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
7807 * __Pyx_GetBuffer(obj, &self.view, flags)
7808 * if <PyObject *> self.view.obj == NULL:
7809 */
7810 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
7811 __pyx_t_3 = (__pyx_t_2 != 0);
7812 if (!__pyx_t_3) {
7813 } else {
7814 __pyx_t_1 = __pyx_t_3;
7815 goto __pyx_L4_bool_binop_done;
7816 }
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:;
7821 if (__pyx_t_1) {
7822
7823 /* "View.MemoryView":349
7824 * self.flags = flags
7825 * if type(self) is memoryview or obj is not None:
7826 * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
7827 * if <PyObject *> self.view.obj == NULL:
7828 * (<__pyx_buffer *> &self.view).obj = Py_None
7829 */
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)
7831
7832 /* "View.MemoryView":350
7833 * if type(self) is memoryview or obj is not None:
7834 * __Pyx_GetBuffer(obj, &self.view, flags)
7835 * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
7836 * (<__pyx_buffer *> &self.view).obj = Py_None
7837 * Py_INCREF(Py_None)
7838 */
7839 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
7840 if (__pyx_t_1) {
7841
7842 /* "View.MemoryView":351
7843 * __Pyx_GetBuffer(obj, &self.view, flags)
7844 * if <PyObject *> self.view.obj == NULL:
7845 * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
7846 * Py_INCREF(Py_None)
7847 *
7848 */
7849 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
7850
7851 /* "View.MemoryView":352
7852 * if <PyObject *> self.view.obj == NULL:
7853 * (<__pyx_buffer *> &self.view).obj = Py_None
7854 * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
7855 *
7856 * global __pyx_memoryview_thread_locks_used
7857 */
7858 Py_INCREF(Py_None);
7859
7860 /* "View.MemoryView":350
7861 * if type(self) is memoryview or obj is not None:
7862 * __Pyx_GetBuffer(obj, &self.view, flags)
7863 * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
7864 * (<__pyx_buffer *> &self.view).obj = Py_None
7865 * Py_INCREF(Py_None)
7866 */
7867 }
7868
7869 /* "View.MemoryView":348
7870 * self.obj = obj
7871 * self.flags = flags
7872 * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
7873 * __Pyx_GetBuffer(obj, &self.view, flags)
7874 * if <PyObject *> self.view.obj == NULL:
7875 */
7876 }
7877
7878 /* "View.MemoryView":355
7879 *
7880 * global __pyx_memoryview_thread_locks_used
7881 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
7882 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7883 * __pyx_memoryview_thread_locks_used += 1
7884 */
7885 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
7886 if (__pyx_t_1) {
7887
7888 /* "View.MemoryView":356
7889 * global __pyx_memoryview_thread_locks_used
7890 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
7891 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
7892 * __pyx_memoryview_thread_locks_used += 1
7893 * if self.lock is NULL:
7894 */
7895 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
7896
7897 /* "View.MemoryView":357
7898 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
7899 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7900 * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
7901 * if self.lock is NULL:
7902 * self.lock = PyThread_allocate_lock()
7903 */
7904 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
7905
7906 /* "View.MemoryView":355
7907 *
7908 * global __pyx_memoryview_thread_locks_used
7909 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
7910 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7911 * __pyx_memoryview_thread_locks_used += 1
7912 */
7913 }
7914
7915 /* "View.MemoryView":358
7916 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7917 * __pyx_memoryview_thread_locks_used += 1
7918 * if self.lock is NULL: # <<<<<<<<<<<<<<
7919 * self.lock = PyThread_allocate_lock()
7920 * if self.lock is NULL:
7921 */
7922 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
7923 if (__pyx_t_1) {
7924
7925 /* "View.MemoryView":359
7926 * __pyx_memoryview_thread_locks_used += 1
7927 * if self.lock is NULL:
7928 * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
7929 * if self.lock is NULL:
7930 * raise MemoryError
7931 */
7932 __pyx_v_self->lock = PyThread_allocate_lock();
7933
7934 /* "View.MemoryView":360
7935 * if self.lock is NULL:
7936 * self.lock = PyThread_allocate_lock()
7937 * if self.lock is NULL: # <<<<<<<<<<<<<<
7938 * raise MemoryError
7939 *
7940 */
7941 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
7942 if (unlikely(__pyx_t_1)) {
7943
7944 /* "View.MemoryView":361
7945 * self.lock = PyThread_allocate_lock()
7946 * if self.lock is NULL:
7947 * raise MemoryError # <<<<<<<<<<<<<<
7948 *
7949 * if flags & PyBUF_FORMAT:
7950 */
7951 PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
7952
7953 /* "View.MemoryView":360
7954 * if self.lock is NULL:
7955 * self.lock = PyThread_allocate_lock()
7956 * if self.lock is NULL: # <<<<<<<<<<<<<<
7957 * raise MemoryError
7958 *
7959 */
7960 }
7961
7962 /* "View.MemoryView":358
7963 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
7964 * __pyx_memoryview_thread_locks_used += 1
7965 * if self.lock is NULL: # <<<<<<<<<<<<<<
7966 * self.lock = PyThread_allocate_lock()
7967 * if self.lock is NULL:
7968 */
7969 }
7970
7971 /* "View.MemoryView":363
7972 * raise MemoryError
7973 *
7974 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
7975 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
7976 * else:
7977 */
7978 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
7979 if (__pyx_t_1) {
7980
7981 /* "View.MemoryView":364
7982 *
7983 * if flags & PyBUF_FORMAT:
7984 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
7985 * else:
7986 * self.dtype_is_object = dtype_is_object
7987 */
7988 __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
7989 if (__pyx_t_2) {
7990 } else {
7991 __pyx_t_1 = __pyx_t_2;
7992 goto __pyx_L11_bool_binop_done;
7993 }
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;
7998
7999 /* "View.MemoryView":363
8000 * raise MemoryError
8001 *
8002 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
8003 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
8004 * else:
8005 */
8006 goto __pyx_L10;
8007 }
8008
8009 /* "View.MemoryView":366
8010 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
8011 * else:
8012 * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
8013 *
8014 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
8015 */
8016 /*else*/ {
8017 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
8018 }
8019 __pyx_L10:;
8020
8021 /* "View.MemoryView":368
8022 * self.dtype_is_object = dtype_is_object
8023 *
8024 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
8025 * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
8026 * self.typeinfo = NULL
8027 */
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))));
8029
8030 /* "View.MemoryView":370
8031 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
8032 * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
8033 * self.typeinfo = NULL # <<<<<<<<<<<<<<
8034 *
8035 * def __dealloc__(memoryview self):
8036 */
8037 __pyx_v_self->typeinfo = NULL;
8038
8039 /* "View.MemoryView":345
8040 * cdef __Pyx_TypeInfo *typeinfo
8041 *
8042 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
8043 * self.obj = obj
8044 * self.flags = flags
8045 */
8046
8047 /* function exit code */
8048 __pyx_r = 0;
8049 goto __pyx_L0;
8050 __pyx_L1_error:;
8051 __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8052 __pyx_r = -1;
8053 __pyx_L0:;
8054 __Pyx_RefNannyFinishContext();
8055 return __pyx_r;
8056}
8057
8058/* "View.MemoryView":372
8059 * self.typeinfo = NULL
8060 *
8061 * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
8062 * if self.obj is not None:
8063 * __Pyx_ReleaseBuffer(&self.view)
8064 */
8065
8066/* Python wrapper */
8067static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
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));
8072
8073 /* function exit code */
8074 __Pyx_RefNannyFinishContext();
8075}
8076
8077static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
8078 int __pyx_v_i;
8079 __Pyx_RefNannyDeclarations
8080 int __pyx_t_1;
8081 int __pyx_t_2;
8082 int __pyx_t_3;
8083 int __pyx_t_4;
8084 int __pyx_t_5;
8085 PyThread_type_lock __pyx_t_6;
8086 PyThread_type_lock __pyx_t_7;
8087 __Pyx_RefNannySetupContext("__dealloc__", 0);
8088
8089 /* "View.MemoryView":373
8090 *
8091 * def __dealloc__(memoryview self):
8092 * if self.obj is not None: # <<<<<<<<<<<<<<
8093 * __Pyx_ReleaseBuffer(&self.view)
8094 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
8095 */
8096 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
8097 __pyx_t_2 = (__pyx_t_1 != 0);
8098 if (__pyx_t_2) {
8099
8100 /* "View.MemoryView":374
8101 * def __dealloc__(memoryview self):
8102 * if self.obj is not None:
8103 * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
8104 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
8105 *
8106 */
8107 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
8108
8109 /* "View.MemoryView":373
8110 *
8111 * def __dealloc__(memoryview self):
8112 * if self.obj is not None: # <<<<<<<<<<<<<<
8113 * __Pyx_ReleaseBuffer(&self.view)
8114 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
8115 */
8116 goto __pyx_L3;
8117 }
8118
8119 /* "View.MemoryView":375
8120 * if self.obj is not None:
8121 * __Pyx_ReleaseBuffer(&self.view)
8122 * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
8123 *
8124 * (<__pyx_buffer *> &self.view).obj = NULL
8125 */
8126 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
8127 if (__pyx_t_2) {
8128
8129 /* "View.MemoryView":377
8130 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
8131 *
8132 * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
8133 * Py_DECREF(Py_None)
8134 *
8135 */
8136 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
8137
8138 /* "View.MemoryView":378
8139 *
8140 * (<__pyx_buffer *> &self.view).obj = NULL
8141 * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
8142 *
8143 * cdef int i
8144 */
8145 Py_DECREF(Py_None);
8146
8147 /* "View.MemoryView":375
8148 * if self.obj is not None:
8149 * __Pyx_ReleaseBuffer(&self.view)
8150 * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
8151 *
8152 * (<__pyx_buffer *> &self.view).obj = NULL
8153 */
8154 }
8155 __pyx_L3:;
8156
8157 /* "View.MemoryView":382
8158 * cdef int i
8159 * global __pyx_memoryview_thread_locks_used
8160 * if self.lock != NULL: # <<<<<<<<<<<<<<
8161 * for i in range(__pyx_memoryview_thread_locks_used):
8162 * if __pyx_memoryview_thread_locks[i] is self.lock:
8163 */
8164 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
8165 if (__pyx_t_2) {
8166
8167 /* "View.MemoryView":383
8168 * global __pyx_memoryview_thread_locks_used
8169 * if self.lock != NULL:
8170 * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
8171 * if __pyx_memoryview_thread_locks[i] is self.lock:
8172 * __pyx_memoryview_thread_locks_used -= 1
8173 */
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;
8178
8179 /* "View.MemoryView":384
8180 * if self.lock != NULL:
8181 * for i in range(__pyx_memoryview_thread_locks_used):
8182 * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
8183 * __pyx_memoryview_thread_locks_used -= 1
8184 * if i != __pyx_memoryview_thread_locks_used:
8185 */
8186 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
8187 if (__pyx_t_2) {
8188
8189 /* "View.MemoryView":385
8190 * for i in range(__pyx_memoryview_thread_locks_used):
8191 * if __pyx_memoryview_thread_locks[i] is self.lock:
8192 * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
8193 * if i != __pyx_memoryview_thread_locks_used:
8194 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8195 */
8196 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
8197
8198 /* "View.MemoryView":386
8199 * if __pyx_memoryview_thread_locks[i] is self.lock:
8200 * __pyx_memoryview_thread_locks_used -= 1
8201 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
8202 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8203 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8204 */
8205 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
8206 if (__pyx_t_2) {
8207
8208 /* "View.MemoryView":388
8209 * if i != __pyx_memoryview_thread_locks_used:
8210 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8211 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
8212 * break
8213 * else:
8214 */
8215 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
8216 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
8217
8218 /* "View.MemoryView":387
8219 * __pyx_memoryview_thread_locks_used -= 1
8220 * if i != __pyx_memoryview_thread_locks_used:
8221 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
8222 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8223 * break
8224 */
8225 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
8226 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
8227
8228 /* "View.MemoryView":386
8229 * if __pyx_memoryview_thread_locks[i] is self.lock:
8230 * __pyx_memoryview_thread_locks_used -= 1
8231 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
8232 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8233 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8234 */
8235 }
8236
8237 /* "View.MemoryView":389
8238 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
8239 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
8240 * break # <<<<<<<<<<<<<<
8241 * else:
8242 * PyThread_free_lock(self.lock)
8243 */
8244 goto __pyx_L6_break;
8245
8246 /* "View.MemoryView":384
8247 * if self.lock != NULL:
8248 * for i in range(__pyx_memoryview_thread_locks_used):
8249 * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
8250 * __pyx_memoryview_thread_locks_used -= 1
8251 * if i != __pyx_memoryview_thread_locks_used:
8252 */
8253 }
8254 }
8255 /*else*/ {
8256
8257 /* "View.MemoryView":391
8258 * break
8259 * else:
8260 * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
8261 *
8262 * cdef char *get_item_pointer(memoryview self, object index) except NULL:
8263 */
8264 PyThread_free_lock(__pyx_v_self->lock);
8265 }
8266 __pyx_L6_break:;
8267
8268 /* "View.MemoryView":382
8269 * cdef int i
8270 * global __pyx_memoryview_thread_locks_used
8271 * if self.lock != NULL: # <<<<<<<<<<<<<<
8272 * for i in range(__pyx_memoryview_thread_locks_used):
8273 * if __pyx_memoryview_thread_locks[i] is self.lock:
8274 */
8275 }
8276
8277 /* "View.MemoryView":372
8278 * self.typeinfo = NULL
8279 *
8280 * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
8281 * if self.obj is not None:
8282 * __Pyx_ReleaseBuffer(&self.view)
8283 */
8284
8285 /* function exit code */
8286 __Pyx_RefNannyFinishContext();
8287}
8288
8289/* "View.MemoryView":393
8290 * PyThread_free_lock(self.lock)
8291 *
8292 * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
8293 * cdef Py_ssize_t dim
8294 * cdef char *itemp = <char *> self.view.buf
8295 */
8296
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;
8301 char *__pyx_r;
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;
8309 char *__pyx_t_7;
8310 int __pyx_lineno = 0;
8311 const char *__pyx_filename = NULL;
8312 int __pyx_clineno = 0;
8313 __Pyx_RefNannySetupContext("get_item_pointer", 0);
8314
8315 /* "View.MemoryView":395
8316 * cdef char *get_item_pointer(memoryview self, object index) except NULL:
8317 * cdef Py_ssize_t dim
8318 * cdef char *itemp = <char *> self.view.buf # <<<<<<<<<<<<<<
8319 *
8320 * for dim, idx in enumerate(index):
8321 */
8322 __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
8323
8324 /* "View.MemoryView":397
8325 * cdef char *itemp = <char *> self.view.buf
8326 *
8327 * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
8328 * itemp = pybuffer_index(&self.view, itemp, idx, dim)
8329 *
8330 */
8331 __pyx_t_1 = 0;
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;
8334 __pyx_t_4 = NULL;
8335 } else {
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)
8339 }
8340 for (;;) {
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)
8346 #else
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);
8349 #endif
8350 } else {
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)
8354 #else
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);
8357 #endif
8358 }
8359 } else {
8360 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
8361 if (unlikely(!__pyx_t_5)) {
8362 PyObject* exc_type = PyErr_Occurred();
8363 if (exc_type) {
8364 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8365 else __PYX_ERR(2, 397, __pyx_L1_error)
8366 }
8367 break;
8368 }
8369 __Pyx_GOTREF(__pyx_t_5);
8370 }
8371 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
8372 __pyx_t_5 = 0;
8373 __pyx_v_dim = __pyx_t_1;
8374 __pyx_t_1 = (__pyx_t_1 + 1);
8375
8376 /* "View.MemoryView":398
8377 *
8378 * for dim, idx in enumerate(index):
8379 * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
8380 *
8381 * return itemp
8382 */
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;
8386
8387 /* "View.MemoryView":397
8388 * cdef char *itemp = <char *> self.view.buf
8389 *
8390 * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
8391 * itemp = pybuffer_index(&self.view, itemp, idx, dim)
8392 *
8393 */
8394 }
8395 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8396
8397 /* "View.MemoryView":400
8398 * itemp = pybuffer_index(&self.view, itemp, idx, dim)
8399 *
8400 * return itemp # <<<<<<<<<<<<<<
8401 *
8402 *
8403 */
8404 __pyx_r = __pyx_v_itemp;
8405 goto __pyx_L0;
8406
8407 /* "View.MemoryView":393
8408 * PyThread_free_lock(self.lock)
8409 *
8410 * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
8411 * cdef Py_ssize_t dim
8412 * cdef char *itemp = <char *> self.view.buf
8413 */
8414
8415 /* function exit code */
8416 __pyx_L1_error:;
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);
8420 __pyx_r = NULL;
8421 __pyx_L0:;
8422 __Pyx_XDECREF(__pyx_v_idx);
8423 __Pyx_RefNannyFinishContext();
8424 return __pyx_r;
8425}
8426
8427/* "View.MemoryView":403
8428 *
8429 *
8430 * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
8431 * if index is Ellipsis:
8432 * return self
8433 */
8434
8435/* Python wrapper */
8436static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
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));
8442
8443 /* function exit code */
8444 __Pyx_RefNannyFinishContext();
8445 return __pyx_r;
8446}
8447
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
8454 int __pyx_t_1;
8455 int __pyx_t_2;
8456 PyObject *__pyx_t_3 = NULL;
8457 PyObject *__pyx_t_4 = NULL;
8458 PyObject *__pyx_t_5 = NULL;
8459 char *__pyx_t_6;
8460 int __pyx_lineno = 0;
8461 const char *__pyx_filename = NULL;
8462 int __pyx_clineno = 0;
8463 __Pyx_RefNannySetupContext("__getitem__", 0);
8464
8465 /* "View.MemoryView":404
8466 *
8467 * def __getitem__(memoryview self, object index):
8468 * if index is Ellipsis: # <<<<<<<<<<<<<<
8469 * return self
8470 *
8471 */
8472 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
8473 __pyx_t_2 = (__pyx_t_1 != 0);
8474 if (__pyx_t_2) {
8475
8476 /* "View.MemoryView":405
8477 * def __getitem__(memoryview self, object index):
8478 * if index is Ellipsis:
8479 * return self # <<<<<<<<<<<<<<
8480 *
8481 * have_slices, indices = _unellipsify(index, self.view.ndim)
8482 */
8483 __Pyx_XDECREF(__pyx_r);
8484 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8485 __pyx_r = ((PyObject *)__pyx_v_self);
8486 goto __pyx_L0;
8487
8488 /* "View.MemoryView":404
8489 *
8490 * def __getitem__(memoryview self, object index):
8491 * if index is Ellipsis: # <<<<<<<<<<<<<<
8492 * return self
8493 *
8494 */
8495 }
8496
8497 /* "View.MemoryView":407
8498 * return self
8499 *
8500 * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
8501 *
8502 * cdef char *itemp
8503 */
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)
8513 }
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);
8519 #else
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);
8524 #endif
8525 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8526 } else {
8527 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
8528 }
8529 __pyx_v_have_slices = __pyx_t_4;
8530 __pyx_t_4 = 0;
8531 __pyx_v_indices = __pyx_t_5;
8532 __pyx_t_5 = 0;
8533
8534 /* "View.MemoryView":410
8535 *
8536 * cdef char *itemp
8537 * if have_slices: # <<<<<<<<<<<<<<
8538 * return memview_slice(self, indices)
8539 * else:
8540 */
8541 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
8542 if (__pyx_t_2) {
8543
8544 /* "View.MemoryView":411
8545 * cdef char *itemp
8546 * if have_slices:
8547 * return memview_slice(self, indices) # <<<<<<<<<<<<<<
8548 * else:
8549 * itemp = self.get_item_pointer(indices)
8550 */
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;
8555 __pyx_t_3 = 0;
8556 goto __pyx_L0;
8557
8558 /* "View.MemoryView":410
8559 *
8560 * cdef char *itemp
8561 * if have_slices: # <<<<<<<<<<<<<<
8562 * return memview_slice(self, indices)
8563 * else:
8564 */
8565 }
8566
8567 /* "View.MemoryView":413
8568 * return memview_slice(self, indices)
8569 * else:
8570 * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
8571 * return self.convert_item_to_object(itemp)
8572 *
8573 */
8574 /*else*/ {
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;
8577
8578 /* "View.MemoryView":414
8579 * else:
8580 * itemp = self.get_item_pointer(indices)
8581 * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
8582 *
8583 * def __setitem__(memoryview self, object index, object value):
8584 */
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;
8589 __pyx_t_3 = 0;
8590 goto __pyx_L0;
8591 }
8592
8593 /* "View.MemoryView":403
8594 *
8595 *
8596 * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
8597 * if index is Ellipsis:
8598 * return self
8599 */
8600
8601 /* function exit code */
8602 __pyx_L1_error:;
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);
8607 __pyx_r = NULL;
8608 __pyx_L0:;
8609 __Pyx_XDECREF(__pyx_v_have_slices);
8610 __Pyx_XDECREF(__pyx_v_indices);
8611 __Pyx_XGIVEREF(__pyx_r);
8612 __Pyx_RefNannyFinishContext();
8613 return __pyx_r;
8614}
8615
8616/* "View.MemoryView":416
8617 * return self.convert_item_to_object(itemp)
8618 *
8619 * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
8620 * if self.view.readonly:
8621 * raise TypeError("Cannot assign to read-only memoryview")
8622 */
8623
8624/* Python wrapper */
8625static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
8626static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
8627 int __pyx_r;
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));
8631
8632 /* function exit code */
8633 __Pyx_RefNannyFinishContext();
8634 return __pyx_r;
8635}
8636
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;
8640 int __pyx_r;
8641 __Pyx_RefNannyDeclarations
8642 int __pyx_t_1;
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);
8651
8652 /* "View.MemoryView":417
8653 *
8654 * def __setitem__(memoryview self, object index, object value):
8655 * if self.view.readonly: # <<<<<<<<<<<<<<
8656 * raise TypeError("Cannot assign to read-only memoryview")
8657 *
8658 */
8659 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
8660 if (unlikely(__pyx_t_1)) {
8661
8662 /* "View.MemoryView":418
8663 * def __setitem__(memoryview self, object index, object value):
8664 * if self.view.readonly:
8665 * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
8666 *
8667 * have_slices, index = _unellipsify(index, self.view.ndim)
8668 */
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)
8674
8675 /* "View.MemoryView":417
8676 *
8677 * def __setitem__(memoryview self, object index, object value):
8678 * if self.view.readonly: # <<<<<<<<<<<<<<
8679 * raise TypeError("Cannot assign to read-only memoryview")
8680 *
8681 */
8682 }
8683
8684 /* "View.MemoryView":420
8685 * raise TypeError("Cannot assign to read-only memoryview")
8686 *
8687 * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
8688 *
8689 * if have_slices:
8690 */
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)
8700 }
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);
8706 #else
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);
8711 #endif
8712 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8713 } else {
8714 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
8715 }
8716 __pyx_v_have_slices = __pyx_t_3;
8717 __pyx_t_3 = 0;
8718 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
8719 __pyx_t_4 = 0;
8720
8721 /* "View.MemoryView":422
8722 * have_slices, index = _unellipsify(index, self.view.ndim)
8723 *
8724 * if have_slices: # <<<<<<<<<<<<<<
8725 * obj = self.is_slice(value)
8726 * if obj:
8727 */
8728 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
8729 if (__pyx_t_1) {
8730
8731 /* "View.MemoryView":423
8732 *
8733 * if have_slices:
8734 * obj = self.is_slice(value) # <<<<<<<<<<<<<<
8735 * if obj:
8736 * self.setitem_slice_assignment(self[index], obj)
8737 */
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;
8741 __pyx_t_2 = 0;
8742
8743 /* "View.MemoryView":424
8744 * if have_slices:
8745 * obj = self.is_slice(value)
8746 * if obj: # <<<<<<<<<<<<<<
8747 * self.setitem_slice_assignment(self[index], obj)
8748 * else:
8749 */
8750 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
8751 if (__pyx_t_1) {
8752
8753 /* "View.MemoryView":425
8754 * obj = self.is_slice(value)
8755 * if obj:
8756 * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
8757 * else:
8758 * self.setitem_slice_assign_scalar(self[index], value)
8759 */
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;
8766
8767 /* "View.MemoryView":424
8768 * if have_slices:
8769 * obj = self.is_slice(value)
8770 * if obj: # <<<<<<<<<<<<<<
8771 * self.setitem_slice_assignment(self[index], obj)
8772 * else:
8773 */
8774 goto __pyx_L5;
8775 }
8776
8777 /* "View.MemoryView":427
8778 * self.setitem_slice_assignment(self[index], obj)
8779 * else:
8780 * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
8781 * else:
8782 * self.setitem_indexed(index, value)
8783 */
8784 /*else*/ {
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;
8792 }
8793 __pyx_L5:;
8794
8795 /* "View.MemoryView":422
8796 * have_slices, index = _unellipsify(index, self.view.ndim)
8797 *
8798 * if have_slices: # <<<<<<<<<<<<<<
8799 * obj = self.is_slice(value)
8800 * if obj:
8801 */
8802 goto __pyx_L4;
8803 }
8804
8805 /* "View.MemoryView":429
8806 * self.setitem_slice_assign_scalar(self[index], value)
8807 * else:
8808 * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
8809 *
8810 * cdef is_slice(self, obj):
8811 */
8812 /*else*/ {
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;
8816 }
8817 __pyx_L4:;
8818
8819 /* "View.MemoryView":416
8820 * return self.convert_item_to_object(itemp)
8821 *
8822 * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
8823 * if self.view.readonly:
8824 * raise TypeError("Cannot assign to read-only memoryview")
8825 */
8826
8827 /* function exit code */
8828 __pyx_r = 0;
8829 goto __pyx_L0;
8830 __pyx_L1_error:;
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);
8835 __pyx_r = -1;
8836 __pyx_L0:;
8837 __Pyx_XDECREF(__pyx_v_have_slices);
8838 __Pyx_XDECREF(__pyx_v_obj);
8839 __Pyx_XDECREF(__pyx_v_index);
8840 __Pyx_RefNannyFinishContext();
8841 return __pyx_r;
8842}
8843
8844/* "View.MemoryView":431
8845 * self.setitem_indexed(index, value)
8846 *
8847 * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
8848 * if not isinstance(obj, memoryview):
8849 * try:
8850 */
8851
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
8855 int __pyx_t_1;
8856 int __pyx_t_2;
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;
8863 int __pyx_t_9;
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);
8869
8870 /* "View.MemoryView":432
8871 *
8872 * cdef is_slice(self, obj):
8873 * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
8874 * try:
8875 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8876 */
8877 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
8878 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
8879 if (__pyx_t_2) {
8880
8881 /* "View.MemoryView":433
8882 * cdef is_slice(self, obj):
8883 * if not isinstance(obj, memoryview):
8884 * try: # <<<<<<<<<<<<<<
8885 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8886 * self.dtype_is_object)
8887 */
8888 {
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);
8895 /*try:*/ {
8896
8897 /* "View.MemoryView":434
8898 * if not isinstance(obj, memoryview):
8899 * try:
8900 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
8901 * self.dtype_is_object)
8902 * except TypeError:
8903 */
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);
8906
8907 /* "View.MemoryView":435
8908 * try:
8909 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8910 * self.dtype_is_object) # <<<<<<<<<<<<<<
8911 * except TypeError:
8912 * return None
8913 */
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);
8916
8917 /* "View.MemoryView":434
8918 * if not isinstance(obj, memoryview):
8919 * try:
8920 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
8921 * self.dtype_is_object)
8922 * except TypeError:
8923 */
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);
8933 __pyx_t_6 = 0;
8934 __pyx_t_7 = 0;
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);
8939 __pyx_t_7 = 0;
8940
8941 /* "View.MemoryView":433
8942 * cdef is_slice(self, obj):
8943 * if not isinstance(obj, memoryview):
8944 * try: # <<<<<<<<<<<<<<
8945 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8946 * self.dtype_is_object)
8947 */
8948 }
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;
8953 __pyx_L4_error:;
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;
8957
8958 /* "View.MemoryView":436
8959 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8960 * self.dtype_is_object)
8961 * except TypeError: # <<<<<<<<<<<<<<
8962 * return None
8963 *
8964 */
8965 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
8966 if (__pyx_t_9) {
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);
8972
8973 /* "View.MemoryView":437
8974 * self.dtype_is_object)
8975 * except TypeError:
8976 * return None # <<<<<<<<<<<<<<
8977 *
8978 * return obj
8979 */
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;
8986 }
8987 goto __pyx_L6_except_error;
8988 __pyx_L6_except_error:;
8989
8990 /* "View.MemoryView":433
8991 * cdef is_slice(self, obj):
8992 * if not isinstance(obj, memoryview):
8993 * try: # <<<<<<<<<<<<<<
8994 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
8995 * self.dtype_is_object)
8996 */
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);
9007 goto __pyx_L0;
9008 __pyx_L9_try_end:;
9009 }
9010
9011 /* "View.MemoryView":432
9012 *
9013 * cdef is_slice(self, obj):
9014 * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
9015 * try:
9016 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
9017 */
9018 }
9019
9020 /* "View.MemoryView":439
9021 * return None
9022 *
9023 * return obj # <<<<<<<<<<<<<<
9024 *
9025 * cdef setitem_slice_assignment(self, dst, src):
9026 */
9027 __Pyx_XDECREF(__pyx_r);
9028 __Pyx_INCREF(__pyx_v_obj);
9029 __pyx_r = __pyx_v_obj;
9030 goto __pyx_L0;
9031
9032 /* "View.MemoryView":431
9033 * self.setitem_indexed(index, value)
9034 *
9035 * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
9036 * if not isinstance(obj, memoryview):
9037 * try:
9038 */
9039
9040 /* function exit code */
9041 __pyx_L1_error:;
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);
9046 __pyx_r = 0;
9047 __pyx_L0:;
9048 __Pyx_XDECREF(__pyx_v_obj);
9049 __Pyx_XGIVEREF(__pyx_r);
9050 __Pyx_RefNannyFinishContext();
9051 return __pyx_r;
9052}
9053
9054/* "View.MemoryView":441
9055 * return obj
9056 *
9057 * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
9058 * cdef __Pyx_memviewslice dst_slice
9059 * cdef __Pyx_memviewslice src_slice
9060 */
9061
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;
9070 int __pyx_t_4;
9071 int __pyx_t_5;
9072 int __pyx_t_6;
9073 int __pyx_lineno = 0;
9074 const char *__pyx_filename = NULL;
9075 int __pyx_clineno = 0;
9076 __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
9077
9078 /* "View.MemoryView":445
9079 * cdef __Pyx_memviewslice src_slice
9080 *
9081 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
9082 * get_slice_from_memview(dst, &dst_slice)[0],
9083 * src.ndim, dst.ndim, self.dtype_is_object)
9084 */
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)
9087
9088 /* "View.MemoryView":446
9089 *
9090 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
9091 * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<<
9092 * src.ndim, dst.ndim, self.dtype_is_object)
9093 *
9094 */
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)
9097
9098 /* "View.MemoryView":447
9099 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
9100 * get_slice_from_memview(dst, &dst_slice)[0],
9101 * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
9102 *
9103 * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
9104 */
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;
9113
9114 /* "View.MemoryView":445
9115 * cdef __Pyx_memviewslice src_slice
9116 *
9117 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
9118 * get_slice_from_memview(dst, &dst_slice)[0],
9119 * src.ndim, dst.ndim, self.dtype_is_object)
9120 */
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)
9122
9123 /* "View.MemoryView":441
9124 * return obj
9125 *
9126 * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
9127 * cdef __Pyx_memviewslice dst_slice
9128 * cdef __Pyx_memviewslice src_slice
9129 */
9130
9131 /* function exit code */
9132 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9133 goto __pyx_L0;
9134 __pyx_L1_error:;
9135 __Pyx_XDECREF(__pyx_t_3);
9136 __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
9137 __pyx_r = 0;
9138 __pyx_L0:;
9139 __Pyx_XGIVEREF(__pyx_r);
9140 __Pyx_RefNannyFinishContext();
9141 return __pyx_r;
9142}
9143
9144/* "View.MemoryView":449
9145 * src.ndim, dst.ndim, self.dtype_is_object)
9146 *
9147 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
9148 * cdef int array[128]
9149 * cdef void *tmp = NULL
9150 */
9151
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];
9154 void *__pyx_v_tmp;
9155 void *__pyx_v_item;
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;
9161 int __pyx_t_2;
9162 PyObject *__pyx_t_3 = NULL;
9163 int __pyx_t_4;
9164 int __pyx_t_5;
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);
9176
9177 /* "View.MemoryView":451
9178 * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
9179 * cdef int array[128]
9180 * cdef void *tmp = NULL # <<<<<<<<<<<<<<
9181 * cdef void *item
9182 *
9183 */
9184 __pyx_v_tmp = NULL;
9185
9186 /* "View.MemoryView":456
9187 * cdef __Pyx_memviewslice *dst_slice
9188 * cdef __Pyx_memviewslice tmp_slice
9189 * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
9190 *
9191 * if <size_t>self.view.itemsize > sizeof(array):
9192 */
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;
9195
9196 /* "View.MemoryView":458
9197 * dst_slice = get_slice_from_memview(dst, &tmp_slice)
9198 *
9199 * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
9200 * tmp = PyMem_Malloc(self.view.itemsize)
9201 * if tmp == NULL:
9202 */
9203 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
9204 if (__pyx_t_2) {
9205
9206 /* "View.MemoryView":459
9207 *
9208 * if <size_t>self.view.itemsize > sizeof(array):
9209 * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
9210 * if tmp == NULL:
9211 * raise MemoryError
9212 */
9213 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
9214
9215 /* "View.MemoryView":460
9216 * if <size_t>self.view.itemsize > sizeof(array):
9217 * tmp = PyMem_Malloc(self.view.itemsize)
9218 * if tmp == NULL: # <<<<<<<<<<<<<<
9219 * raise MemoryError
9220 * item = tmp
9221 */
9222 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
9223 if (unlikely(__pyx_t_2)) {
9224
9225 /* "View.MemoryView":461
9226 * tmp = PyMem_Malloc(self.view.itemsize)
9227 * if tmp == NULL:
9228 * raise MemoryError # <<<<<<<<<<<<<<
9229 * item = tmp
9230 * else:
9231 */
9232 PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
9233
9234 /* "View.MemoryView":460
9235 * if <size_t>self.view.itemsize > sizeof(array):
9236 * tmp = PyMem_Malloc(self.view.itemsize)
9237 * if tmp == NULL: # <<<<<<<<<<<<<<
9238 * raise MemoryError
9239 * item = tmp
9240 */
9241 }
9242
9243 /* "View.MemoryView":462
9244 * if tmp == NULL:
9245 * raise MemoryError
9246 * item = tmp # <<<<<<<<<<<<<<
9247 * else:
9248 * item = <void *> array
9249 */
9250 __pyx_v_item = __pyx_v_tmp;
9251
9252 /* "View.MemoryView":458
9253 * dst_slice = get_slice_from_memview(dst, &tmp_slice)
9254 *
9255 * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
9256 * tmp = PyMem_Malloc(self.view.itemsize)
9257 * if tmp == NULL:
9258 */
9259 goto __pyx_L3;
9260 }
9261
9262 /* "View.MemoryView":464
9263 * item = tmp
9264 * else:
9265 * item = <void *> array # <<<<<<<<<<<<<<
9266 *
9267 * try:
9268 */
9269 /*else*/ {
9270 __pyx_v_item = ((void *)__pyx_v_array);
9271 }
9272 __pyx_L3:;
9273
9274 /* "View.MemoryView":466
9275 * item = <void *> array
9276 *
9277 * try: # <<<<<<<<<<<<<<
9278 * if self.dtype_is_object:
9279 * (<PyObject **> item)[0] = <PyObject *> value
9280 */
9281 /*try:*/ {
9282
9283 /* "View.MemoryView":467
9284 *
9285 * try:
9286 * if self.dtype_is_object: # <<<<<<<<<<<<<<
9287 * (<PyObject **> item)[0] = <PyObject *> value
9288 * else:
9289 */
9290 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
9291 if (__pyx_t_2) {
9292
9293 /* "View.MemoryView":468
9294 * try:
9295 * if self.dtype_is_object:
9296 * (<PyObject **> item)[0] = <PyObject *> value # <<<<<<<<<<<<<<
9297 * else:
9298 * self.assign_item_from_object(<char *> item, value)
9299 */
9300 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
9301
9302 /* "View.MemoryView":467
9303 *
9304 * try:
9305 * if self.dtype_is_object: # <<<<<<<<<<<<<<
9306 * (<PyObject **> item)[0] = <PyObject *> value
9307 * else:
9308 */
9309 goto __pyx_L8;
9310 }
9311
9312 /* "View.MemoryView":470
9313 * (<PyObject **> item)[0] = <PyObject *> value
9314 * else:
9315 * self.assign_item_from_object(<char *> item, value) # <<<<<<<<<<<<<<
9316 *
9317 *
9318 */
9319 /*else*/ {
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;
9323 }
9324 __pyx_L8:;
9325
9326 /* "View.MemoryView":474
9327 *
9328 *
9329 * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
9330 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
9331 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
9332 */
9333 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
9334 if (__pyx_t_2) {
9335
9336 /* "View.MemoryView":475
9337 *
9338 * if self.view.suboffsets != NULL:
9339 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
9340 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
9341 * item, self.dtype_is_object)
9342 */
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;
9346
9347 /* "View.MemoryView":474
9348 *
9349 *
9350 * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
9351 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
9352 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
9353 */
9354 }
9355
9356 /* "View.MemoryView":476
9357 * if self.view.suboffsets != NULL:
9358 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
9359 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
9360 * item, self.dtype_is_object)
9361 * finally:
9362 */
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);
9364 }
9365
9366 /* "View.MemoryView":479
9367 * item, self.dtype_is_object)
9368 * finally:
9369 * PyMem_Free(tmp) # <<<<<<<<<<<<<<
9370 *
9371 * cdef setitem_indexed(self, index, value):
9372 */
9373 /*finally:*/ {
9374 /*normal exit:*/{
9375 PyMem_Free(__pyx_v_tmp);
9376 goto __pyx_L7;
9377 }
9378 __pyx_L6_error:;
9379 /*exception exit:*/{
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;
9393 {
9394 PyMem_Free(__pyx_v_tmp);
9395 }
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);
9401 }
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;
9409 }
9410 __pyx_L7:;
9411 }
9412
9413 /* "View.MemoryView":449
9414 * src.ndim, dst.ndim, self.dtype_is_object)
9415 *
9416 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
9417 * cdef int array[128]
9418 * cdef void *tmp = NULL
9419 */
9420
9421 /* function exit code */
9422 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9423 goto __pyx_L0;
9424 __pyx_L1_error:;
9425 __Pyx_XDECREF(__pyx_t_3);
9426 __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
9427 __pyx_r = 0;
9428 __pyx_L0:;
9429 __Pyx_XGIVEREF(__pyx_r);
9430 __Pyx_RefNannyFinishContext();
9431 return __pyx_r;
9432}
9433
9434/* "View.MemoryView":481
9435 * PyMem_Free(tmp)
9436 *
9437 * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
9438 * cdef char *itemp = self.get_item_pointer(index)
9439 * self.assign_item_from_object(itemp, value)
9440 */
9441
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
9446 char *__pyx_t_1;
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);
9452
9453 /* "View.MemoryView":482
9454 *
9455 * cdef setitem_indexed(self, index, value):
9456 * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
9457 * self.assign_item_from_object(itemp, value)
9458 *
9459 */
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;
9462
9463 /* "View.MemoryView":483
9464 * cdef setitem_indexed(self, index, value):
9465 * cdef char *itemp = self.get_item_pointer(index)
9466 * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
9467 *
9468 * cdef convert_item_to_object(self, char *itemp):
9469 */
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;
9473
9474 /* "View.MemoryView":481
9475 * PyMem_Free(tmp)
9476 *
9477 * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
9478 * cdef char *itemp = self.get_item_pointer(index)
9479 * self.assign_item_from_object(itemp, value)
9480 */
9481
9482 /* function exit code */
9483 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9484 goto __pyx_L0;
9485 __pyx_L1_error:;
9486 __Pyx_XDECREF(__pyx_t_2);
9487 __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
9488 __pyx_r = 0;
9489 __pyx_L0:;
9490 __Pyx_XGIVEREF(__pyx_r);
9491 __Pyx_RefNannyFinishContext();
9492 return __pyx_r;
9493}
9494
9495/* "View.MemoryView":485
9496 * self.assign_item_from_object(itemp, value)
9497 *
9498 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
9499 * """Only used if instantiated manually by the user, or if Cython doesn't
9500 * know how to convert the type"""
9501 */
9502
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;
9516 int __pyx_t_8;
9517 PyObject *__pyx_t_9 = NULL;
9518 size_t __pyx_t_10;
9519 int __pyx_t_11;
9520 int __pyx_lineno = 0;
9521 const char *__pyx_filename = NULL;
9522 int __pyx_clineno = 0;
9523 __Pyx_RefNannySetupContext("convert_item_to_object", 0);
9524
9525 /* "View.MemoryView":488
9526 * """Only used if instantiated manually by the user, or if Cython doesn't
9527 * know how to convert the type"""
9528 * import struct # <<<<<<<<<<<<<<
9529 * cdef bytes bytesitem
9530 *
9531 */
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;
9535 __pyx_t_1 = 0;
9536
9537 /* "View.MemoryView":491
9538 * cdef bytes bytesitem
9539 *
9540 * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
9541 * try:
9542 * result = struct.unpack(self.view.format, bytesitem)
9543 */
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);
9547 __pyx_t_1 = 0;
9548
9549 /* "View.MemoryView":492
9550 *
9551 * bytesitem = itemp[:self.view.itemsize]
9552 * try: # <<<<<<<<<<<<<<
9553 * result = struct.unpack(self.view.format, bytesitem)
9554 * except struct.error:
9555 */
9556 {
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);
9563 /*try:*/ {
9564
9565 /* "View.MemoryView":493
9566 * bytesitem = itemp[:self.view.itemsize]
9567 * try:
9568 * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
9569 * except struct.error:
9570 * raise ValueError("Unable to convert item to object")
9571 */
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);
9576 __pyx_t_7 = NULL;
9577 __pyx_t_8 = 0;
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);
9585 __pyx_t_8 = 1;
9586 }
9587 }
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;
9595 } else
9596 #endif
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;
9604 } else
9605 #endif
9606 {
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);
9609 if (__pyx_t_7) {
9610 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
9611 }
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);
9617 __pyx_t_6 = 0;
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;
9621 }
9622 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9623 __pyx_v_result = __pyx_t_1;
9624 __pyx_t_1 = 0;
9625
9626 /* "View.MemoryView":492
9627 *
9628 * bytesitem = itemp[:self.view.itemsize]
9629 * try: # <<<<<<<<<<<<<<
9630 * result = struct.unpack(self.view.format, bytesitem)
9631 * except struct.error:
9632 */
9633 }
9634
9635 /* "View.MemoryView":497
9636 * raise ValueError("Unable to convert item to object")
9637 * else:
9638 * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
9639 * return result[0]
9640 * return result
9641 */
9642 /*else:*/ {
9643 __pyx_t_10 = strlen(__pyx_v_self->view.format);
9644 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
9645 if (__pyx_t_11) {
9646
9647 /* "View.MemoryView":498
9648 * else:
9649 * if len(self.view.format) == 1:
9650 * return result[0] # <<<<<<<<<<<<<<
9651 * return result
9652 *
9653 */
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;
9658 __pyx_t_1 = 0;
9659 goto __pyx_L6_except_return;
9660
9661 /* "View.MemoryView":497
9662 * raise ValueError("Unable to convert item to object")
9663 * else:
9664 * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
9665 * return result[0]
9666 * return result
9667 */
9668 }
9669
9670 /* "View.MemoryView":499
9671 * if len(self.view.format) == 1:
9672 * return result[0]
9673 * return result # <<<<<<<<<<<<<<
9674 *
9675 * cdef assign_item_from_object(self, char *itemp, object value):
9676 */
9677 __Pyx_XDECREF(__pyx_r);
9678 __Pyx_INCREF(__pyx_v_result);
9679 __pyx_r = __pyx_v_result;
9680 goto __pyx_L6_except_return;
9681 }
9682 __pyx_L3_error:;
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;
9688
9689 /* "View.MemoryView":494
9690 * try:
9691 * result = struct.unpack(self.view.format, bytesitem)
9692 * except struct.error: # <<<<<<<<<<<<<<
9693 * raise ValueError("Unable to convert item to object")
9694 * else:
9695 */
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;
9703 if (__pyx_t_8) {
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);
9709
9710 /* "View.MemoryView":495
9711 * result = struct.unpack(self.view.format, bytesitem)
9712 * except struct.error:
9713 * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
9714 * else:
9715 * if len(self.view.format) == 1:
9716 */
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)
9722 }
9723 goto __pyx_L5_except_error;
9724 __pyx_L5_except_error:;
9725
9726 /* "View.MemoryView":492
9727 *
9728 * bytesitem = itemp[:self.view.itemsize]
9729 * try: # <<<<<<<<<<<<<<
9730 * result = struct.unpack(self.view.format, bytesitem)
9731 * except struct.error:
9732 */
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);
9743 goto __pyx_L0;
9744 }
9745
9746 /* "View.MemoryView":485
9747 * self.assign_item_from_object(itemp, value)
9748 *
9749 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
9750 * """Only used if instantiated manually by the user, or if Cython doesn't
9751 * know how to convert the type"""
9752 */
9753
9754 /* function exit code */
9755 __pyx_L1_error:;
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);
9762 __pyx_r = 0;
9763 __pyx_L0:;
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();
9769 return __pyx_r;
9770}
9771
9772/* "View.MemoryView":501
9773 * return result
9774 *
9775 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
9776 * """Only used if instantiated manually by the user, or if Cython doesn't
9777 * know how to convert the type"""
9778 */
9779
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;
9782 char __pyx_v_c;
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;
9788 int __pyx_t_2;
9789 int __pyx_t_3;
9790 PyObject *__pyx_t_4 = NULL;
9791 PyObject *__pyx_t_5 = NULL;
9792 PyObject *__pyx_t_6 = NULL;
9793 int __pyx_t_7;
9794 PyObject *__pyx_t_8 = NULL;
9795 Py_ssize_t __pyx_t_9;
9796 PyObject *__pyx_t_10 = NULL;
9797 char *__pyx_t_11;
9798 char *__pyx_t_12;
9799 char *__pyx_t_13;
9800 char *__pyx_t_14;
9801 int __pyx_lineno = 0;
9802 const char *__pyx_filename = NULL;
9803 int __pyx_clineno = 0;
9804 __Pyx_RefNannySetupContext("assign_item_from_object", 0);
9805
9806 /* "View.MemoryView":504
9807 * """Only used if instantiated manually by the user, or if Cython doesn't
9808 * know how to convert the type"""
9809 * import struct # <<<<<<<<<<<<<<
9810 * cdef char c
9811 * cdef bytes bytesvalue
9812 */
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;
9816 __pyx_t_1 = 0;
9817
9818 /* "View.MemoryView":509
9819 * cdef Py_ssize_t i
9820 *
9821 * if isinstance(value, tuple): # <<<<<<<<<<<<<<
9822 * bytesvalue = struct.pack(self.view.format, *value)
9823 * else:
9824 */
9825 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
9826 __pyx_t_3 = (__pyx_t_2 != 0);
9827 if (__pyx_t_3) {
9828
9829 /* "View.MemoryView":510
9830 *
9831 * if isinstance(value, tuple):
9832 * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
9833 * else:
9834 * bytesvalue = struct.pack(self.view.format, value)
9835 */
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);
9844 __pyx_t_4 = 0;
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);
9857 __pyx_t_4 = 0;
9858
9859 /* "View.MemoryView":509
9860 * cdef Py_ssize_t i
9861 *
9862 * if isinstance(value, tuple): # <<<<<<<<<<<<<<
9863 * bytesvalue = struct.pack(self.view.format, *value)
9864 * else:
9865 */
9866 goto __pyx_L3;
9867 }
9868
9869 /* "View.MemoryView":512
9870 * bytesvalue = struct.pack(self.view.format, *value)
9871 * else:
9872 * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
9873 *
9874 * for i, c in enumerate(bytesvalue):
9875 */
9876 /*else*/ {
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);
9881 __pyx_t_5 = NULL;
9882 __pyx_t_7 = 0;
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);
9890 __pyx_t_7 = 1;
9891 }
9892 }
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;
9900 } else
9901 #endif
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;
9909 } else
9910 #endif
9911 {
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);
9914 if (__pyx_t_5) {
9915 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
9916 }
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);
9922 __pyx_t_1 = 0;
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;
9926 }
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);
9930 __pyx_t_4 = 0;
9931 }
9932 __pyx_L3:;
9933
9934 /* "View.MemoryView":514
9935 * bytesvalue = struct.pack(self.view.format, value)
9936 *
9937 * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
9938 * itemp[i] = c
9939 *
9940 */
9941 __pyx_t_9 = 0;
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)
9945 }
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]);
9953
9954 /* "View.MemoryView":515
9955 *
9956 * for i, c in enumerate(bytesvalue):
9957 * itemp[i] = c # <<<<<<<<<<<<<<
9958 *
9959 * @cname('getbuffer')
9960 */
9961 __pyx_v_i = __pyx_t_9;
9962
9963 /* "View.MemoryView":514
9964 * bytesvalue = struct.pack(self.view.format, value)
9965 *
9966 * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
9967 * itemp[i] = c
9968 *
9969 */
9970 __pyx_t_9 = (__pyx_t_9 + 1);
9971
9972 /* "View.MemoryView":515
9973 *
9974 * for i, c in enumerate(bytesvalue):
9975 * itemp[i] = c # <<<<<<<<<<<<<<
9976 *
9977 * @cname('getbuffer')
9978 */
9979 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
9980 }
9981 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9982
9983 /* "View.MemoryView":501
9984 * return result
9985 *
9986 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
9987 * """Only used if instantiated manually by the user, or if Cython doesn't
9988 * know how to convert the type"""
9989 */
9990
9991 /* function exit code */
9992 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9993 goto __pyx_L0;
9994 __pyx_L1_error:;
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);
10002 __pyx_r = 0;
10003 __pyx_L0:;
10004 __Pyx_XDECREF(__pyx_v_struct);
10005 __Pyx_XDECREF(__pyx_v_bytesvalue);
10006 __Pyx_XGIVEREF(__pyx_r);
10007 __Pyx_RefNannyFinishContext();
10008 return __pyx_r;
10009}
10010
10011/* "View.MemoryView":518
10012 *
10013 * @cname('getbuffer')
10014 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
10015 * if flags & PyBUF_WRITABLE and self.view.readonly:
10016 * raise ValueError("Cannot create writable memory view from read-only memoryview")
10017 */
10018
10019/* Python wrapper */
10020static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
10021static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
10022 int __pyx_r;
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));
10026
10027 /* function exit code */
10028 __Pyx_RefNannyFinishContext();
10029 return __pyx_r;
10030}
10031
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) {
10033 int __pyx_r;
10034 __Pyx_RefNannyDeclarations
10035 int __pyx_t_1;
10036 int __pyx_t_2;
10037 PyObject *__pyx_t_3 = NULL;
10038 Py_ssize_t *__pyx_t_4;
10039 char *__pyx_t_5;
10040 void *__pyx_t_6;
10041 int __pyx_t_7;
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");
10048 return -1;
10049 }
10050 __Pyx_RefNannySetupContext("__getbuffer__", 0);
10051 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
10052 __Pyx_GIVEREF(__pyx_v_info->obj);
10053
10054 /* "View.MemoryView":519
10055 * @cname('getbuffer')
10056 * def __getbuffer__(self, Py_buffer *info, int flags):
10057 * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
10058 * raise ValueError("Cannot create writable memory view from read-only memoryview")
10059 *
10060 */
10061 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
10062 if (__pyx_t_2) {
10063 } else {
10064 __pyx_t_1 = __pyx_t_2;
10065 goto __pyx_L4_bool_binop_done;
10066 }
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)) {
10071
10072 /* "View.MemoryView":520
10073 * def __getbuffer__(self, Py_buffer *info, int flags):
10074 * if flags & PyBUF_WRITABLE and self.view.readonly:
10075 * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
10076 *
10077 * if flags & PyBUF_ND:
10078 */
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)
10084
10085 /* "View.MemoryView":519
10086 * @cname('getbuffer')
10087 * def __getbuffer__(self, Py_buffer *info, int flags):
10088 * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
10089 * raise ValueError("Cannot create writable memory view from read-only memoryview")
10090 *
10091 */
10092 }
10093
10094 /* "View.MemoryView":522
10095 * raise ValueError("Cannot create writable memory view from read-only memoryview")
10096 *
10097 * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
10098 * info.shape = self.view.shape
10099 * else:
10100 */
10101 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
10102 if (__pyx_t_1) {
10103
10104 /* "View.MemoryView":523
10105 *
10106 * if flags & PyBUF_ND:
10107 * info.shape = self.view.shape # <<<<<<<<<<<<<<
10108 * else:
10109 * info.shape = NULL
10110 */
10111 __pyx_t_4 = __pyx_v_self->view.shape;
10112 __pyx_v_info->shape = __pyx_t_4;
10113
10114 /* "View.MemoryView":522
10115 * raise ValueError("Cannot create writable memory view from read-only memoryview")
10116 *
10117 * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
10118 * info.shape = self.view.shape
10119 * else:
10120 */
10121 goto __pyx_L6;
10122 }
10123
10124 /* "View.MemoryView":525
10125 * info.shape = self.view.shape
10126 * else:
10127 * info.shape = NULL # <<<<<<<<<<<<<<
10128 *
10129 * if flags & PyBUF_STRIDES:
10130 */
10131 /*else*/ {
10132 __pyx_v_info->shape = NULL;
10133 }
10134 __pyx_L6:;
10135
10136 /* "View.MemoryView":527
10137 * info.shape = NULL
10138 *
10139 * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
10140 * info.strides = self.view.strides
10141 * else:
10142 */
10143 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
10144 if (__pyx_t_1) {
10145
10146 /* "View.MemoryView":528
10147 *
10148 * if flags & PyBUF_STRIDES:
10149 * info.strides = self.view.strides # <<<<<<<<<<<<<<
10150 * else:
10151 * info.strides = NULL
10152 */
10153 __pyx_t_4 = __pyx_v_self->view.strides;
10154 __pyx_v_info->strides = __pyx_t_4;
10155
10156 /* "View.MemoryView":527
10157 * info.shape = NULL
10158 *
10159 * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
10160 * info.strides = self.view.strides
10161 * else:
10162 */
10163 goto __pyx_L7;
10164 }
10165
10166 /* "View.MemoryView":530
10167 * info.strides = self.view.strides
10168 * else:
10169 * info.strides = NULL # <<<<<<<<<<<<<<
10170 *
10171 * if flags & PyBUF_INDIRECT:
10172 */
10173 /*else*/ {
10174 __pyx_v_info->strides = NULL;
10175 }
10176 __pyx_L7:;
10177
10178 /* "View.MemoryView":532
10179 * info.strides = NULL
10180 *
10181 * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
10182 * info.suboffsets = self.view.suboffsets
10183 * else:
10184 */
10185 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
10186 if (__pyx_t_1) {
10187
10188 /* "View.MemoryView":533
10189 *
10190 * if flags & PyBUF_INDIRECT:
10191 * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
10192 * else:
10193 * info.suboffsets = NULL
10194 */
10195 __pyx_t_4 = __pyx_v_self->view.suboffsets;
10196 __pyx_v_info->suboffsets = __pyx_t_4;
10197
10198 /* "View.MemoryView":532
10199 * info.strides = NULL
10200 *
10201 * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
10202 * info.suboffsets = self.view.suboffsets
10203 * else:
10204 */
10205 goto __pyx_L8;
10206 }
10207
10208 /* "View.MemoryView":535
10209 * info.suboffsets = self.view.suboffsets
10210 * else:
10211 * info.suboffsets = NULL # <<<<<<<<<<<<<<
10212 *
10213 * if flags & PyBUF_FORMAT:
10214 */
10215 /*else*/ {
10216 __pyx_v_info->suboffsets = NULL;
10217 }
10218 __pyx_L8:;
10219
10220 /* "View.MemoryView":537
10221 * info.suboffsets = NULL
10222 *
10223 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
10224 * info.format = self.view.format
10225 * else:
10226 */
10227 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10228 if (__pyx_t_1) {
10229
10230 /* "View.MemoryView":538
10231 *
10232 * if flags & PyBUF_FORMAT:
10233 * info.format = self.view.format # <<<<<<<<<<<<<<
10234 * else:
10235 * info.format = NULL
10236 */
10237 __pyx_t_5 = __pyx_v_self->view.format;
10238 __pyx_v_info->format = __pyx_t_5;
10239
10240 /* "View.MemoryView":537
10241 * info.suboffsets = NULL
10242 *
10243 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
10244 * info.format = self.view.format
10245 * else:
10246 */
10247 goto __pyx_L9;
10248 }
10249
10250 /* "View.MemoryView":540
10251 * info.format = self.view.format
10252 * else:
10253 * info.format = NULL # <<<<<<<<<<<<<<
10254 *
10255 * info.buf = self.view.buf
10256 */
10257 /*else*/ {
10258 __pyx_v_info->format = NULL;
10259 }
10260 __pyx_L9:;
10261
10262 /* "View.MemoryView":542
10263 * info.format = NULL
10264 *
10265 * info.buf = self.view.buf # <<<<<<<<<<<<<<
10266 * info.ndim = self.view.ndim
10267 * info.itemsize = self.view.itemsize
10268 */
10269 __pyx_t_6 = __pyx_v_self->view.buf;
10270 __pyx_v_info->buf = __pyx_t_6;
10271
10272 /* "View.MemoryView":543
10273 *
10274 * info.buf = self.view.buf
10275 * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
10276 * info.itemsize = self.view.itemsize
10277 * info.len = self.view.len
10278 */
10279 __pyx_t_7 = __pyx_v_self->view.ndim;
10280 __pyx_v_info->ndim = __pyx_t_7;
10281
10282 /* "View.MemoryView":544
10283 * info.buf = self.view.buf
10284 * info.ndim = self.view.ndim
10285 * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
10286 * info.len = self.view.len
10287 * info.readonly = self.view.readonly
10288 */
10289 __pyx_t_8 = __pyx_v_self->view.itemsize;
10290 __pyx_v_info->itemsize = __pyx_t_8;
10291
10292 /* "View.MemoryView":545
10293 * info.ndim = self.view.ndim
10294 * info.itemsize = self.view.itemsize
10295 * info.len = self.view.len # <<<<<<<<<<<<<<
10296 * info.readonly = self.view.readonly
10297 * info.obj = self
10298 */
10299 __pyx_t_8 = __pyx_v_self->view.len;
10300 __pyx_v_info->len = __pyx_t_8;
10301
10302 /* "View.MemoryView":546
10303 * info.itemsize = self.view.itemsize
10304 * info.len = self.view.len
10305 * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
10306 * info.obj = self
10307 *
10308 */
10309 __pyx_t_1 = __pyx_v_self->view.readonly;
10310 __pyx_v_info->readonly = __pyx_t_1;
10311
10312 /* "View.MemoryView":547
10313 * info.len = self.view.len
10314 * info.readonly = self.view.readonly
10315 * info.obj = self # <<<<<<<<<<<<<<
10316 *
10317 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
10318 */
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);
10324
10325 /* "View.MemoryView":518
10326 *
10327 * @cname('getbuffer')
10328 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
10329 * if flags & PyBUF_WRITABLE and self.view.readonly:
10330 * raise ValueError("Cannot create writable memory view from read-only memoryview")
10331 */
10332
10333 /* function exit code */
10334 __pyx_r = 0;
10335 goto __pyx_L0;
10336 __pyx_L1_error:;
10337 __Pyx_XDECREF(__pyx_t_3);
10338 __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10339 __pyx_r = -1;
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;
10343 }
10344 goto __pyx_L2;
10345 __pyx_L0:;
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;
10349 }
10350 __pyx_L2:;
10351 __Pyx_RefNannyFinishContext();
10352 return __pyx_r;
10353}
10354
10355/* "View.MemoryView":553
10356 *
10357 * @property
10358 * def T(self): # <<<<<<<<<<<<<<
10359 * cdef _memoryviewslice result = memoryview_copy(self)
10360 * transpose_memslice(&result.from_slice)
10361 */
10362
10363/* Python wrapper */
10364static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
10370
10371 /* function exit code */
10372 __Pyx_RefNannyFinishContext();
10373 return __pyx_r;
10374}
10375
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;
10381 int __pyx_t_2;
10382 int __pyx_lineno = 0;
10383 const char *__pyx_filename = NULL;
10384 int __pyx_clineno = 0;
10385 __Pyx_RefNannySetupContext("__get__", 0);
10386
10387 /* "View.MemoryView":554
10388 * @property
10389 * def T(self):
10390 * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
10391 * transpose_memslice(&result.from_slice)
10392 * return result
10393 */
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);
10398 __pyx_t_1 = 0;
10399
10400 /* "View.MemoryView":555
10401 * def T(self):
10402 * cdef _memoryviewslice result = memoryview_copy(self)
10403 * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
10404 * return result
10405 *
10406 */
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)
10408
10409 /* "View.MemoryView":556
10410 * cdef _memoryviewslice result = memoryview_copy(self)
10411 * transpose_memslice(&result.from_slice)
10412 * return result # <<<<<<<<<<<<<<
10413 *
10414 * @property
10415 */
10416 __Pyx_XDECREF(__pyx_r);
10417 __Pyx_INCREF(((PyObject *)__pyx_v_result));
10418 __pyx_r = ((PyObject *)__pyx_v_result);
10419 goto __pyx_L0;
10420
10421 /* "View.MemoryView":553
10422 *
10423 * @property
10424 * def T(self): # <<<<<<<<<<<<<<
10425 * cdef _memoryviewslice result = memoryview_copy(self)
10426 * transpose_memslice(&result.from_slice)
10427 */
10428
10429 /* function exit code */
10430 __pyx_L1_error:;
10431 __Pyx_XDECREF(__pyx_t_1);
10432 __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10433 __pyx_r = NULL;
10434 __pyx_L0:;
10435 __Pyx_XDECREF((PyObject *)__pyx_v_result);
10436 __Pyx_XGIVEREF(__pyx_r);
10437 __Pyx_RefNannyFinishContext();
10438 return __pyx_r;
10439}
10440
10441/* "View.MemoryView":559
10442 *
10443 * @property
10444 * def base(self): # <<<<<<<<<<<<<<
10445 * return self.obj
10446 *
10447 */
10448
10449/* Python wrapper */
10450static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
10456
10457 /* function exit code */
10458 __Pyx_RefNannyFinishContext();
10459 return __pyx_r;
10460}
10461
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);
10466
10467 /* "View.MemoryView":560
10468 * @property
10469 * def base(self):
10470 * return self.obj # <<<<<<<<<<<<<<
10471 *
10472 * @property
10473 */
10474 __Pyx_XDECREF(__pyx_r);
10475 __Pyx_INCREF(__pyx_v_self->obj);
10476 __pyx_r = __pyx_v_self->obj;
10477 goto __pyx_L0;
10478
10479 /* "View.MemoryView":559
10480 *
10481 * @property
10482 * def base(self): # <<<<<<<<<<<<<<
10483 * return self.obj
10484 *
10485 */
10486
10487 /* function exit code */
10488 __pyx_L0:;
10489 __Pyx_XGIVEREF(__pyx_r);
10490 __Pyx_RefNannyFinishContext();
10491 return __pyx_r;
10492}
10493
10494/* "View.MemoryView":563
10495 *
10496 * @property
10497 * def shape(self): # <<<<<<<<<<<<<<
10498 * return tuple([length for length in self.view.shape[:self.view.ndim]])
10499 *
10500 */
10501
10502/* Python wrapper */
10503static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
10509
10510 /* function exit code */
10511 __Pyx_RefNannyFinishContext();
10512 return __pyx_r;
10513}
10514
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);
10528
10529 /* "View.MemoryView":564
10530 * @property
10531 * def shape(self):
10532 * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
10533 *
10534 * @property
10535 */
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;
10547 }
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;
10552 __pyx_t_5 = 0;
10553 goto __pyx_L0;
10554
10555 /* "View.MemoryView":563
10556 *
10557 * @property
10558 * def shape(self): # <<<<<<<<<<<<<<
10559 * return tuple([length for length in self.view.shape[:self.view.ndim]])
10560 *
10561 */
10562
10563 /* function exit code */
10564 __pyx_L1_error:;
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);
10568 __pyx_r = NULL;
10569 __pyx_L0:;
10570 __Pyx_XGIVEREF(__pyx_r);
10571 __Pyx_RefNannyFinishContext();
10572 return __pyx_r;
10573}
10574
10575/* "View.MemoryView":567
10576 *
10577 * @property
10578 * def strides(self): # <<<<<<<<<<<<<<
10579 * if self.view.strides == NULL:
10580 *
10581 */
10582
10583/* Python wrapper */
10584static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
10590
10591 /* function exit code */
10592 __Pyx_RefNannyFinishContext();
10593 return __pyx_r;
10594}
10595
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
10600 int __pyx_t_1;
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);
10610
10611 /* "View.MemoryView":568
10612 * @property
10613 * def strides(self):
10614 * if self.view.strides == NULL: # <<<<<<<<<<<<<<
10615 *
10616 * raise ValueError("Buffer view does not expose strides")
10617 */
10618 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
10619 if (unlikely(__pyx_t_1)) {
10620
10621 /* "View.MemoryView":570
10622 * if self.view.strides == NULL:
10623 *
10624 * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
10625 *
10626 * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
10627 */
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)
10633
10634 /* "View.MemoryView":568
10635 * @property
10636 * def strides(self):
10637 * if self.view.strides == NULL: # <<<<<<<<<<<<<<
10638 *
10639 * raise ValueError("Buffer view does not expose strides")
10640 */
10641 }
10642
10643 /* "View.MemoryView":572
10644 * raise ValueError("Buffer view does not expose strides")
10645 *
10646 * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
10647 *
10648 * @property
10649 */
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;
10661 }
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;
10666 __pyx_t_6 = 0;
10667 goto __pyx_L0;
10668
10669 /* "View.MemoryView":567
10670 *
10671 * @property
10672 * def strides(self): # <<<<<<<<<<<<<<
10673 * if self.view.strides == NULL:
10674 *
10675 */
10676
10677 /* function exit code */
10678 __pyx_L1_error:;
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);
10682 __pyx_r = NULL;
10683 __pyx_L0:;
10684 __Pyx_XGIVEREF(__pyx_r);
10685 __Pyx_RefNannyFinishContext();
10686 return __pyx_r;
10687}
10688
10689/* "View.MemoryView":575
10690 *
10691 * @property
10692 * def suboffsets(self): # <<<<<<<<<<<<<<
10693 * if self.view.suboffsets == NULL:
10694 * return (-1,) * self.view.ndim
10695 */
10696
10697/* Python wrapper */
10698static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
10704
10705 /* function exit code */
10706 __Pyx_RefNannyFinishContext();
10707 return __pyx_r;
10708}
10709
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
10714 int __pyx_t_1;
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);
10724
10725 /* "View.MemoryView":576
10726 * @property
10727 * def suboffsets(self):
10728 * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
10729 * return (-1,) * self.view.ndim
10730 *
10731 */
10732 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
10733 if (__pyx_t_1) {
10734
10735 /* "View.MemoryView":577
10736 * def suboffsets(self):
10737 * if self.view.suboffsets == NULL:
10738 * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
10739 *
10740 * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
10741 */
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;
10749 __pyx_t_3 = 0;
10750 goto __pyx_L0;
10751
10752 /* "View.MemoryView":576
10753 * @property
10754 * def suboffsets(self):
10755 * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
10756 * return (-1,) * self.view.ndim
10757 *
10758 */
10759 }
10760
10761 /* "View.MemoryView":579
10762 * return (-1,) * self.view.ndim
10763 *
10764 * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
10765 *
10766 * @property
10767 */
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;
10779 }
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;
10784 __pyx_t_2 = 0;
10785 goto __pyx_L0;
10786
10787 /* "View.MemoryView":575
10788 *
10789 * @property
10790 * def suboffsets(self): # <<<<<<<<<<<<<<
10791 * if self.view.suboffsets == NULL:
10792 * return (-1,) * self.view.ndim
10793 */
10794
10795 /* function exit code */
10796 __pyx_L1_error:;
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);
10800 __pyx_r = NULL;
10801 __pyx_L0:;
10802 __Pyx_XGIVEREF(__pyx_r);
10803 __Pyx_RefNannyFinishContext();
10804 return __pyx_r;
10805}
10806
10807/* "View.MemoryView":582
10808 *
10809 * @property
10810 * def ndim(self): # <<<<<<<<<<<<<<
10811 * return self.view.ndim
10812 *
10813 */
10814
10815/* Python wrapper */
10816static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
10822
10823 /* function exit code */
10824 __Pyx_RefNannyFinishContext();
10825 return __pyx_r;
10826}
10827
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);
10836
10837 /* "View.MemoryView":583
10838 * @property
10839 * def ndim(self):
10840 * return self.view.ndim # <<<<<<<<<<<<<<
10841 *
10842 * @property
10843 */
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;
10848 __pyx_t_1 = 0;
10849 goto __pyx_L0;
10850
10851 /* "View.MemoryView":582
10852 *
10853 * @property
10854 * def ndim(self): # <<<<<<<<<<<<<<
10855 * return self.view.ndim
10856 *
10857 */
10858
10859 /* function exit code */
10860 __pyx_L1_error:;
10861 __Pyx_XDECREF(__pyx_t_1);
10862 __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10863 __pyx_r = NULL;
10864 __pyx_L0:;
10865 __Pyx_XGIVEREF(__pyx_r);
10866 __Pyx_RefNannyFinishContext();
10867 return __pyx_r;
10868}
10869
10870/* "View.MemoryView":586
10871 *
10872 * @property
10873 * def itemsize(self): # <<<<<<<<<<<<<<
10874 * return self.view.itemsize
10875 *
10876 */
10877
10878/* Python wrapper */
10879static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
10885
10886 /* function exit code */
10887 __Pyx_RefNannyFinishContext();
10888 return __pyx_r;
10889}
10890
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);
10899
10900 /* "View.MemoryView":587
10901 * @property
10902 * def itemsize(self):
10903 * return self.view.itemsize # <<<<<<<<<<<<<<
10904 *
10905 * @property
10906 */
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;
10911 __pyx_t_1 = 0;
10912 goto __pyx_L0;
10913
10914 /* "View.MemoryView":586
10915 *
10916 * @property
10917 * def itemsize(self): # <<<<<<<<<<<<<<
10918 * return self.view.itemsize
10919 *
10920 */
10921
10922 /* function exit code */
10923 __pyx_L1_error:;
10924 __Pyx_XDECREF(__pyx_t_1);
10925 __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10926 __pyx_r = NULL;
10927 __pyx_L0:;
10928 __Pyx_XGIVEREF(__pyx_r);
10929 __Pyx_RefNannyFinishContext();
10930 return __pyx_r;
10931}
10932
10933/* "View.MemoryView":590
10934 *
10935 * @property
10936 * def nbytes(self): # <<<<<<<<<<<<<<
10937 * return self.size * self.view.itemsize
10938 *
10939 */
10940
10941/* Python wrapper */
10942static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
10948
10949 /* function exit code */
10950 __Pyx_RefNannyFinishContext();
10951 return __pyx_r;
10952}
10953
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);
10964
10965 /* "View.MemoryView":591
10966 * @property
10967 * def nbytes(self):
10968 * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
10969 *
10970 * @property
10971 */
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;
10982 __pyx_t_3 = 0;
10983 goto __pyx_L0;
10984
10985 /* "View.MemoryView":590
10986 *
10987 * @property
10988 * def nbytes(self): # <<<<<<<<<<<<<<
10989 * return self.size * self.view.itemsize
10990 *
10991 */
10992
10993 /* function exit code */
10994 __pyx_L1_error:;
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);
10999 __pyx_r = NULL;
11000 __pyx_L0:;
11001 __Pyx_XGIVEREF(__pyx_r);
11002 __Pyx_RefNannyFinishContext();
11003 return __pyx_r;
11004}
11005
11006/* "View.MemoryView":594
11007 *
11008 * @property
11009 * def size(self): # <<<<<<<<<<<<<<
11010 * if self._size is None:
11011 * result = 1
11012 */
11013
11014/* Python wrapper */
11015static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
11021
11022 /* function exit code */
11023 __Pyx_RefNannyFinishContext();
11024 return __pyx_r;
11025}
11026
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
11032 int __pyx_t_1;
11033 int __pyx_t_2;
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);
11042
11043 /* "View.MemoryView":595
11044 * @property
11045 * def size(self):
11046 * if self._size is None: # <<<<<<<<<<<<<<
11047 * result = 1
11048 *
11049 */
11050 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
11051 __pyx_t_2 = (__pyx_t_1 != 0);
11052 if (__pyx_t_2) {
11053
11054 /* "View.MemoryView":596
11055 * def size(self):
11056 * if self._size is None:
11057 * result = 1 # <<<<<<<<<<<<<<
11058 *
11059 * for length in self.view.shape[:self.view.ndim]:
11060 */
11061 __Pyx_INCREF(__pyx_int_1);
11062 __pyx_v_result = __pyx_int_1;
11063
11064 /* "View.MemoryView":598
11065 * result = 1
11066 *
11067 * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
11068 * result *= length
11069 *
11070 */
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);
11077 __pyx_t_6 = 0;
11078
11079 /* "View.MemoryView":599
11080 *
11081 * for length in self.view.shape[:self.view.ndim]:
11082 * result *= length # <<<<<<<<<<<<<<
11083 *
11084 * self._size = result
11085 */
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);
11089 __pyx_t_6 = 0;
11090 }
11091
11092 /* "View.MemoryView":601
11093 * result *= length
11094 *
11095 * self._size = result # <<<<<<<<<<<<<<
11096 *
11097 * return self._size
11098 */
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;
11104
11105 /* "View.MemoryView":595
11106 * @property
11107 * def size(self):
11108 * if self._size is None: # <<<<<<<<<<<<<<
11109 * result = 1
11110 *
11111 */
11112 }
11113
11114 /* "View.MemoryView":603
11115 * self._size = result
11116 *
11117 * return self._size # <<<<<<<<<<<<<<
11118 *
11119 * def __len__(self):
11120 */
11121 __Pyx_XDECREF(__pyx_r);
11122 __Pyx_INCREF(__pyx_v_self->_size);
11123 __pyx_r = __pyx_v_self->_size;
11124 goto __pyx_L0;
11125
11126 /* "View.MemoryView":594
11127 *
11128 * @property
11129 * def size(self): # <<<<<<<<<<<<<<
11130 * if self._size is None:
11131 * result = 1
11132 */
11133
11134 /* function exit code */
11135 __pyx_L1_error:;
11136 __Pyx_XDECREF(__pyx_t_6);
11137 __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11138 __pyx_r = NULL;
11139 __pyx_L0:;
11140 __Pyx_XDECREF(__pyx_v_result);
11141 __Pyx_XDECREF(__pyx_v_length);
11142 __Pyx_XGIVEREF(__pyx_r);
11143 __Pyx_RefNannyFinishContext();
11144 return __pyx_r;
11145}
11146
11147/* "View.MemoryView":605
11148 * return self._size
11149 *
11150 * def __len__(self): # <<<<<<<<<<<<<<
11151 * if self.view.ndim >= 1:
11152 * return self.view.shape[0]
11153 */
11154
11155/* Python wrapper */
11156static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
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));
11162
11163 /* function exit code */
11164 __Pyx_RefNannyFinishContext();
11165 return __pyx_r;
11166}
11167
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
11171 int __pyx_t_1;
11172 __Pyx_RefNannySetupContext("__len__", 0);
11173
11174 /* "View.MemoryView":606
11175 *
11176 * def __len__(self):
11177 * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
11178 * return self.view.shape[0]
11179 *
11180 */
11181 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
11182 if (__pyx_t_1) {
11183
11184 /* "View.MemoryView":607
11185 * def __len__(self):
11186 * if self.view.ndim >= 1:
11187 * return self.view.shape[0] # <<<<<<<<<<<<<<
11188 *
11189 * return 0
11190 */
11191 __pyx_r = (__pyx_v_self->view.shape[0]);
11192 goto __pyx_L0;
11193
11194 /* "View.MemoryView":606
11195 *
11196 * def __len__(self):
11197 * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
11198 * return self.view.shape[0]
11199 *
11200 */
11201 }
11202
11203 /* "View.MemoryView":609
11204 * return self.view.shape[0]
11205 *
11206 * return 0 # <<<<<<<<<<<<<<
11207 *
11208 * def __repr__(self):
11209 */
11210 __pyx_r = 0;
11211 goto __pyx_L0;
11212
11213 /* "View.MemoryView":605
11214 * return self._size
11215 *
11216 * def __len__(self): # <<<<<<<<<<<<<<
11217 * if self.view.ndim >= 1:
11218 * return self.view.shape[0]
11219 */
11220
11221 /* function exit code */
11222 __pyx_L0:;
11223 __Pyx_RefNannyFinishContext();
11224 return __pyx_r;
11225}
11226
11227/* "View.MemoryView":611
11228 * return 0
11229 *
11230 * def __repr__(self): # <<<<<<<<<<<<<<
11231 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
11232 * id(self))
11233 */
11234
11235/* Python wrapper */
11236static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
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));
11242
11243 /* function exit code */
11244 __Pyx_RefNannyFinishContext();
11245 return __pyx_r;
11246}
11247
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);
11258
11259 /* "View.MemoryView":612
11260 *
11261 * def __repr__(self):
11262 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
11263 * id(self))
11264 *
11265 */
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;
11275
11276 /* "View.MemoryView":613
11277 * def __repr__(self):
11278 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
11279 * id(self)) # <<<<<<<<<<<<<<
11280 *
11281 * def __str__(self):
11282 */
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);
11285
11286 /* "View.MemoryView":612
11287 *
11288 * def __repr__(self):
11289 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
11290 * id(self))
11291 *
11292 */
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);
11299 __pyx_t_1 = 0;
11300 __pyx_t_2 = 0;
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;
11305 __pyx_t_2 = 0;
11306 goto __pyx_L0;
11307
11308 /* "View.MemoryView":611
11309 * return 0
11310 *
11311 * def __repr__(self): # <<<<<<<<<<<<<<
11312 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
11313 * id(self))
11314 */
11315
11316 /* function exit code */
11317 __pyx_L1_error:;
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);
11322 __pyx_r = NULL;
11323 __pyx_L0:;
11324 __Pyx_XGIVEREF(__pyx_r);
11325 __Pyx_RefNannyFinishContext();
11326 return __pyx_r;
11327}
11328
11329/* "View.MemoryView":615
11330 * id(self))
11331 *
11332 * def __str__(self): # <<<<<<<<<<<<<<
11333 * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
11334 *
11335 */
11336
11337/* Python wrapper */
11338static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
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));
11344
11345 /* function exit code */
11346 __Pyx_RefNannyFinishContext();
11347 return __pyx_r;
11348}
11349
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);
11359
11360 /* "View.MemoryView":616
11361 *
11362 * def __str__(self):
11363 * return "<MemoryView of %r object>" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
11364 *
11365 *
11366 */
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);
11380 __pyx_t_1 = 0;
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;
11385 __pyx_t_1 = 0;
11386 goto __pyx_L0;
11387
11388 /* "View.MemoryView":615
11389 * id(self))
11390 *
11391 * def __str__(self): # <<<<<<<<<<<<<<
11392 * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
11393 *
11394 */
11395
11396 /* function exit code */
11397 __pyx_L1_error:;
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);
11401 __pyx_r = NULL;
11402 __pyx_L0:;
11403 __Pyx_XGIVEREF(__pyx_r);
11404 __Pyx_RefNannyFinishContext();
11405 return __pyx_r;
11406}
11407
11408/* "View.MemoryView":619
11409 *
11410 *
11411 * def is_c_contig(self): # <<<<<<<<<<<<<<
11412 * cdef __Pyx_memviewslice *mslice
11413 * cdef __Pyx_memviewslice tmp
11414 */
11415
11416/* Python wrapper */
11417static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
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));
11423
11424 /* function exit code */
11425 __Pyx_RefNannyFinishContext();
11426 return __pyx_r;
11427}
11428
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);
11440
11441 /* "View.MemoryView":622
11442 * cdef __Pyx_memviewslice *mslice
11443 * cdef __Pyx_memviewslice tmp
11444 * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
11445 * return slice_is_contig(mslice[0], 'C', self.view.ndim)
11446 *
11447 */
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;
11450
11451 /* "View.MemoryView":623
11452 * cdef __Pyx_memviewslice tmp
11453 * mslice = get_slice_from_memview(self, &tmp)
11454 * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
11455 *
11456 * def is_f_contig(self):
11457 */
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;
11462 __pyx_t_2 = 0;
11463 goto __pyx_L0;
11464
11465 /* "View.MemoryView":619
11466 *
11467 *
11468 * def is_c_contig(self): # <<<<<<<<<<<<<<
11469 * cdef __Pyx_memviewslice *mslice
11470 * cdef __Pyx_memviewslice tmp
11471 */
11472
11473 /* function exit code */
11474 __pyx_L1_error:;
11475 __Pyx_XDECREF(__pyx_t_2);
11476 __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
11477 __pyx_r = NULL;
11478 __pyx_L0:;
11479 __Pyx_XGIVEREF(__pyx_r);
11480 __Pyx_RefNannyFinishContext();
11481 return __pyx_r;
11482}
11483
11484/* "View.MemoryView":625
11485 * return slice_is_contig(mslice[0], 'C', self.view.ndim)
11486 *
11487 * def is_f_contig(self): # <<<<<<<<<<<<<<
11488 * cdef __Pyx_memviewslice *mslice
11489 * cdef __Pyx_memviewslice tmp
11490 */
11491
11492/* Python wrapper */
11493static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
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));
11499
11500 /* function exit code */
11501 __Pyx_RefNannyFinishContext();
11502 return __pyx_r;
11503}
11504
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);
11516
11517 /* "View.MemoryView":628
11518 * cdef __Pyx_memviewslice *mslice
11519 * cdef __Pyx_memviewslice tmp
11520 * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
11521 * return slice_is_contig(mslice[0], 'F', self.view.ndim)
11522 *
11523 */
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;
11526
11527 /* "View.MemoryView":629
11528 * cdef __Pyx_memviewslice tmp
11529 * mslice = get_slice_from_memview(self, &tmp)
11530 * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
11531 *
11532 * def copy(self):
11533 */
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;
11538 __pyx_t_2 = 0;
11539 goto __pyx_L0;
11540
11541 /* "View.MemoryView":625
11542 * return slice_is_contig(mslice[0], 'C', self.view.ndim)
11543 *
11544 * def is_f_contig(self): # <<<<<<<<<<<<<<
11545 * cdef __Pyx_memviewslice *mslice
11546 * cdef __Pyx_memviewslice tmp
11547 */
11548
11549 /* function exit code */
11550 __pyx_L1_error:;
11551 __Pyx_XDECREF(__pyx_t_2);
11552 __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
11553 __pyx_r = NULL;
11554 __pyx_L0:;
11555 __Pyx_XGIVEREF(__pyx_r);
11556 __Pyx_RefNannyFinishContext();
11557 return __pyx_r;
11558}
11559
11560/* "View.MemoryView":631
11561 * return slice_is_contig(mslice[0], 'F', self.view.ndim)
11562 *
11563 * def copy(self): # <<<<<<<<<<<<<<
11564 * cdef __Pyx_memviewslice mslice
11565 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
11566 */
11567
11568/* Python wrapper */
11569static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
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));
11575
11576 /* function exit code */
11577 __Pyx_RefNannyFinishContext();
11578 return __pyx_r;
11579}
11580
11581static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
11582 __Pyx_memviewslice __pyx_v_mslice;
11583 int __pyx_v_flags;
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);
11592
11593 /* "View.MemoryView":633
11594 * def copy(self):
11595 * cdef __Pyx_memviewslice mslice
11596 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
11597 *
11598 * slice_copy(self, &mslice)
11599 */
11600 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
11601
11602 /* "View.MemoryView":635
11603 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
11604 *
11605 * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
11606 * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
11607 * self.view.itemsize,
11608 */
11609 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
11610
11611 /* "View.MemoryView":636
11612 *
11613 * slice_copy(self, &mslice)
11614 * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
11615 * self.view.itemsize,
11616 * flags|PyBUF_C_CONTIGUOUS,
11617 */
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;
11620
11621 /* "View.MemoryView":641
11622 * self.dtype_is_object)
11623 *
11624 * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
11625 *
11626 * def copy_fortran(self):
11627 */
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;
11632 __pyx_t_2 = 0;
11633 goto __pyx_L0;
11634
11635 /* "View.MemoryView":631
11636 * return slice_is_contig(mslice[0], 'F', self.view.ndim)
11637 *
11638 * def copy(self): # <<<<<<<<<<<<<<
11639 * cdef __Pyx_memviewslice mslice
11640 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
11641 */
11642
11643 /* function exit code */
11644 __pyx_L1_error:;
11645 __Pyx_XDECREF(__pyx_t_2);
11646 __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
11647 __pyx_r = NULL;
11648 __pyx_L0:;
11649 __Pyx_XGIVEREF(__pyx_r);
11650 __Pyx_RefNannyFinishContext();
11651 return __pyx_r;
11652}
11653
11654/* "View.MemoryView":643
11655 * return memoryview_copy_from_slice(self, &mslice)
11656 *
11657 * def copy_fortran(self): # <<<<<<<<<<<<<<
11658 * cdef __Pyx_memviewslice src, dst
11659 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
11660 */
11661
11662/* Python wrapper */
11663static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
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));
11669
11670 /* function exit code */
11671 __Pyx_RefNannyFinishContext();
11672 return __pyx_r;
11673}
11674
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;
11678 int __pyx_v_flags;
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);
11687
11688 /* "View.MemoryView":645
11689 * def copy_fortran(self):
11690 * cdef __Pyx_memviewslice src, dst
11691 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
11692 *
11693 * slice_copy(self, &src)
11694 */
11695 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
11696
11697 /* "View.MemoryView":647
11698 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
11699 *
11700 * slice_copy(self, &src) # <<<<<<<<<<<<<<
11701 * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
11702 * self.view.itemsize,
11703 */
11704 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
11705
11706 /* "View.MemoryView":648
11707 *
11708 * slice_copy(self, &src)
11709 * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
11710 * self.view.itemsize,
11711 * flags|PyBUF_F_CONTIGUOUS,
11712 */
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;
11715
11716 /* "View.MemoryView":653
11717 * self.dtype_is_object)
11718 *
11719 * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
11720 *
11721 *
11722 */
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;
11727 __pyx_t_2 = 0;
11728 goto __pyx_L0;
11729
11730 /* "View.MemoryView":643
11731 * return memoryview_copy_from_slice(self, &mslice)
11732 *
11733 * def copy_fortran(self): # <<<<<<<<<<<<<<
11734 * cdef __Pyx_memviewslice src, dst
11735 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
11736 */
11737
11738 /* function exit code */
11739 __pyx_L1_error:;
11740 __Pyx_XDECREF(__pyx_t_2);
11741 __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
11742 __pyx_r = NULL;
11743 __pyx_L0:;
11744 __Pyx_XGIVEREF(__pyx_r);
11745 __Pyx_RefNannyFinishContext();
11746 return __pyx_r;
11747}
11748
11749/* "(tree fragment)":1
11750 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
11751 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11752 * def __setstate_cython__(self, __pyx_state):
11753 */
11754
11755/* Python wrapper */
11756static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
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));
11762
11763 /* function exit code */
11764 __Pyx_RefNannyFinishContext();
11765 return __pyx_r;
11766}
11767
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);
11776
11777 /* "(tree fragment)":2
11778 * def __reduce_cython__(self):
11779 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
11780 * def __setstate_cython__(self, __pyx_state):
11781 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11782 */
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)
11788
11789 /* "(tree fragment)":1
11790 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
11791 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11792 * def __setstate_cython__(self, __pyx_state):
11793 */
11794
11795 /* function exit code */
11796 __pyx_L1_error:;
11797 __Pyx_XDECREF(__pyx_t_1);
11798 __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11799 __pyx_r = NULL;
11800 __Pyx_XGIVEREF(__pyx_r);
11801 __Pyx_RefNannyFinishContext();
11802 return __pyx_r;
11803}
11804
11805/* "(tree fragment)":3
11806 * def __reduce_cython__(self):
11807 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11808 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
11809 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11810 */
11811
11812/* Python wrapper */
11813static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
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));
11819
11820 /* function exit code */
11821 __Pyx_RefNannyFinishContext();
11822 return __pyx_r;
11823}
11824
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);
11833
11834 /* "(tree fragment)":4
11835 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11836 * def __setstate_cython__(self, __pyx_state):
11837 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
11838 */
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)
11844
11845 /* "(tree fragment)":3
11846 * def __reduce_cython__(self):
11847 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11848 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
11849 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11850 */
11851
11852 /* function exit code */
11853 __pyx_L1_error:;
11854 __Pyx_XDECREF(__pyx_t_1);
11855 __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11856 __pyx_r = NULL;
11857 __Pyx_XGIVEREF(__pyx_r);
11858 __Pyx_RefNannyFinishContext();
11859 return __pyx_r;
11860}
11861
11862/* "View.MemoryView":657
11863 *
11864 * @cname('__pyx_memoryview_new')
11865 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
11866 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
11867 * result.typeinfo = typeinfo
11868 */
11869
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);
11881
11882 /* "View.MemoryView":658
11883 * @cname('__pyx_memoryview_new')
11884 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
11885 * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
11886 * result.typeinfo = typeinfo
11887 * return result
11888 */
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);
11902 __pyx_t_1 = 0;
11903 __pyx_t_2 = 0;
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);
11908 __pyx_t_2 = 0;
11909
11910 /* "View.MemoryView":659
11911 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
11912 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
11913 * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
11914 * return result
11915 *
11916 */
11917 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
11918
11919 /* "View.MemoryView":660
11920 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
11921 * result.typeinfo = typeinfo
11922 * return result # <<<<<<<<<<<<<<
11923 *
11924 * @cname('__pyx_memoryview_check')
11925 */
11926 __Pyx_XDECREF(__pyx_r);
11927 __Pyx_INCREF(((PyObject *)__pyx_v_result));
11928 __pyx_r = ((PyObject *)__pyx_v_result);
11929 goto __pyx_L0;
11930
11931 /* "View.MemoryView":657
11932 *
11933 * @cname('__pyx_memoryview_new')
11934 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
11935 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
11936 * result.typeinfo = typeinfo
11937 */
11938
11939 /* function exit code */
11940 __pyx_L1_error:;
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);
11945 __pyx_r = 0;
11946 __pyx_L0:;
11947 __Pyx_XDECREF((PyObject *)__pyx_v_result);
11948 __Pyx_XGIVEREF(__pyx_r);
11949 __Pyx_RefNannyFinishContext();
11950 return __pyx_r;
11951}
11952
11953/* "View.MemoryView":663
11954 *
11955 * @cname('__pyx_memoryview_check')
11956 * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
11957 * return isinstance(o, memoryview)
11958 *
11959 */
11960
11961static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
11962 int __pyx_r;
11963 __Pyx_RefNannyDeclarations
11964 int __pyx_t_1;
11965 __Pyx_RefNannySetupContext("memoryview_check", 0);
11966
11967 /* "View.MemoryView":664
11968 * @cname('__pyx_memoryview_check')
11969 * cdef inline bint memoryview_check(object o):
11970 * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
11971 *
11972 * cdef tuple _unellipsify(object index, int ndim):
11973 */
11974 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
11975 __pyx_r = __pyx_t_1;
11976 goto __pyx_L0;
11977
11978 /* "View.MemoryView":663
11979 *
11980 * @cname('__pyx_memoryview_check')
11981 * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
11982 * return isinstance(o, memoryview)
11983 *
11984 */
11985
11986 /* function exit code */
11987 __pyx_L0:;
11988 __Pyx_RefNannyFinishContext();
11989 return __pyx_r;
11990}
11991
11992/* "View.MemoryView":666
11993 * return isinstance(o, memoryview)
11994 *
11995 * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
11996 * """
11997 * Replace all ellipses with full slices and fill incomplete indices with
11998 */
11999
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
12010 int __pyx_t_1;
12011 int __pyx_t_2;
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;
12018 int __pyx_t_9;
12019 int __pyx_t_10;
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);
12025
12026 /* "View.MemoryView":671
12027 * full slices.
12028 * """
12029 * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
12030 * tup = (index,)
12031 * else:
12032 */
12033 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
12034 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
12035 if (__pyx_t_2) {
12036
12037 /* "View.MemoryView":672
12038 * """
12039 * if not isinstance(index, tuple):
12040 * tup = (index,) # <<<<<<<<<<<<<<
12041 * else:
12042 * tup = index
12043 */
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;
12050 __pyx_t_3 = 0;
12051
12052 /* "View.MemoryView":671
12053 * full slices.
12054 * """
12055 * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
12056 * tup = (index,)
12057 * else:
12058 */
12059 goto __pyx_L3;
12060 }
12061
12062 /* "View.MemoryView":674
12063 * tup = (index,)
12064 * else:
12065 * tup = index # <<<<<<<<<<<<<<
12066 *
12067 * result = []
12068 */
12069 /*else*/ {
12070 __Pyx_INCREF(__pyx_v_index);
12071 __pyx_v_tup = __pyx_v_index;
12072 }
12073 __pyx_L3:;
12074
12075 /* "View.MemoryView":676
12076 * tup = index
12077 *
12078 * result = [] # <<<<<<<<<<<<<<
12079 * have_slices = False
12080 * seen_ellipsis = False
12081 */
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);
12085 __pyx_t_3 = 0;
12086
12087 /* "View.MemoryView":677
12088 *
12089 * result = []
12090 * have_slices = False # <<<<<<<<<<<<<<
12091 * seen_ellipsis = False
12092 * for idx, item in enumerate(tup):
12093 */
12094 __pyx_v_have_slices = 0;
12095
12096 /* "View.MemoryView":678
12097 * result = []
12098 * have_slices = False
12099 * seen_ellipsis = False # <<<<<<<<<<<<<<
12100 * for idx, item in enumerate(tup):
12101 * if item is Ellipsis:
12102 */
12103 __pyx_v_seen_ellipsis = 0;
12104
12105 /* "View.MemoryView":679
12106 * have_slices = False
12107 * seen_ellipsis = False
12108 * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
12109 * if item is Ellipsis:
12110 * if not seen_ellipsis:
12111 */
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;
12116 __pyx_t_6 = NULL;
12117 } else {
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)
12121 }
12122 for (;;) {
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)
12128 #else
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);
12131 #endif
12132 } else {
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)
12136 #else
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);
12139 #endif
12140 }
12141 } else {
12142 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
12143 if (unlikely(!__pyx_t_7)) {
12144 PyObject* exc_type = PyErr_Occurred();
12145 if (exc_type) {
12146 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12147 else __PYX_ERR(2, 679, __pyx_L1_error)
12148 }
12149 break;
12150 }
12151 __Pyx_GOTREF(__pyx_t_7);
12152 }
12153 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
12154 __pyx_t_7 = 0;
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;
12161 __pyx_t_7 = 0;
12162
12163 /* "View.MemoryView":680
12164 * seen_ellipsis = False
12165 * for idx, item in enumerate(tup):
12166 * if item is Ellipsis: # <<<<<<<<<<<<<<
12167 * if not seen_ellipsis:
12168 * result.extend([slice(None)] * (ndim - len(tup) + 1))
12169 */
12170 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
12171 __pyx_t_1 = (__pyx_t_2 != 0);
12172 if (__pyx_t_1) {
12173
12174 /* "View.MemoryView":681
12175 * for idx, item in enumerate(tup):
12176 * if item is Ellipsis:
12177 * if not seen_ellipsis: # <<<<<<<<<<<<<<
12178 * result.extend([slice(None)] * (ndim - len(tup) + 1))
12179 * seen_ellipsis = True
12180 */
12181 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
12182 if (__pyx_t_1) {
12183
12184 /* "View.MemoryView":682
12185 * if item is Ellipsis:
12186 * if not seen_ellipsis:
12187 * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
12188 * seen_ellipsis = True
12189 * else:
12190 */
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_);
12199 }
12200 }
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;
12203
12204 /* "View.MemoryView":683
12205 * if not seen_ellipsis:
12206 * result.extend([slice(None)] * (ndim - len(tup) + 1))
12207 * seen_ellipsis = True # <<<<<<<<<<<<<<
12208 * else:
12209 * result.append(slice(None))
12210 */
12211 __pyx_v_seen_ellipsis = 1;
12212
12213 /* "View.MemoryView":681
12214 * for idx, item in enumerate(tup):
12215 * if item is Ellipsis:
12216 * if not seen_ellipsis: # <<<<<<<<<<<<<<
12217 * result.extend([slice(None)] * (ndim - len(tup) + 1))
12218 * seen_ellipsis = True
12219 */
12220 goto __pyx_L7;
12221 }
12222
12223 /* "View.MemoryView":685
12224 * seen_ellipsis = True
12225 * else:
12226 * result.append(slice(None)) # <<<<<<<<<<<<<<
12227 * have_slices = True
12228 * else:
12229 */
12230 /*else*/ {
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)
12232 }
12233 __pyx_L7:;
12234
12235 /* "View.MemoryView":686
12236 * else:
12237 * result.append(slice(None))
12238 * have_slices = True # <<<<<<<<<<<<<<
12239 * else:
12240 * if not isinstance(item, slice) and not PyIndex_Check(item):
12241 */
12242 __pyx_v_have_slices = 1;
12243
12244 /* "View.MemoryView":680
12245 * seen_ellipsis = False
12246 * for idx, item in enumerate(tup):
12247 * if item is Ellipsis: # <<<<<<<<<<<<<<
12248 * if not seen_ellipsis:
12249 * result.extend([slice(None)] * (ndim - len(tup) + 1))
12250 */
12251 goto __pyx_L6;
12252 }
12253
12254 /* "View.MemoryView":688
12255 * have_slices = True
12256 * else:
12257 * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
12258 * raise TypeError("Cannot index with type '%s'" % type(item))
12259 *
12260 */
12261 /*else*/ {
12262 __pyx_t_2 = PySlice_Check(__pyx_v_item);
12263 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
12264 if (__pyx_t_10) {
12265 } else {
12266 __pyx_t_1 = __pyx_t_10;
12267 goto __pyx_L9_bool_binop_done;
12268 }
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)) {
12273
12274 /* "View.MemoryView":689
12275 * else:
12276 * if not isinstance(item, slice) and not PyIndex_Check(item):
12277 * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<<
12278 *
12279 * have_slices = have_slices or isinstance(item, slice)
12280 */
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)
12289
12290 /* "View.MemoryView":688
12291 * have_slices = True
12292 * else:
12293 * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
12294 * raise TypeError("Cannot index with type '%s'" % type(item))
12295 *
12296 */
12297 }
12298
12299 /* "View.MemoryView":691
12300 * raise TypeError("Cannot index with type '%s'" % type(item))
12301 *
12302 * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
12303 * result.append(item)
12304 *
12305 */
12306 __pyx_t_10 = (__pyx_v_have_slices != 0);
12307 if (!__pyx_t_10) {
12308 } else {
12309 __pyx_t_1 = __pyx_t_10;
12310 goto __pyx_L11_bool_binop_done;
12311 }
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;
12317
12318 /* "View.MemoryView":692
12319 *
12320 * have_slices = have_slices or isinstance(item, slice)
12321 * result.append(item) # <<<<<<<<<<<<<<
12322 *
12323 * nslices = ndim - len(result)
12324 */
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)
12326 }
12327 __pyx_L6:;
12328
12329 /* "View.MemoryView":679
12330 * have_slices = False
12331 * seen_ellipsis = False
12332 * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
12333 * if item is Ellipsis:
12334 * if not seen_ellipsis:
12335 */
12336 }
12337 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12338 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12339
12340 /* "View.MemoryView":694
12341 * result.append(item)
12342 *
12343 * nslices = ndim - len(result) # <<<<<<<<<<<<<<
12344 * if nslices:
12345 * result.extend([slice(None)] * nslices)
12346 */
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);
12349
12350 /* "View.MemoryView":695
12351 *
12352 * nslices = ndim - len(result)
12353 * if nslices: # <<<<<<<<<<<<<<
12354 * result.extend([slice(None)] * nslices)
12355 *
12356 */
12357 __pyx_t_1 = (__pyx_v_nslices != 0);
12358 if (__pyx_t_1) {
12359
12360 /* "View.MemoryView":696
12361 * nslices = ndim - len(result)
12362 * if nslices:
12363 * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
12364 *
12365 * return have_slices or nslices, tuple(result)
12366 */
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_);
12374 }
12375 }
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;
12378
12379 /* "View.MemoryView":695
12380 *
12381 * nslices = ndim - len(result)
12382 * if nslices: # <<<<<<<<<<<<<<
12383 * result.extend([slice(None)] * nslices)
12384 *
12385 */
12386 }
12387
12388 /* "View.MemoryView":698
12389 * result.extend([slice(None)] * nslices)
12390 *
12391 * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
12392 *
12393 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
12394 */
12395 __Pyx_XDECREF(__pyx_r);
12396 if (!__pyx_v_have_slices) {
12397 } else {
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;
12401 __pyx_t_4 = 0;
12402 goto __pyx_L14_bool_binop_done;
12403 }
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;
12407 __pyx_t_4 = 0;
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);
12417 __pyx_t_3 = 0;
12418 __pyx_t_4 = 0;
12419 __pyx_r = ((PyObject*)__pyx_t_11);
12420 __pyx_t_11 = 0;
12421 goto __pyx_L0;
12422
12423 /* "View.MemoryView":666
12424 * return isinstance(o, memoryview)
12425 *
12426 * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
12427 * """
12428 * Replace all ellipses with full slices and fill incomplete indices with
12429 */
12430
12431 /* function exit code */
12432 __pyx_L1_error:;
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);
12438 __pyx_r = 0;
12439 __pyx_L0:;
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();
12446 return __pyx_r;
12447}
12448
12449/* "View.MemoryView":700
12450 * return have_slices or nslices, tuple(result)
12451 *
12452 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
12453 * for suboffset in suboffsets[:ndim]:
12454 * if suboffset >= 0:
12455 */
12456
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;
12464 int __pyx_t_4;
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);
12470
12471 /* "View.MemoryView":701
12472 *
12473 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
12474 * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
12475 * if suboffset >= 0:
12476 * raise ValueError("Indirect dimensions not supported")
12477 */
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]);
12482
12483 /* "View.MemoryView":702
12484 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
12485 * for suboffset in suboffsets[:ndim]:
12486 * if suboffset >= 0: # <<<<<<<<<<<<<<
12487 * raise ValueError("Indirect dimensions not supported")
12488 *
12489 */
12490 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
12491 if (unlikely(__pyx_t_4)) {
12492
12493 /* "View.MemoryView":703
12494 * for suboffset in suboffsets[:ndim]:
12495 * if suboffset >= 0:
12496 * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
12497 *
12498 *
12499 */
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)
12505
12506 /* "View.MemoryView":702
12507 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
12508 * for suboffset in suboffsets[:ndim]:
12509 * if suboffset >= 0: # <<<<<<<<<<<<<<
12510 * raise ValueError("Indirect dimensions not supported")
12511 *
12512 */
12513 }
12514 }
12515
12516 /* "View.MemoryView":700
12517 * return have_slices or nslices, tuple(result)
12518 *
12519 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
12520 * for suboffset in suboffsets[:ndim]:
12521 * if suboffset >= 0:
12522 */
12523
12524 /* function exit code */
12525 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12526 goto __pyx_L0;
12527 __pyx_L1_error:;
12528 __Pyx_XDECREF(__pyx_t_5);
12529 __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
12530 __pyx_r = 0;
12531 __pyx_L0:;
12532 __Pyx_XGIVEREF(__pyx_r);
12533 __Pyx_RefNannyFinishContext();
12534 return __pyx_r;
12535}
12536
12537/* "View.MemoryView":710
12538 *
12539 * @cname('__pyx_memview_slice')
12540 * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
12541 * cdef int new_ndim = 0, suboffset_dim = -1, dim
12542 * cdef bint negative_step
12543 */
12544
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;
12548 int __pyx_v_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
12564 int __pyx_t_1;
12565 int __pyx_t_2;
12566 PyObject *__pyx_t_3 = NULL;
12567 struct __pyx_memoryview_obj *__pyx_t_4;
12568 char *__pyx_t_5;
12569 int __pyx_t_6;
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;
12574 int __pyx_t_11;
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);
12580
12581 /* "View.MemoryView":711
12582 * @cname('__pyx_memview_slice')
12583 * cdef memoryview memview_slice(memoryview memview, object indices):
12584 * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
12585 * cdef bint negative_step
12586 * cdef __Pyx_memviewslice src, dst
12587 */
12588 __pyx_v_new_ndim = 0;
12589 __pyx_v_suboffset_dim = -1;
12590
12591 /* "View.MemoryView":718
12592 *
12593 *
12594 * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
12595 *
12596 * cdef _memoryviewslice memviewsliceobj
12597 */
12598 (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
12599
12600 /* "View.MemoryView":722
12601 * cdef _memoryviewslice memviewsliceobj
12602 *
12603 * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
12604 *
12605 * if isinstance(memview, _memoryviewslice):
12606 */
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)
12612 }
12613 }
12614 #endif
12615
12616 /* "View.MemoryView":724
12617 * assert memview.view.ndim > 0
12618 *
12619 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
12620 * memviewsliceobj = memview
12621 * p_src = &memviewsliceobj.from_slice
12622 */
12623 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
12624 __pyx_t_2 = (__pyx_t_1 != 0);
12625 if (__pyx_t_2) {
12626
12627 /* "View.MemoryView":725
12628 *
12629 * if isinstance(memview, _memoryviewslice):
12630 * memviewsliceobj = memview # <<<<<<<<<<<<<<
12631 * p_src = &memviewsliceobj.from_slice
12632 * else:
12633 */
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);
12638 __pyx_t_3 = 0;
12639
12640 /* "View.MemoryView":726
12641 * if isinstance(memview, _memoryviewslice):
12642 * memviewsliceobj = memview
12643 * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
12644 * else:
12645 * slice_copy(memview, &src)
12646 */
12647 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
12648
12649 /* "View.MemoryView":724
12650 * assert memview.view.ndim > 0
12651 *
12652 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
12653 * memviewsliceobj = memview
12654 * p_src = &memviewsliceobj.from_slice
12655 */
12656 goto __pyx_L3;
12657 }
12658
12659 /* "View.MemoryView":728
12660 * p_src = &memviewsliceobj.from_slice
12661 * else:
12662 * slice_copy(memview, &src) # <<<<<<<<<<<<<<
12663 * p_src = &src
12664 *
12665 */
12666 /*else*/ {
12667 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
12668
12669 /* "View.MemoryView":729
12670 * else:
12671 * slice_copy(memview, &src)
12672 * p_src = &src # <<<<<<<<<<<<<<
12673 *
12674 *
12675 */
12676 __pyx_v_p_src = (&__pyx_v_src);
12677 }
12678 __pyx_L3:;
12679
12680 /* "View.MemoryView":735
12681 *
12682 *
12683 * dst.memview = p_src.memview # <<<<<<<<<<<<<<
12684 * dst.data = p_src.data
12685 *
12686 */
12687 __pyx_t_4 = __pyx_v_p_src->memview;
12688 __pyx_v_dst.memview = __pyx_t_4;
12689
12690 /* "View.MemoryView":736
12691 *
12692 * dst.memview = p_src.memview
12693 * dst.data = p_src.data # <<<<<<<<<<<<<<
12694 *
12695 *
12696 */
12697 __pyx_t_5 = __pyx_v_p_src->data;
12698 __pyx_v_dst.data = __pyx_t_5;
12699
12700 /* "View.MemoryView":741
12701 *
12702 *
12703 * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
12704 * cdef int *p_suboffset_dim = &suboffset_dim
12705 * cdef Py_ssize_t start, stop, step
12706 */
12707 __pyx_v_p_dst = (&__pyx_v_dst);
12708
12709 /* "View.MemoryView":742
12710 *
12711 * cdef __Pyx_memviewslice *p_dst = &dst
12712 * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
12713 * cdef Py_ssize_t start, stop, step
12714 * cdef bint have_start, have_stop, have_step
12715 */
12716 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
12717
12718 /* "View.MemoryView":746
12719 * cdef bint have_start, have_stop, have_step
12720 *
12721 * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
12722 * if PyIndex_Check(index):
12723 * slice_memviewslice(
12724 */
12725 __pyx_t_6 = 0;
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;
12728 __pyx_t_8 = NULL;
12729 } else {
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)
12733 }
12734 for (;;) {
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)
12740 #else
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);
12743 #endif
12744 } else {
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)
12748 #else
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);
12751 #endif
12752 }
12753 } else {
12754 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
12755 if (unlikely(!__pyx_t_9)) {
12756 PyObject* exc_type = PyErr_Occurred();
12757 if (exc_type) {
12758 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12759 else __PYX_ERR(2, 746, __pyx_L1_error)
12760 }
12761 break;
12762 }
12763 __Pyx_GOTREF(__pyx_t_9);
12764 }
12765 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
12766 __pyx_t_9 = 0;
12767 __pyx_v_dim = __pyx_t_6;
12768 __pyx_t_6 = (__pyx_t_6 + 1);
12769
12770 /* "View.MemoryView":747
12771 *
12772 * for dim, index in enumerate(indices):
12773 * if PyIndex_Check(index): # <<<<<<<<<<<<<<
12774 * slice_memviewslice(
12775 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12776 */
12777 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
12778 if (__pyx_t_2) {
12779
12780 /* "View.MemoryView":751
12781 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12782 * dim, new_ndim, p_suboffset_dim,
12783 * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<<
12784 * 0, 0, 0, # have_{start,stop,step}
12785 * False)
12786 */
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)
12788
12789 /* "View.MemoryView":748
12790 * for dim, index in enumerate(indices):
12791 * if PyIndex_Check(index):
12792 * slice_memviewslice( # <<<<<<<<<<<<<<
12793 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12794 * dim, new_ndim, p_suboffset_dim,
12795 */
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)
12797
12798 /* "View.MemoryView":747
12799 *
12800 * for dim, index in enumerate(indices):
12801 * if PyIndex_Check(index): # <<<<<<<<<<<<<<
12802 * slice_memviewslice(
12803 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12804 */
12805 goto __pyx_L6;
12806 }
12807
12808 /* "View.MemoryView":754
12809 * 0, 0, 0, # have_{start,stop,step}
12810 * False)
12811 * elif index is None: # <<<<<<<<<<<<<<
12812 * p_dst.shape[new_ndim] = 1
12813 * p_dst.strides[new_ndim] = 0
12814 */
12815 __pyx_t_2 = (__pyx_v_index == Py_None);
12816 __pyx_t_1 = (__pyx_t_2 != 0);
12817 if (__pyx_t_1) {
12818
12819 /* "View.MemoryView":755
12820 * False)
12821 * elif index is None:
12822 * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
12823 * p_dst.strides[new_ndim] = 0
12824 * p_dst.suboffsets[new_ndim] = -1
12825 */
12826 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
12827
12828 /* "View.MemoryView":756
12829 * elif index is None:
12830 * p_dst.shape[new_ndim] = 1
12831 * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
12832 * p_dst.suboffsets[new_ndim] = -1
12833 * new_ndim += 1
12834 */
12835 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
12836
12837 /* "View.MemoryView":757
12838 * p_dst.shape[new_ndim] = 1
12839 * p_dst.strides[new_ndim] = 0
12840 * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
12841 * new_ndim += 1
12842 * else:
12843 */
12844 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
12845
12846 /* "View.MemoryView":758
12847 * p_dst.strides[new_ndim] = 0
12848 * p_dst.suboffsets[new_ndim] = -1
12849 * new_ndim += 1 # <<<<<<<<<<<<<<
12850 * else:
12851 * start = index.start or 0
12852 */
12853 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
12854
12855 /* "View.MemoryView":754
12856 * 0, 0, 0, # have_{start,stop,step}
12857 * False)
12858 * elif index is None: # <<<<<<<<<<<<<<
12859 * p_dst.shape[new_ndim] = 1
12860 * p_dst.strides[new_ndim] = 0
12861 */
12862 goto __pyx_L6;
12863 }
12864
12865 /* "View.MemoryView":760
12866 * new_ndim += 1
12867 * else:
12868 * start = index.start or 0 # <<<<<<<<<<<<<<
12869 * stop = index.stop or 0
12870 * step = index.step or 0
12871 */
12872 /*else*/ {
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)
12876 if (!__pyx_t_1) {
12877 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12878 } else {
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;
12883 }
12884 __pyx_t_10 = 0;
12885 __pyx_L7_bool_binop_done:;
12886 __pyx_v_start = __pyx_t_10;
12887
12888 /* "View.MemoryView":761
12889 * else:
12890 * start = index.start or 0
12891 * stop = index.stop or 0 # <<<<<<<<<<<<<<
12892 * step = index.step or 0
12893 *
12894 */
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)
12898 if (!__pyx_t_1) {
12899 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12900 } else {
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;
12905 }
12906 __pyx_t_10 = 0;
12907 __pyx_L9_bool_binop_done:;
12908 __pyx_v_stop = __pyx_t_10;
12909
12910 /* "View.MemoryView":762
12911 * start = index.start or 0
12912 * stop = index.stop or 0
12913 * step = index.step or 0 # <<<<<<<<<<<<<<
12914 *
12915 * have_start = index.start is not None
12916 */
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)
12920 if (!__pyx_t_1) {
12921 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12922 } else {
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;
12927 }
12928 __pyx_t_10 = 0;
12929 __pyx_L11_bool_binop_done:;
12930 __pyx_v_step = __pyx_t_10;
12931
12932 /* "View.MemoryView":764
12933 * step = index.step or 0
12934 *
12935 * have_start = index.start is not None # <<<<<<<<<<<<<<
12936 * have_stop = index.stop is not None
12937 * have_step = index.step is not None
12938 */
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;
12944
12945 /* "View.MemoryView":765
12946 *
12947 * have_start = index.start is not None
12948 * have_stop = index.stop is not None # <<<<<<<<<<<<<<
12949 * have_step = index.step is not None
12950 *
12951 */
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;
12957
12958 /* "View.MemoryView":766
12959 * have_start = index.start is not None
12960 * have_stop = index.stop is not None
12961 * have_step = index.step is not None # <<<<<<<<<<<<<<
12962 *
12963 * slice_memviewslice(
12964 */
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;
12970
12971 /* "View.MemoryView":768
12972 * have_step = index.step is not None
12973 *
12974 * slice_memviewslice( # <<<<<<<<<<<<<<
12975 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
12976 * dim, new_ndim, p_suboffset_dim,
12977 */
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)
12979
12980 /* "View.MemoryView":774
12981 * have_start, have_stop, have_step,
12982 * True)
12983 * new_ndim += 1 # <<<<<<<<<<<<<<
12984 *
12985 * if isinstance(memview, _memoryviewslice):
12986 */
12987 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
12988 }
12989 __pyx_L6:;
12990
12991 /* "View.MemoryView":746
12992 * cdef bint have_start, have_stop, have_step
12993 *
12994 * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
12995 * if PyIndex_Check(index):
12996 * slice_memviewslice(
12997 */
12998 }
12999 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13000
13001 /* "View.MemoryView":776
13002 * new_ndim += 1
13003 *
13004 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
13005 * return memoryview_fromslice(dst, new_ndim,
13006 * memviewsliceobj.to_object_func,
13007 */
13008 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
13009 __pyx_t_2 = (__pyx_t_1 != 0);
13010 if (__pyx_t_2) {
13011
13012 /* "View.MemoryView":777
13013 *
13014 * if isinstance(memview, _memoryviewslice):
13015 * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
13016 * memviewsliceobj.to_object_func,
13017 * memviewsliceobj.to_dtype_func,
13018 */
13019 __Pyx_XDECREF(((PyObject *)__pyx_r));
13020
13021 /* "View.MemoryView":778
13022 * if isinstance(memview, _memoryviewslice):
13023 * return memoryview_fromslice(dst, new_ndim,
13024 * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
13025 * memviewsliceobj.to_dtype_func,
13026 * memview.dtype_is_object)
13027 */
13028 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
13029
13030 /* "View.MemoryView":779
13031 * return memoryview_fromslice(dst, new_ndim,
13032 * memviewsliceobj.to_object_func,
13033 * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
13034 * memview.dtype_is_object)
13035 * else:
13036 */
13037 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
13038
13039 /* "View.MemoryView":777
13040 *
13041 * if isinstance(memview, _memoryviewslice):
13042 * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
13043 * memviewsliceobj.to_object_func,
13044 * memviewsliceobj.to_dtype_func,
13045 */
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);
13050 __pyx_t_3 = 0;
13051 goto __pyx_L0;
13052
13053 /* "View.MemoryView":776
13054 * new_ndim += 1
13055 *
13056 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
13057 * return memoryview_fromslice(dst, new_ndim,
13058 * memviewsliceobj.to_object_func,
13059 */
13060 }
13061
13062 /* "View.MemoryView":782
13063 * memview.dtype_is_object)
13064 * else:
13065 * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
13066 * memview.dtype_is_object)
13067 *
13068 */
13069 /*else*/ {
13070 __Pyx_XDECREF(((PyObject *)__pyx_r));
13071
13072 /* "View.MemoryView":783
13073 * else:
13074 * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
13075 * memview.dtype_is_object) # <<<<<<<<<<<<<<
13076 *
13077 *
13078 */
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);
13081
13082 /* "View.MemoryView":782
13083 * memview.dtype_is_object)
13084 * else:
13085 * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
13086 * memview.dtype_is_object)
13087 *
13088 */
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);
13091 __pyx_t_3 = 0;
13092 goto __pyx_L0;
13093 }
13094
13095 /* "View.MemoryView":710
13096 *
13097 * @cname('__pyx_memview_slice')
13098 * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
13099 * cdef int new_ndim = 0, suboffset_dim = -1, dim
13100 * cdef bint negative_step
13101 */
13102
13103 /* function exit code */
13104 __pyx_L1_error:;
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);
13108 __pyx_r = 0;
13109 __pyx_L0:;
13110 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
13111 __Pyx_XDECREF(__pyx_v_index);
13112 __Pyx_XGIVEREF((PyObject *)__pyx_r);
13113 __Pyx_RefNannyFinishContext();
13114 return __pyx_r;
13115}
13116
13117/* "View.MemoryView":807
13118 *
13119 * @cname('__pyx_memoryview_slice_memviewslice')
13120 * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
13121 * __Pyx_memviewslice *dst,
13122 * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
13123 */
13124
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;
13128 int __pyx_r;
13129 int __pyx_t_1;
13130 int __pyx_t_2;
13131 int __pyx_t_3;
13132 int __pyx_lineno = 0;
13133 const char *__pyx_filename = NULL;
13134 int __pyx_clineno = 0;
13135
13136 /* "View.MemoryView":827
13137 * cdef bint negative_step
13138 *
13139 * if not is_slice: # <<<<<<<<<<<<<<
13140 *
13141 * if start < 0:
13142 */
13143 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
13144 if (__pyx_t_1) {
13145
13146 /* "View.MemoryView":829
13147 * if not is_slice:
13148 *
13149 * if start < 0: # <<<<<<<<<<<<<<
13150 * start += shape
13151 * if not 0 <= start < shape:
13152 */
13153 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
13154 if (__pyx_t_1) {
13155
13156 /* "View.MemoryView":830
13157 *
13158 * if start < 0:
13159 * start += shape # <<<<<<<<<<<<<<
13160 * if not 0 <= start < shape:
13161 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
13162 */
13163 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
13164
13165 /* "View.MemoryView":829
13166 * if not is_slice:
13167 *
13168 * if start < 0: # <<<<<<<<<<<<<<
13169 * start += shape
13170 * if not 0 <= start < shape:
13171 */
13172 }
13173
13174 /* "View.MemoryView":831
13175 * if start < 0:
13176 * start += shape
13177 * if not 0 <= start < shape: # <<<<<<<<<<<<<<
13178 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
13179 * else:
13180 */
13181 __pyx_t_1 = (0 <= __pyx_v_start);
13182 if (__pyx_t_1) {
13183 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
13184 }
13185 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13186 if (__pyx_t_2) {
13187
13188 /* "View.MemoryView":832
13189 * start += shape
13190 * if not 0 <= start < shape:
13191 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
13192 * else:
13193 *
13194 */
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)
13196
13197 /* "View.MemoryView":831
13198 * if start < 0:
13199 * start += shape
13200 * if not 0 <= start < shape: # <<<<<<<<<<<<<<
13201 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
13202 * else:
13203 */
13204 }
13205
13206 /* "View.MemoryView":827
13207 * cdef bint negative_step
13208 *
13209 * if not is_slice: # <<<<<<<<<<<<<<
13210 *
13211 * if start < 0:
13212 */
13213 goto __pyx_L3;
13214 }
13215
13216 /* "View.MemoryView":835
13217 * else:
13218 *
13219 * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
13220 *
13221 * if have_step and step == 0:
13222 */
13223 /*else*/ {
13224 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
13225 if (__pyx_t_1) {
13226 } else {
13227 __pyx_t_2 = __pyx_t_1;
13228 goto __pyx_L6_bool_binop_done;
13229 }
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;
13234
13235 /* "View.MemoryView":837
13236 * negative_step = have_step != 0 and step < 0
13237 *
13238 * if have_step and step == 0: # <<<<<<<<<<<<<<
13239 * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
13240 *
13241 */
13242 __pyx_t_1 = (__pyx_v_have_step != 0);
13243 if (__pyx_t_1) {
13244 } else {
13245 __pyx_t_2 = __pyx_t_1;
13246 goto __pyx_L9_bool_binop_done;
13247 }
13248 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
13249 __pyx_t_2 = __pyx_t_1;
13250 __pyx_L9_bool_binop_done:;
13251 if (__pyx_t_2) {
13252
13253 /* "View.MemoryView":838
13254 *
13255 * if have_step and step == 0:
13256 * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
13257 *
13258 *
13259 */
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)
13261
13262 /* "View.MemoryView":837
13263 * negative_step = have_step != 0 and step < 0
13264 *
13265 * if have_step and step == 0: # <<<<<<<<<<<<<<
13266 * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
13267 *
13268 */
13269 }
13270
13271 /* "View.MemoryView":841
13272 *
13273 *
13274 * if have_start: # <<<<<<<<<<<<<<
13275 * if start < 0:
13276 * start += shape
13277 */
13278 __pyx_t_2 = (__pyx_v_have_start != 0);
13279 if (__pyx_t_2) {
13280
13281 /* "View.MemoryView":842
13282 *
13283 * if have_start:
13284 * if start < 0: # <<<<<<<<<<<<<<
13285 * start += shape
13286 * if start < 0:
13287 */
13288 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
13289 if (__pyx_t_2) {
13290
13291 /* "View.MemoryView":843
13292 * if have_start:
13293 * if start < 0:
13294 * start += shape # <<<<<<<<<<<<<<
13295 * if start < 0:
13296 * start = 0
13297 */
13298 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
13299
13300 /* "View.MemoryView":844
13301 * if start < 0:
13302 * start += shape
13303 * if start < 0: # <<<<<<<<<<<<<<
13304 * start = 0
13305 * elif start >= shape:
13306 */
13307 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
13308 if (__pyx_t_2) {
13309
13310 /* "View.MemoryView":845
13311 * start += shape
13312 * if start < 0:
13313 * start = 0 # <<<<<<<<<<<<<<
13314 * elif start >= shape:
13315 * if negative_step:
13316 */
13317 __pyx_v_start = 0;
13318
13319 /* "View.MemoryView":844
13320 * if start < 0:
13321 * start += shape
13322 * if start < 0: # <<<<<<<<<<<<<<
13323 * start = 0
13324 * elif start >= shape:
13325 */
13326 }
13327
13328 /* "View.MemoryView":842
13329 *
13330 * if have_start:
13331 * if start < 0: # <<<<<<<<<<<<<<
13332 * start += shape
13333 * if start < 0:
13334 */
13335 goto __pyx_L12;
13336 }
13337
13338 /* "View.MemoryView":846
13339 * if start < 0:
13340 * start = 0
13341 * elif start >= shape: # <<<<<<<<<<<<<<
13342 * if negative_step:
13343 * start = shape - 1
13344 */
13345 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
13346 if (__pyx_t_2) {
13347
13348 /* "View.MemoryView":847
13349 * start = 0
13350 * elif start >= shape:
13351 * if negative_step: # <<<<<<<<<<<<<<
13352 * start = shape - 1
13353 * else:
13354 */
13355 __pyx_t_2 = (__pyx_v_negative_step != 0);
13356 if (__pyx_t_2) {
13357
13358 /* "View.MemoryView":848
13359 * elif start >= shape:
13360 * if negative_step:
13361 * start = shape - 1 # <<<<<<<<<<<<<<
13362 * else:
13363 * start = shape
13364 */
13365 __pyx_v_start = (__pyx_v_shape - 1);
13366
13367 /* "View.MemoryView":847
13368 * start = 0
13369 * elif start >= shape:
13370 * if negative_step: # <<<<<<<<<<<<<<
13371 * start = shape - 1
13372 * else:
13373 */
13374 goto __pyx_L14;
13375 }
13376
13377 /* "View.MemoryView":850
13378 * start = shape - 1
13379 * else:
13380 * start = shape # <<<<<<<<<<<<<<
13381 * else:
13382 * if negative_step:
13383 */
13384 /*else*/ {
13385 __pyx_v_start = __pyx_v_shape;
13386 }
13387 __pyx_L14:;
13388
13389 /* "View.MemoryView":846
13390 * if start < 0:
13391 * start = 0
13392 * elif start >= shape: # <<<<<<<<<<<<<<
13393 * if negative_step:
13394 * start = shape - 1
13395 */
13396 }
13397 __pyx_L12:;
13398
13399 /* "View.MemoryView":841
13400 *
13401 *
13402 * if have_start: # <<<<<<<<<<<<<<
13403 * if start < 0:
13404 * start += shape
13405 */
13406 goto __pyx_L11;
13407 }
13408
13409 /* "View.MemoryView":852
13410 * start = shape
13411 * else:
13412 * if negative_step: # <<<<<<<<<<<<<<
13413 * start = shape - 1
13414 * else:
13415 */
13416 /*else*/ {
13417 __pyx_t_2 = (__pyx_v_negative_step != 0);
13418 if (__pyx_t_2) {
13419
13420 /* "View.MemoryView":853
13421 * else:
13422 * if negative_step:
13423 * start = shape - 1 # <<<<<<<<<<<<<<
13424 * else:
13425 * start = 0
13426 */
13427 __pyx_v_start = (__pyx_v_shape - 1);
13428
13429 /* "View.MemoryView":852
13430 * start = shape
13431 * else:
13432 * if negative_step: # <<<<<<<<<<<<<<
13433 * start = shape - 1
13434 * else:
13435 */
13436 goto __pyx_L15;
13437 }
13438
13439 /* "View.MemoryView":855
13440 * start = shape - 1
13441 * else:
13442 * start = 0 # <<<<<<<<<<<<<<
13443 *
13444 * if have_stop:
13445 */
13446 /*else*/ {
13447 __pyx_v_start = 0;
13448 }
13449 __pyx_L15:;
13450 }
13451 __pyx_L11:;
13452
13453 /* "View.MemoryView":857
13454 * start = 0
13455 *
13456 * if have_stop: # <<<<<<<<<<<<<<
13457 * if stop < 0:
13458 * stop += shape
13459 */
13460 __pyx_t_2 = (__pyx_v_have_stop != 0);
13461 if (__pyx_t_2) {
13462
13463 /* "View.MemoryView":858
13464 *
13465 * if have_stop:
13466 * if stop < 0: # <<<<<<<<<<<<<<
13467 * stop += shape
13468 * if stop < 0:
13469 */
13470 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
13471 if (__pyx_t_2) {
13472
13473 /* "View.MemoryView":859
13474 * if have_stop:
13475 * if stop < 0:
13476 * stop += shape # <<<<<<<<<<<<<<
13477 * if stop < 0:
13478 * stop = 0
13479 */
13480 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
13481
13482 /* "View.MemoryView":860
13483 * if stop < 0:
13484 * stop += shape
13485 * if stop < 0: # <<<<<<<<<<<<<<
13486 * stop = 0
13487 * elif stop > shape:
13488 */
13489 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
13490 if (__pyx_t_2) {
13491
13492 /* "View.MemoryView":861
13493 * stop += shape
13494 * if stop < 0:
13495 * stop = 0 # <<<<<<<<<<<<<<
13496 * elif stop > shape:
13497 * stop = shape
13498 */
13499 __pyx_v_stop = 0;
13500
13501 /* "View.MemoryView":860
13502 * if stop < 0:
13503 * stop += shape
13504 * if stop < 0: # <<<<<<<<<<<<<<
13505 * stop = 0
13506 * elif stop > shape:
13507 */
13508 }
13509
13510 /* "View.MemoryView":858
13511 *
13512 * if have_stop:
13513 * if stop < 0: # <<<<<<<<<<<<<<
13514 * stop += shape
13515 * if stop < 0:
13516 */
13517 goto __pyx_L17;
13518 }
13519
13520 /* "View.MemoryView":862
13521 * if stop < 0:
13522 * stop = 0
13523 * elif stop > shape: # <<<<<<<<<<<<<<
13524 * stop = shape
13525 * else:
13526 */
13527 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
13528 if (__pyx_t_2) {
13529
13530 /* "View.MemoryView":863
13531 * stop = 0
13532 * elif stop > shape:
13533 * stop = shape # <<<<<<<<<<<<<<
13534 * else:
13535 * if negative_step:
13536 */
13537 __pyx_v_stop = __pyx_v_shape;
13538
13539 /* "View.MemoryView":862
13540 * if stop < 0:
13541 * stop = 0
13542 * elif stop > shape: # <<<<<<<<<<<<<<
13543 * stop = shape
13544 * else:
13545 */
13546 }
13547 __pyx_L17:;
13548
13549 /* "View.MemoryView":857
13550 * start = 0
13551 *
13552 * if have_stop: # <<<<<<<<<<<<<<
13553 * if stop < 0:
13554 * stop += shape
13555 */
13556 goto __pyx_L16;
13557 }
13558
13559 /* "View.MemoryView":865
13560 * stop = shape
13561 * else:
13562 * if negative_step: # <<<<<<<<<<<<<<
13563 * stop = -1
13564 * else:
13565 */
13566 /*else*/ {
13567 __pyx_t_2 = (__pyx_v_negative_step != 0);
13568 if (__pyx_t_2) {
13569
13570 /* "View.MemoryView":866
13571 * else:
13572 * if negative_step:
13573 * stop = -1 # <<<<<<<<<<<<<<
13574 * else:
13575 * stop = shape
13576 */
13577 __pyx_v_stop = -1L;
13578
13579 /* "View.MemoryView":865
13580 * stop = shape
13581 * else:
13582 * if negative_step: # <<<<<<<<<<<<<<
13583 * stop = -1
13584 * else:
13585 */
13586 goto __pyx_L19;
13587 }
13588
13589 /* "View.MemoryView":868
13590 * stop = -1
13591 * else:
13592 * stop = shape # <<<<<<<<<<<<<<
13593 *
13594 * if not have_step:
13595 */
13596 /*else*/ {
13597 __pyx_v_stop = __pyx_v_shape;
13598 }
13599 __pyx_L19:;
13600 }
13601 __pyx_L16:;
13602
13603 /* "View.MemoryView":870
13604 * stop = shape
13605 *
13606 * if not have_step: # <<<<<<<<<<<<<<
13607 * step = 1
13608 *
13609 */
13610 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
13611 if (__pyx_t_2) {
13612
13613 /* "View.MemoryView":871
13614 *
13615 * if not have_step:
13616 * step = 1 # <<<<<<<<<<<<<<
13617 *
13618 *
13619 */
13620 __pyx_v_step = 1;
13621
13622 /* "View.MemoryView":870
13623 * stop = shape
13624 *
13625 * if not have_step: # <<<<<<<<<<<<<<
13626 * step = 1
13627 *
13628 */
13629 }
13630
13631 /* "View.MemoryView":875
13632 *
13633 * with cython.cdivision(True):
13634 * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
13635 *
13636 * if (stop - start) - step * new_shape:
13637 */
13638 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
13639
13640 /* "View.MemoryView":877
13641 * new_shape = (stop - start) // step
13642 *
13643 * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
13644 * new_shape += 1
13645 *
13646 */
13647 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
13648 if (__pyx_t_2) {
13649
13650 /* "View.MemoryView":878
13651 *
13652 * if (stop - start) - step * new_shape:
13653 * new_shape += 1 # <<<<<<<<<<<<<<
13654 *
13655 * if new_shape < 0:
13656 */
13657 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
13658
13659 /* "View.MemoryView":877
13660 * new_shape = (stop - start) // step
13661 *
13662 * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
13663 * new_shape += 1
13664 *
13665 */
13666 }
13667
13668 /* "View.MemoryView":880
13669 * new_shape += 1
13670 *
13671 * if new_shape < 0: # <<<<<<<<<<<<<<
13672 * new_shape = 0
13673 *
13674 */
13675 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
13676 if (__pyx_t_2) {
13677
13678 /* "View.MemoryView":881
13679 *
13680 * if new_shape < 0:
13681 * new_shape = 0 # <<<<<<<<<<<<<<
13682 *
13683 *
13684 */
13685 __pyx_v_new_shape = 0;
13686
13687 /* "View.MemoryView":880
13688 * new_shape += 1
13689 *
13690 * if new_shape < 0: # <<<<<<<<<<<<<<
13691 * new_shape = 0
13692 *
13693 */
13694 }
13695
13696 /* "View.MemoryView":884
13697 *
13698 *
13699 * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
13700 * dst.shape[new_ndim] = new_shape
13701 * dst.suboffsets[new_ndim] = suboffset
13702 */
13703 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
13704
13705 /* "View.MemoryView":885
13706 *
13707 * dst.strides[new_ndim] = stride * step
13708 * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
13709 * dst.suboffsets[new_ndim] = suboffset
13710 *
13711 */
13712 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
13713
13714 /* "View.MemoryView":886
13715 * dst.strides[new_ndim] = stride * step
13716 * dst.shape[new_ndim] = new_shape
13717 * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
13718 *
13719 *
13720 */
13721 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
13722 }
13723 __pyx_L3:;
13724
13725 /* "View.MemoryView":889
13726 *
13727 *
13728 * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
13729 * dst.data += start * stride
13730 * else:
13731 */
13732 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
13733 if (__pyx_t_2) {
13734
13735 /* "View.MemoryView":890
13736 *
13737 * if suboffset_dim[0] < 0:
13738 * dst.data += start * stride # <<<<<<<<<<<<<<
13739 * else:
13740 * dst.suboffsets[suboffset_dim[0]] += start * stride
13741 */
13742 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
13743
13744 /* "View.MemoryView":889
13745 *
13746 *
13747 * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
13748 * dst.data += start * stride
13749 * else:
13750 */
13751 goto __pyx_L23;
13752 }
13753
13754 /* "View.MemoryView":892
13755 * dst.data += start * stride
13756 * else:
13757 * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
13758 *
13759 * if suboffset >= 0:
13760 */
13761 /*else*/ {
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));
13764 }
13765 __pyx_L23:;
13766
13767 /* "View.MemoryView":894
13768 * dst.suboffsets[suboffset_dim[0]] += start * stride
13769 *
13770 * if suboffset >= 0: # <<<<<<<<<<<<<<
13771 * if not is_slice:
13772 * if new_ndim == 0:
13773 */
13774 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
13775 if (__pyx_t_2) {
13776
13777 /* "View.MemoryView":895
13778 *
13779 * if suboffset >= 0:
13780 * if not is_slice: # <<<<<<<<<<<<<<
13781 * if new_ndim == 0:
13782 * dst.data = (<char **> dst.data)[0] + suboffset
13783 */
13784 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
13785 if (__pyx_t_2) {
13786
13787 /* "View.MemoryView":896
13788 * if suboffset >= 0:
13789 * if not is_slice:
13790 * if new_ndim == 0: # <<<<<<<<<<<<<<
13791 * dst.data = (<char **> dst.data)[0] + suboffset
13792 * else:
13793 */
13794 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
13795 if (__pyx_t_2) {
13796
13797 /* "View.MemoryView":897
13798 * if not is_slice:
13799 * if new_ndim == 0:
13800 * dst.data = (<char **> dst.data)[0] + suboffset # <<<<<<<<<<<<<<
13801 * else:
13802 * _err_dim(IndexError, "All dimensions preceding dimension %d "
13803 */
13804 __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
13805
13806 /* "View.MemoryView":896
13807 * if suboffset >= 0:
13808 * if not is_slice:
13809 * if new_ndim == 0: # <<<<<<<<<<<<<<
13810 * dst.data = (<char **> dst.data)[0] + suboffset
13811 * else:
13812 */
13813 goto __pyx_L26;
13814 }
13815
13816 /* "View.MemoryView":899
13817 * dst.data = (<char **> dst.data)[0] + suboffset
13818 * else:
13819 * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
13820 * "must be indexed and not sliced", dim)
13821 * else:
13822 */
13823 /*else*/ {
13824
13825 /* "View.MemoryView":900
13826 * else:
13827 * _err_dim(IndexError, "All dimensions preceding dimension %d "
13828 * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
13829 * else:
13830 * suboffset_dim[0] = new_ndim
13831 */
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)
13833 }
13834 __pyx_L26:;
13835
13836 /* "View.MemoryView":895
13837 *
13838 * if suboffset >= 0:
13839 * if not is_slice: # <<<<<<<<<<<<<<
13840 * if new_ndim == 0:
13841 * dst.data = (<char **> dst.data)[0] + suboffset
13842 */
13843 goto __pyx_L25;
13844 }
13845
13846 /* "View.MemoryView":902
13847 * "must be indexed and not sliced", dim)
13848 * else:
13849 * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
13850 *
13851 * return 0
13852 */
13853 /*else*/ {
13854 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
13855 }
13856 __pyx_L25:;
13857
13858 /* "View.MemoryView":894
13859 * dst.suboffsets[suboffset_dim[0]] += start * stride
13860 *
13861 * if suboffset >= 0: # <<<<<<<<<<<<<<
13862 * if not is_slice:
13863 * if new_ndim == 0:
13864 */
13865 }
13866
13867 /* "View.MemoryView":904
13868 * suboffset_dim[0] = new_ndim
13869 *
13870 * return 0 # <<<<<<<<<<<<<<
13871 *
13872 *
13873 */
13874 __pyx_r = 0;
13875 goto __pyx_L0;
13876
13877 /* "View.MemoryView":807
13878 *
13879 * @cname('__pyx_memoryview_slice_memviewslice')
13880 * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
13881 * __Pyx_memviewslice *dst,
13882 * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
13883 */
13884
13885 /* function exit code */
13886 __pyx_L1_error:;
13887 {
13888 #ifdef WITH_THREAD
13889 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
13890 #endif
13891 __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13892 #ifdef WITH_THREAD
13893 __Pyx_PyGILState_Release(__pyx_gilstate_save);
13894 #endif
13895 }
13896 __pyx_r = -1;
13897 __pyx_L0:;
13898 return __pyx_r;
13899}
13900
13901/* "View.MemoryView":910
13902 *
13903 * @cname('__pyx_pybuffer_index')
13904 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
13905 * Py_ssize_t dim) except NULL:
13906 * cdef Py_ssize_t shape, stride, suboffset = -1
13907 */
13908
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;
13915 char *__pyx_r;
13916 __Pyx_RefNannyDeclarations
13917 Py_ssize_t __pyx_t_1;
13918 int __pyx_t_2;
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);
13925
13926 /* "View.MemoryView":912
13927 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
13928 * Py_ssize_t dim) except NULL:
13929 * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
13930 * cdef Py_ssize_t itemsize = view.itemsize
13931 * cdef char *resultp
13932 */
13933 __pyx_v_suboffset = -1L;
13934
13935 /* "View.MemoryView":913
13936 * Py_ssize_t dim) except NULL:
13937 * cdef Py_ssize_t shape, stride, suboffset = -1
13938 * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
13939 * cdef char *resultp
13940 *
13941 */
13942 __pyx_t_1 = __pyx_v_view->itemsize;
13943 __pyx_v_itemsize = __pyx_t_1;
13944
13945 /* "View.MemoryView":916
13946 * cdef char *resultp
13947 *
13948 * if view.ndim == 0: # <<<<<<<<<<<<<<
13949 * shape = view.len / itemsize
13950 * stride = itemsize
13951 */
13952 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
13953 if (__pyx_t_2) {
13954
13955 /* "View.MemoryView":917
13956 *
13957 * if view.ndim == 0:
13958 * shape = view.len / itemsize # <<<<<<<<<<<<<<
13959 * stride = itemsize
13960 * else:
13961 */
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)
13965 }
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)
13969 }
13970 __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
13971
13972 /* "View.MemoryView":918
13973 * if view.ndim == 0:
13974 * shape = view.len / itemsize
13975 * stride = itemsize # <<<<<<<<<<<<<<
13976 * else:
13977 * shape = view.shape[dim]
13978 */
13979 __pyx_v_stride = __pyx_v_itemsize;
13980
13981 /* "View.MemoryView":916
13982 * cdef char *resultp
13983 *
13984 * if view.ndim == 0: # <<<<<<<<<<<<<<
13985 * shape = view.len / itemsize
13986 * stride = itemsize
13987 */
13988 goto __pyx_L3;
13989 }
13990
13991 /* "View.MemoryView":920
13992 * stride = itemsize
13993 * else:
13994 * shape = view.shape[dim] # <<<<<<<<<<<<<<
13995 * stride = view.strides[dim]
13996 * if view.suboffsets != NULL:
13997 */
13998 /*else*/ {
13999 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
14000
14001 /* "View.MemoryView":921
14002 * else:
14003 * shape = view.shape[dim]
14004 * stride = view.strides[dim] # <<<<<<<<<<<<<<
14005 * if view.suboffsets != NULL:
14006 * suboffset = view.suboffsets[dim]
14007 */
14008 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
14009
14010 /* "View.MemoryView":922
14011 * shape = view.shape[dim]
14012 * stride = view.strides[dim]
14013 * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
14014 * suboffset = view.suboffsets[dim]
14015 *
14016 */
14017 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
14018 if (__pyx_t_2) {
14019
14020 /* "View.MemoryView":923
14021 * stride = view.strides[dim]
14022 * if view.suboffsets != NULL:
14023 * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
14024 *
14025 * if index < 0:
14026 */
14027 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
14028
14029 /* "View.MemoryView":922
14030 * shape = view.shape[dim]
14031 * stride = view.strides[dim]
14032 * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
14033 * suboffset = view.suboffsets[dim]
14034 *
14035 */
14036 }
14037 }
14038 __pyx_L3:;
14039
14040 /* "View.MemoryView":925
14041 * suboffset = view.suboffsets[dim]
14042 *
14043 * if index < 0: # <<<<<<<<<<<<<<
14044 * index += view.shape[dim]
14045 * if index < 0:
14046 */
14047 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
14048 if (__pyx_t_2) {
14049
14050 /* "View.MemoryView":926
14051 *
14052 * if index < 0:
14053 * index += view.shape[dim] # <<<<<<<<<<<<<<
14054 * if index < 0:
14055 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14056 */
14057 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
14058
14059 /* "View.MemoryView":927
14060 * if index < 0:
14061 * index += view.shape[dim]
14062 * if index < 0: # <<<<<<<<<<<<<<
14063 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14064 *
14065 */
14066 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
14067 if (unlikely(__pyx_t_2)) {
14068
14069 /* "View.MemoryView":928
14070 * index += view.shape[dim]
14071 * if index < 0:
14072 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
14073 *
14074 * if index >= shape:
14075 */
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)
14087
14088 /* "View.MemoryView":927
14089 * if index < 0:
14090 * index += view.shape[dim]
14091 * if index < 0: # <<<<<<<<<<<<<<
14092 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14093 *
14094 */
14095 }
14096
14097 /* "View.MemoryView":925
14098 * suboffset = view.suboffsets[dim]
14099 *
14100 * if index < 0: # <<<<<<<<<<<<<<
14101 * index += view.shape[dim]
14102 * if index < 0:
14103 */
14104 }
14105
14106 /* "View.MemoryView":930
14107 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14108 *
14109 * if index >= shape: # <<<<<<<<<<<<<<
14110 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14111 *
14112 */
14113 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
14114 if (unlikely(__pyx_t_2)) {
14115
14116 /* "View.MemoryView":931
14117 *
14118 * if index >= shape:
14119 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
14120 *
14121 * resultp = bufp + index * stride
14122 */
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)
14134
14135 /* "View.MemoryView":930
14136 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14137 *
14138 * if index >= shape: # <<<<<<<<<<<<<<
14139 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14140 *
14141 */
14142 }
14143
14144 /* "View.MemoryView":933
14145 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
14146 *
14147 * resultp = bufp + index * stride # <<<<<<<<<<<<<<
14148 * if suboffset >= 0:
14149 * resultp = (<char **> resultp)[0] + suboffset
14150 */
14151 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
14152
14153 /* "View.MemoryView":934
14154 *
14155 * resultp = bufp + index * stride
14156 * if suboffset >= 0: # <<<<<<<<<<<<<<
14157 * resultp = (<char **> resultp)[0] + suboffset
14158 *
14159 */
14160 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
14161 if (__pyx_t_2) {
14162
14163 /* "View.MemoryView":935
14164 * resultp = bufp + index * stride
14165 * if suboffset >= 0:
14166 * resultp = (<char **> resultp)[0] + suboffset # <<<<<<<<<<<<<<
14167 *
14168 * return resultp
14169 */
14170 __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
14171
14172 /* "View.MemoryView":934
14173 *
14174 * resultp = bufp + index * stride
14175 * if suboffset >= 0: # <<<<<<<<<<<<<<
14176 * resultp = (<char **> resultp)[0] + suboffset
14177 *
14178 */
14179 }
14180
14181 /* "View.MemoryView":937
14182 * resultp = (<char **> resultp)[0] + suboffset
14183 *
14184 * return resultp # <<<<<<<<<<<<<<
14185 *
14186 *
14187 */
14188 __pyx_r = __pyx_v_resultp;
14189 goto __pyx_L0;
14190
14191 /* "View.MemoryView":910
14192 *
14193 * @cname('__pyx_pybuffer_index')
14194 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
14195 * Py_ssize_t dim) except NULL:
14196 * cdef Py_ssize_t shape, stride, suboffset = -1
14197 */
14198
14199 /* function exit code */
14200 __pyx_L1_error:;
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);
14204 __pyx_r = NULL;
14205 __pyx_L0:;
14206 __Pyx_RefNannyFinishContext();
14207 return __pyx_r;
14208}
14209
14210/* "View.MemoryView":943
14211 *
14212 * @cname('__pyx_memslice_transpose')
14213 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
14214 * cdef int ndim = memslice.memview.view.ndim
14215 *
14216 */
14217
14218static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
14219 int __pyx_v_ndim;
14220 Py_ssize_t *__pyx_v_shape;
14221 Py_ssize_t *__pyx_v_strides;
14222 int __pyx_v_i;
14223 int __pyx_v_j;
14224 int __pyx_r;
14225 int __pyx_t_1;
14226 Py_ssize_t *__pyx_t_2;
14227 long __pyx_t_3;
14228 long __pyx_t_4;
14229 Py_ssize_t __pyx_t_5;
14230 Py_ssize_t __pyx_t_6;
14231 int __pyx_t_7;
14232 int __pyx_t_8;
14233 int __pyx_t_9;
14234 int __pyx_lineno = 0;
14235 const char *__pyx_filename = NULL;
14236 int __pyx_clineno = 0;
14237
14238 /* "View.MemoryView":944
14239 * @cname('__pyx_memslice_transpose')
14240 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
14241 * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
14242 *
14243 * cdef Py_ssize_t *shape = memslice.shape
14244 */
14245 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
14246 __pyx_v_ndim = __pyx_t_1;
14247
14248 /* "View.MemoryView":946
14249 * cdef int ndim = memslice.memview.view.ndim
14250 *
14251 * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
14252 * cdef Py_ssize_t *strides = memslice.strides
14253 *
14254 */
14255 __pyx_t_2 = __pyx_v_memslice->shape;
14256 __pyx_v_shape = __pyx_t_2;
14257
14258 /* "View.MemoryView":947
14259 *
14260 * cdef Py_ssize_t *shape = memslice.shape
14261 * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
14262 *
14263 *
14264 */
14265 __pyx_t_2 = __pyx_v_memslice->strides;
14266 __pyx_v_strides = __pyx_t_2;
14267
14268 /* "View.MemoryView":951
14269 *
14270 * cdef int i, j
14271 * for i in range(ndim / 2): # <<<<<<<<<<<<<<
14272 * j = ndim - 1 - i
14273 * strides[i], strides[j] = strides[j], strides[i]
14274 */
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;
14279
14280 /* "View.MemoryView":952
14281 * cdef int i, j
14282 * for i in range(ndim / 2):
14283 * j = ndim - 1 - i # <<<<<<<<<<<<<<
14284 * strides[i], strides[j] = strides[j], strides[i]
14285 * shape[i], shape[j] = shape[j], shape[i]
14286 */
14287 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
14288
14289 /* "View.MemoryView":953
14290 * for i in range(ndim / 2):
14291 * j = ndim - 1 - i
14292 * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
14293 * shape[i], shape[j] = shape[j], shape[i]
14294 *
14295 */
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;
14300
14301 /* "View.MemoryView":954
14302 * j = ndim - 1 - i
14303 * strides[i], strides[j] = strides[j], strides[i]
14304 * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
14305 *
14306 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
14307 */
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;
14312
14313 /* "View.MemoryView":956
14314 * shape[i], shape[j] = shape[j], shape[i]
14315 *
14316 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
14317 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
14318 *
14319 */
14320 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
14321 if (!__pyx_t_8) {
14322 } else {
14323 __pyx_t_7 = __pyx_t_8;
14324 goto __pyx_L6_bool_binop_done;
14325 }
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:;
14329 if (__pyx_t_7) {
14330
14331 /* "View.MemoryView":957
14332 *
14333 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
14334 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
14335 *
14336 * return 1
14337 */
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)
14339
14340 /* "View.MemoryView":956
14341 * shape[i], shape[j] = shape[j], shape[i]
14342 *
14343 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
14344 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
14345 *
14346 */
14347 }
14348 }
14349
14350 /* "View.MemoryView":959
14351 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
14352 *
14353 * return 1 # <<<<<<<<<<<<<<
14354 *
14355 *
14356 */
14357 __pyx_r = 1;
14358 goto __pyx_L0;
14359
14360 /* "View.MemoryView":943
14361 *
14362 * @cname('__pyx_memslice_transpose')
14363 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
14364 * cdef int ndim = memslice.memview.view.ndim
14365 *
14366 */
14367
14368 /* function exit code */
14369 __pyx_L1_error:;
14370 {
14371 #ifdef WITH_THREAD
14372 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
14373 #endif
14374 __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14375 #ifdef WITH_THREAD
14376 __Pyx_PyGILState_Release(__pyx_gilstate_save);
14377 #endif
14378 }
14379 __pyx_r = 0;
14380 __pyx_L0:;
14381 return __pyx_r;
14382}
14383
14384/* "View.MemoryView":976
14385 * cdef int (*to_dtype_func)(char *, object) except 0
14386 *
14387 * def __dealloc__(self): # <<<<<<<<<<<<<<
14388 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14389 *
14390 */
14391
14392/* Python wrapper */
14393static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
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));
14398
14399 /* function exit code */
14400 __Pyx_RefNannyFinishContext();
14401}
14402
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);
14406
14407 /* "View.MemoryView":977
14408 *
14409 * def __dealloc__(self):
14410 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
14411 *
14412 * cdef convert_item_to_object(self, char *itemp):
14413 */
14414 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
14415
14416 /* "View.MemoryView":976
14417 * cdef int (*to_dtype_func)(char *, object) except 0
14418 *
14419 * def __dealloc__(self): # <<<<<<<<<<<<<<
14420 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14421 *
14422 */
14423
14424 /* function exit code */
14425 __Pyx_RefNannyFinishContext();
14426}
14427
14428/* "View.MemoryView":979
14429 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14430 *
14431 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
14432 * if self.to_object_func != NULL:
14433 * return self.to_object_func(itemp)
14434 */
14435
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
14439 int __pyx_t_1;
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);
14445
14446 /* "View.MemoryView":980
14447 *
14448 * cdef convert_item_to_object(self, char *itemp):
14449 * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
14450 * return self.to_object_func(itemp)
14451 * else:
14452 */
14453 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
14454 if (__pyx_t_1) {
14455
14456 /* "View.MemoryView":981
14457 * cdef convert_item_to_object(self, char *itemp):
14458 * if self.to_object_func != NULL:
14459 * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
14460 * else:
14461 * return memoryview.convert_item_to_object(self, itemp)
14462 */
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;
14467 __pyx_t_2 = 0;
14468 goto __pyx_L0;
14469
14470 /* "View.MemoryView":980
14471 *
14472 * cdef convert_item_to_object(self, char *itemp):
14473 * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
14474 * return self.to_object_func(itemp)
14475 * else:
14476 */
14477 }
14478
14479 /* "View.MemoryView":983
14480 * return self.to_object_func(itemp)
14481 * else:
14482 * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
14483 *
14484 * cdef assign_item_from_object(self, char *itemp, object value):
14485 */
14486 /*else*/ {
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;
14491 __pyx_t_2 = 0;
14492 goto __pyx_L0;
14493 }
14494
14495 /* "View.MemoryView":979
14496 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
14497 *
14498 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
14499 * if self.to_object_func != NULL:
14500 * return self.to_object_func(itemp)
14501 */
14502
14503 /* function exit code */
14504 __pyx_L1_error:;
14505 __Pyx_XDECREF(__pyx_t_2);
14506 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14507 __pyx_r = 0;
14508 __pyx_L0:;
14509 __Pyx_XGIVEREF(__pyx_r);
14510 __Pyx_RefNannyFinishContext();
14511 return __pyx_r;
14512}
14513
14514/* "View.MemoryView":985
14515 * return memoryview.convert_item_to_object(self, itemp)
14516 *
14517 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
14518 * if self.to_dtype_func != NULL:
14519 * self.to_dtype_func(itemp, value)
14520 */
14521
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
14525 int __pyx_t_1;
14526 int __pyx_t_2;
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);
14532
14533 /* "View.MemoryView":986
14534 *
14535 * cdef assign_item_from_object(self, char *itemp, object value):
14536 * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
14537 * self.to_dtype_func(itemp, value)
14538 * else:
14539 */
14540 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
14541 if (__pyx_t_1) {
14542
14543 /* "View.MemoryView":987
14544 * cdef assign_item_from_object(self, char *itemp, object value):
14545 * if self.to_dtype_func != NULL:
14546 * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
14547 * else:
14548 * memoryview.assign_item_from_object(self, itemp, value)
14549 */
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)
14551
14552 /* "View.MemoryView":986
14553 *
14554 * cdef assign_item_from_object(self, char *itemp, object value):
14555 * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
14556 * self.to_dtype_func(itemp, value)
14557 * else:
14558 */
14559 goto __pyx_L3;
14560 }
14561
14562 /* "View.MemoryView":989
14563 * self.to_dtype_func(itemp, value)
14564 * else:
14565 * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
14566 *
14567 * @property
14568 */
14569 /*else*/ {
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;
14573 }
14574 __pyx_L3:;
14575
14576 /* "View.MemoryView":985
14577 * return memoryview.convert_item_to_object(self, itemp)
14578 *
14579 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
14580 * if self.to_dtype_func != NULL:
14581 * self.to_dtype_func(itemp, value)
14582 */
14583
14584 /* function exit code */
14585 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14586 goto __pyx_L0;
14587 __pyx_L1_error:;
14588 __Pyx_XDECREF(__pyx_t_3);
14589 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14590 __pyx_r = 0;
14591 __pyx_L0:;
14592 __Pyx_XGIVEREF(__pyx_r);
14593 __Pyx_RefNannyFinishContext();
14594 return __pyx_r;
14595}
14596
14597/* "View.MemoryView":992
14598 *
14599 * @property
14600 * def base(self): # <<<<<<<<<<<<<<
14601 * return self.from_object
14602 *
14603 */
14604
14605/* Python wrapper */
14606static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
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));
14612
14613 /* function exit code */
14614 __Pyx_RefNannyFinishContext();
14615 return __pyx_r;
14616}
14617
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);
14622
14623 /* "View.MemoryView":993
14624 * @property
14625 * def base(self):
14626 * return self.from_object # <<<<<<<<<<<<<<
14627 *
14628 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
14629 */
14630 __Pyx_XDECREF(__pyx_r);
14631 __Pyx_INCREF(__pyx_v_self->from_object);
14632 __pyx_r = __pyx_v_self->from_object;
14633 goto __pyx_L0;
14634
14635 /* "View.MemoryView":992
14636 *
14637 * @property
14638 * def base(self): # <<<<<<<<<<<<<<
14639 * return self.from_object
14640 *
14641 */
14642
14643 /* function exit code */
14644 __pyx_L0:;
14645 __Pyx_XGIVEREF(__pyx_r);
14646 __Pyx_RefNannyFinishContext();
14647 return __pyx_r;
14648}
14649
14650/* "(tree fragment)":1
14651 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
14652 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14653 * def __setstate_cython__(self, __pyx_state):
14654 */
14655
14656/* Python wrapper */
14657static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
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));
14663
14664 /* function exit code */
14665 __Pyx_RefNannyFinishContext();
14666 return __pyx_r;
14667}
14668
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);
14677
14678 /* "(tree fragment)":2
14679 * def __reduce_cython__(self):
14680 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
14681 * def __setstate_cython__(self, __pyx_state):
14682 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14683 */
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)
14689
14690 /* "(tree fragment)":1
14691 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
14692 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14693 * def __setstate_cython__(self, __pyx_state):
14694 */
14695
14696 /* function exit code */
14697 __pyx_L1_error:;
14698 __Pyx_XDECREF(__pyx_t_1);
14699 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14700 __pyx_r = NULL;
14701 __Pyx_XGIVEREF(__pyx_r);
14702 __Pyx_RefNannyFinishContext();
14703 return __pyx_r;
14704}
14705
14706/* "(tree fragment)":3
14707 * def __reduce_cython__(self):
14708 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14709 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
14710 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14711 */
14712
14713/* Python wrapper */
14714static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
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));
14720
14721 /* function exit code */
14722 __Pyx_RefNannyFinishContext();
14723 return __pyx_r;
14724}
14725
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);
14734
14735 /* "(tree fragment)":4
14736 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14737 * def __setstate_cython__(self, __pyx_state):
14738 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
14739 */
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)
14745
14746 /* "(tree fragment)":3
14747 * def __reduce_cython__(self):
14748 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14749 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
14750 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14751 */
14752
14753 /* function exit code */
14754 __pyx_L1_error:;
14755 __Pyx_XDECREF(__pyx_t_1);
14756 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14757 __pyx_r = NULL;
14758 __Pyx_XGIVEREF(__pyx_r);
14759 __Pyx_RefNannyFinishContext();
14760 return __pyx_r;
14761}
14762
14763/* "View.MemoryView":999
14764 *
14765 * @cname('__pyx_memoryview_fromslice')
14766 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
14767 * int ndim,
14768 * object (*to_object_func)(char *),
14769 */
14770
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
14777 int __pyx_t_1;
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);
14790
14791 /* "View.MemoryView":1007
14792 * cdef _memoryviewslice result
14793 *
14794 * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
14795 * return None
14796 *
14797 */
14798 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
14799 if (__pyx_t_1) {
14800
14801 /* "View.MemoryView":1008
14802 *
14803 * if <PyObject *> memviewslice.memview == Py_None:
14804 * return None # <<<<<<<<<<<<<<
14805 *
14806 *
14807 */
14808 __Pyx_XDECREF(__pyx_r);
14809 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14810 goto __pyx_L0;
14811
14812 /* "View.MemoryView":1007
14813 * cdef _memoryviewslice result
14814 *
14815 * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
14816 * return None
14817 *
14818 */
14819 }
14820
14821 /* "View.MemoryView":1013
14822 *
14823 *
14824 * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<<
14825 *
14826 * result.from_slice = memviewslice
14827 */
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);
14840 __pyx_t_2 = 0;
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);
14845 __pyx_t_2 = 0;
14846
14847 /* "View.MemoryView":1015
14848 * result = _memoryviewslice(None, 0, dtype_is_object)
14849 *
14850 * result.from_slice = memviewslice # <<<<<<<<<<<<<<
14851 * __PYX_INC_MEMVIEW(&memviewslice, 1)
14852 *
14853 */
14854 __pyx_v_result->from_slice = __pyx_v_memviewslice;
14855
14856 /* "View.MemoryView":1016
14857 *
14858 * result.from_slice = memviewslice
14859 * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
14860 *
14861 * result.from_object = (<memoryview> memviewslice.memview).base
14862 */
14863 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
14864
14865 /* "View.MemoryView":1018
14866 * __PYX_INC_MEMVIEW(&memviewslice, 1)
14867 *
14868 * result.from_object = (<memoryview> memviewslice.memview).base # <<<<<<<<<<<<<<
14869 * result.typeinfo = memviewslice.memview.typeinfo
14870 *
14871 */
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;
14878 __pyx_t_2 = 0;
14879
14880 /* "View.MemoryView":1019
14881 *
14882 * result.from_object = (<memoryview> memviewslice.memview).base
14883 * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
14884 *
14885 * result.view = memviewslice.memview.view
14886 */
14887 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
14888 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
14889
14890 /* "View.MemoryView":1021
14891 * result.typeinfo = memviewslice.memview.typeinfo
14892 *
14893 * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
14894 * result.view.buf = <void *> memviewslice.data
14895 * result.view.ndim = ndim
14896 */
14897 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
14898 __pyx_v_result->__pyx_base.view = __pyx_t_5;
14899
14900 /* "View.MemoryView":1022
14901 *
14902 * result.view = memviewslice.memview.view
14903 * result.view.buf = <void *> memviewslice.data # <<<<<<<<<<<<<<
14904 * result.view.ndim = ndim
14905 * (<__pyx_buffer *> &result.view).obj = Py_None
14906 */
14907 __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
14908
14909 /* "View.MemoryView":1023
14910 * result.view = memviewslice.memview.view
14911 * result.view.buf = <void *> memviewslice.data
14912 * result.view.ndim = ndim # <<<<<<<<<<<<<<
14913 * (<__pyx_buffer *> &result.view).obj = Py_None
14914 * Py_INCREF(Py_None)
14915 */
14916 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
14917
14918 /* "View.MemoryView":1024
14919 * result.view.buf = <void *> memviewslice.data
14920 * result.view.ndim = ndim
14921 * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
14922 * Py_INCREF(Py_None)
14923 *
14924 */
14925 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
14926
14927 /* "View.MemoryView":1025
14928 * result.view.ndim = ndim
14929 * (<__pyx_buffer *> &result.view).obj = Py_None
14930 * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
14931 *
14932 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
14933 */
14934 Py_INCREF(Py_None);
14935
14936 /* "View.MemoryView":1027
14937 * Py_INCREF(Py_None)
14938 *
14939 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
14940 * result.flags = PyBUF_RECORDS
14941 * else:
14942 */
14943 __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
14944 if (__pyx_t_1) {
14945
14946 /* "View.MemoryView":1028
14947 *
14948 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
14949 * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
14950 * else:
14951 * result.flags = PyBUF_RECORDS_RO
14952 */
14953 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
14954
14955 /* "View.MemoryView":1027
14956 * Py_INCREF(Py_None)
14957 *
14958 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
14959 * result.flags = PyBUF_RECORDS
14960 * else:
14961 */
14962 goto __pyx_L4;
14963 }
14964
14965 /* "View.MemoryView":1030
14966 * result.flags = PyBUF_RECORDS
14967 * else:
14968 * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
14969 *
14970 * result.view.shape = <Py_ssize_t *> result.from_slice.shape
14971 */
14972 /*else*/ {
14973 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
14974 }
14975 __pyx_L4:;
14976
14977 /* "View.MemoryView":1032
14978 * result.flags = PyBUF_RECORDS_RO
14979 *
14980 * result.view.shape = <Py_ssize_t *> result.from_slice.shape # <<<<<<<<<<<<<<
14981 * result.view.strides = <Py_ssize_t *> result.from_slice.strides
14982 *
14983 */
14984 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
14985
14986 /* "View.MemoryView":1033
14987 *
14988 * result.view.shape = <Py_ssize_t *> result.from_slice.shape
14989 * result.view.strides = <Py_ssize_t *> result.from_slice.strides # <<<<<<<<<<<<<<
14990 *
14991 *
14992 */
14993 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
14994
14995 /* "View.MemoryView":1036
14996 *
14997 *
14998 * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
14999 * for suboffset in result.from_slice.suboffsets[:ndim]:
15000 * if suboffset >= 0:
15001 */
15002 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
15003
15004 /* "View.MemoryView":1037
15005 *
15006 * result.view.suboffsets = NULL
15007 * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
15008 * if suboffset >= 0:
15009 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
15010 */
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]);
15015
15016 /* "View.MemoryView":1038
15017 * result.view.suboffsets = NULL
15018 * for suboffset in result.from_slice.suboffsets[:ndim]:
15019 * if suboffset >= 0: # <<<<<<<<<<<<<<
15020 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
15021 * break
15022 */
15023 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
15024 if (__pyx_t_1) {
15025
15026 /* "View.MemoryView":1039
15027 * for suboffset in result.from_slice.suboffsets[:ndim]:
15028 * if suboffset >= 0:
15029 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets # <<<<<<<<<<<<<<
15030 * break
15031 *
15032 */
15033 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
15034
15035 /* "View.MemoryView":1040
15036 * if suboffset >= 0:
15037 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
15038 * break # <<<<<<<<<<<<<<
15039 *
15040 * result.view.len = result.view.itemsize
15041 */
15042 goto __pyx_L6_break;
15043
15044 /* "View.MemoryView":1038
15045 * result.view.suboffsets = NULL
15046 * for suboffset in result.from_slice.suboffsets[:ndim]:
15047 * if suboffset >= 0: # <<<<<<<<<<<<<<
15048 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
15049 * break
15050 */
15051 }
15052 }
15053 __pyx_L6_break:;
15054
15055 /* "View.MemoryView":1042
15056 * break
15057 *
15058 * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
15059 * for length in result.view.shape[:ndim]:
15060 * result.view.len *= length
15061 */
15062 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
15063 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
15064
15065 /* "View.MemoryView":1043
15066 *
15067 * result.view.len = result.view.itemsize
15068 * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
15069 * result.view.len *= length
15070 *
15071 */
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);
15078 __pyx_t_2 = 0;
15079
15080 /* "View.MemoryView":1044
15081 * result.view.len = result.view.itemsize
15082 * for length in result.view.shape[:ndim]:
15083 * result.view.len *= length # <<<<<<<<<<<<<<
15084 *
15085 * result.to_object_func = to_object_func
15086 */
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;
15095 }
15096
15097 /* "View.MemoryView":1046
15098 * result.view.len *= length
15099 *
15100 * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
15101 * result.to_dtype_func = to_dtype_func
15102 *
15103 */
15104 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
15105
15106 /* "View.MemoryView":1047
15107 *
15108 * result.to_object_func = to_object_func
15109 * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
15110 *
15111 * return result
15112 */
15113 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
15114
15115 /* "View.MemoryView":1049
15116 * result.to_dtype_func = to_dtype_func
15117 *
15118 * return result # <<<<<<<<<<<<<<
15119 *
15120 * @cname('__pyx_memoryview_get_slice_from_memoryview')
15121 */
15122 __Pyx_XDECREF(__pyx_r);
15123 __Pyx_INCREF(((PyObject *)__pyx_v_result));
15124 __pyx_r = ((PyObject *)__pyx_v_result);
15125 goto __pyx_L0;
15126
15127 /* "View.MemoryView":999
15128 *
15129 * @cname('__pyx_memoryview_fromslice')
15130 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
15131 * int ndim,
15132 * object (*to_object_func)(char *),
15133 */
15134
15135 /* function exit code */
15136 __pyx_L1_error:;
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);
15140 __pyx_r = 0;
15141 __pyx_L0:;
15142 __Pyx_XDECREF((PyObject *)__pyx_v_result);
15143 __Pyx_XDECREF(__pyx_v_length);
15144 __Pyx_XGIVEREF(__pyx_r);
15145 __Pyx_RefNannyFinishContext();
15146 return __pyx_r;
15147}
15148
15149/* "View.MemoryView":1052
15150 *
15151 * @cname('__pyx_memoryview_get_slice_from_memoryview')
15152 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
15153 * __Pyx_memviewslice *mslice) except NULL:
15154 * cdef _memoryviewslice obj
15155 */
15156
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
15161 int __pyx_t_1;
15162 int __pyx_t_2;
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);
15168
15169 /* "View.MemoryView":1055
15170 * __Pyx_memviewslice *mslice) except NULL:
15171 * cdef _memoryviewslice obj
15172 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
15173 * obj = memview
15174 * return &obj.from_slice
15175 */
15176 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15177 __pyx_t_2 = (__pyx_t_1 != 0);
15178 if (__pyx_t_2) {
15179
15180 /* "View.MemoryView":1056
15181 * cdef _memoryviewslice obj
15182 * if isinstance(memview, _memoryviewslice):
15183 * obj = memview # <<<<<<<<<<<<<<
15184 * return &obj.from_slice
15185 * else:
15186 */
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);
15191 __pyx_t_3 = 0;
15192
15193 /* "View.MemoryView":1057
15194 * if isinstance(memview, _memoryviewslice):
15195 * obj = memview
15196 * return &obj.from_slice # <<<<<<<<<<<<<<
15197 * else:
15198 * slice_copy(memview, mslice)
15199 */
15200 __pyx_r = (&__pyx_v_obj->from_slice);
15201 goto __pyx_L0;
15202
15203 /* "View.MemoryView":1055
15204 * __Pyx_memviewslice *mslice) except NULL:
15205 * cdef _memoryviewslice obj
15206 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
15207 * obj = memview
15208 * return &obj.from_slice
15209 */
15210 }
15211
15212 /* "View.MemoryView":1059
15213 * return &obj.from_slice
15214 * else:
15215 * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
15216 * return mslice
15217 *
15218 */
15219 /*else*/ {
15220 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
15221
15222 /* "View.MemoryView":1060
15223 * else:
15224 * slice_copy(memview, mslice)
15225 * return mslice # <<<<<<<<<<<<<<
15226 *
15227 * @cname('__pyx_memoryview_slice_copy')
15228 */
15229 __pyx_r = __pyx_v_mslice;
15230 goto __pyx_L0;
15231 }
15232
15233 /* "View.MemoryView":1052
15234 *
15235 * @cname('__pyx_memoryview_get_slice_from_memoryview')
15236 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
15237 * __Pyx_memviewslice *mslice) except NULL:
15238 * cdef _memoryviewslice obj
15239 */
15240
15241 /* function exit code */
15242 __pyx_L1_error:;
15243 __Pyx_XDECREF(__pyx_t_3);
15244 __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
15245 __pyx_r = NULL;
15246 __pyx_L0:;
15247 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
15248 __Pyx_RefNannyFinishContext();
15249 return __pyx_r;
15250}
15251
15252/* "View.MemoryView":1063
15253 *
15254 * @cname('__pyx_memoryview_slice_copy')
15255 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
15256 * cdef int dim
15257 * cdef (Py_ssize_t*) shape, strides, suboffsets
15258 */
15259
15260static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
15261 int __pyx_v_dim;
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;
15267 int __pyx_t_2;
15268 int __pyx_t_3;
15269 int __pyx_t_4;
15270 Py_ssize_t __pyx_t_5;
15271 __Pyx_RefNannySetupContext("slice_copy", 0);
15272
15273 /* "View.MemoryView":1067
15274 * cdef (Py_ssize_t*) shape, strides, suboffsets
15275 *
15276 * shape = memview.view.shape # <<<<<<<<<<<<<<
15277 * strides = memview.view.strides
15278 * suboffsets = memview.view.suboffsets
15279 */
15280 __pyx_t_1 = __pyx_v_memview->view.shape;
15281 __pyx_v_shape = __pyx_t_1;
15282
15283 /* "View.MemoryView":1068
15284 *
15285 * shape = memview.view.shape
15286 * strides = memview.view.strides # <<<<<<<<<<<<<<
15287 * suboffsets = memview.view.suboffsets
15288 *
15289 */
15290 __pyx_t_1 = __pyx_v_memview->view.strides;
15291 __pyx_v_strides = __pyx_t_1;
15292
15293 /* "View.MemoryView":1069
15294 * shape = memview.view.shape
15295 * strides = memview.view.strides
15296 * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
15297 *
15298 * dst.memview = <__pyx_memoryview *> memview
15299 */
15300 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
15301 __pyx_v_suboffsets = __pyx_t_1;
15302
15303 /* "View.MemoryView":1071
15304 * suboffsets = memview.view.suboffsets
15305 *
15306 * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
15307 * dst.data = <char *> memview.view.buf
15308 *
15309 */
15310 __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
15311
15312 /* "View.MemoryView":1072
15313 *
15314 * dst.memview = <__pyx_memoryview *> memview
15315 * dst.data = <char *> memview.view.buf # <<<<<<<<<<<<<<
15316 *
15317 * for dim in range(memview.view.ndim):
15318 */
15319 __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
15320
15321 /* "View.MemoryView":1074
15322 * dst.data = <char *> memview.view.buf
15323 *
15324 * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
15325 * dst.shape[dim] = shape[dim]
15326 * dst.strides[dim] = strides[dim]
15327 */
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;
15332
15333 /* "View.MemoryView":1075
15334 *
15335 * for dim in range(memview.view.ndim):
15336 * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
15337 * dst.strides[dim] = strides[dim]
15338 * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
15339 */
15340 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
15341
15342 /* "View.MemoryView":1076
15343 * for dim in range(memview.view.ndim):
15344 * dst.shape[dim] = shape[dim]
15345 * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
15346 * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
15347 *
15348 */
15349 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
15350
15351 /* "View.MemoryView":1077
15352 * dst.shape[dim] = shape[dim]
15353 * dst.strides[dim] = strides[dim]
15354 * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
15355 *
15356 * @cname('__pyx_memoryview_copy_object')
15357 */
15358 if ((__pyx_v_suboffsets != 0)) {
15359 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
15360 } else {
15361 __pyx_t_5 = -1L;
15362 }
15363 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
15364 }
15365
15366 /* "View.MemoryView":1063
15367 *
15368 * @cname('__pyx_memoryview_slice_copy')
15369 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
15370 * cdef int dim
15371 * cdef (Py_ssize_t*) shape, strides, suboffsets
15372 */
15373
15374 /* function exit code */
15375 __Pyx_RefNannyFinishContext();
15376}
15377
15378/* "View.MemoryView":1080
15379 *
15380 * @cname('__pyx_memoryview_copy_object')
15381 * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
15382 * "Create a new memoryview object"
15383 * cdef __Pyx_memviewslice memviewslice
15384 */
15385
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);
15395
15396 /* "View.MemoryView":1083
15397 * "Create a new memoryview object"
15398 * cdef __Pyx_memviewslice memviewslice
15399 * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
15400 * return memoryview_copy_from_slice(memview, &memviewslice)
15401 *
15402 */
15403 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
15404
15405 /* "View.MemoryView":1084
15406 * cdef __Pyx_memviewslice memviewslice
15407 * slice_copy(memview, &memviewslice)
15408 * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
15409 *
15410 * @cname('__pyx_memoryview_copy_object_from_slice')
15411 */
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;
15416 __pyx_t_1 = 0;
15417 goto __pyx_L0;
15418
15419 /* "View.MemoryView":1080
15420 *
15421 * @cname('__pyx_memoryview_copy_object')
15422 * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
15423 * "Create a new memoryview object"
15424 * cdef __Pyx_memviewslice memviewslice
15425 */
15426
15427 /* function exit code */
15428 __pyx_L1_error:;
15429 __Pyx_XDECREF(__pyx_t_1);
15430 __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
15431 __pyx_r = 0;
15432 __pyx_L0:;
15433 __Pyx_XGIVEREF(__pyx_r);
15434 __Pyx_RefNannyFinishContext();
15435 return __pyx_r;
15436}
15437
15438/* "View.MemoryView":1087
15439 *
15440 * @cname('__pyx_memoryview_copy_object_from_slice')
15441 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
15442 * """
15443 * Create a new memoryview object from a given memoryview object and slice.
15444 */
15445
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
15451 int __pyx_t_1;
15452 int __pyx_t_2;
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);
15460
15461 /* "View.MemoryView":1094
15462 * cdef int (*to_dtype_func)(char *, object) except 0
15463 *
15464 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
15465 * to_object_func = (<_memoryviewslice> memview).to_object_func
15466 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
15467 */
15468 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15469 __pyx_t_2 = (__pyx_t_1 != 0);
15470 if (__pyx_t_2) {
15471
15472 /* "View.MemoryView":1095
15473 *
15474 * if isinstance(memview, _memoryviewslice):
15475 * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
15476 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
15477 * else:
15478 */
15479 __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
15480 __pyx_v_to_object_func = __pyx_t_3;
15481
15482 /* "View.MemoryView":1096
15483 * if isinstance(memview, _memoryviewslice):
15484 * to_object_func = (<_memoryviewslice> memview).to_object_func
15485 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
15486 * else:
15487 * to_object_func = NULL
15488 */
15489 __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
15490 __pyx_v_to_dtype_func = __pyx_t_4;
15491
15492 /* "View.MemoryView":1094
15493 * cdef int (*to_dtype_func)(char *, object) except 0
15494 *
15495 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
15496 * to_object_func = (<_memoryviewslice> memview).to_object_func
15497 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
15498 */
15499 goto __pyx_L3;
15500 }
15501
15502 /* "View.MemoryView":1098
15503 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
15504 * else:
15505 * to_object_func = NULL # <<<<<<<<<<<<<<
15506 * to_dtype_func = NULL
15507 *
15508 */
15509 /*else*/ {
15510 __pyx_v_to_object_func = NULL;
15511
15512 /* "View.MemoryView":1099
15513 * else:
15514 * to_object_func = NULL
15515 * to_dtype_func = NULL # <<<<<<<<<<<<<<
15516 *
15517 * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
15518 */
15519 __pyx_v_to_dtype_func = NULL;
15520 }
15521 __pyx_L3:;
15522
15523 /* "View.MemoryView":1101
15524 * to_dtype_func = NULL
15525 *
15526 * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
15527 * to_object_func, to_dtype_func,
15528 * memview.dtype_is_object)
15529 */
15530 __Pyx_XDECREF(__pyx_r);
15531
15532 /* "View.MemoryView":1103
15533 * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
15534 * to_object_func, to_dtype_func,
15535 * memview.dtype_is_object) # <<<<<<<<<<<<<<
15536 *
15537 *
15538 */
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;
15542 __pyx_t_5 = 0;
15543 goto __pyx_L0;
15544
15545 /* "View.MemoryView":1087
15546 *
15547 * @cname('__pyx_memoryview_copy_object_from_slice')
15548 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
15549 * """
15550 * Create a new memoryview object from a given memoryview object and slice.
15551 */
15552
15553 /* function exit code */
15554 __pyx_L1_error:;
15555 __Pyx_XDECREF(__pyx_t_5);
15556 __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15557 __pyx_r = 0;
15558 __pyx_L0:;
15559 __Pyx_XGIVEREF(__pyx_r);
15560 __Pyx_RefNannyFinishContext();
15561 return __pyx_r;
15562}
15563
15564/* "View.MemoryView":1109
15565 *
15566 *
15567 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
15568 * if arg < 0:
15569 * return -arg
15570 */
15571
15572static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
15573 Py_ssize_t __pyx_r;
15574 int __pyx_t_1;
15575
15576 /* "View.MemoryView":1110
15577 *
15578 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
15579 * if arg < 0: # <<<<<<<<<<<<<<
15580 * return -arg
15581 * else:
15582 */
15583 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
15584 if (__pyx_t_1) {
15585
15586 /* "View.MemoryView":1111
15587 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
15588 * if arg < 0:
15589 * return -arg # <<<<<<<<<<<<<<
15590 * else:
15591 * return arg
15592 */
15593 __pyx_r = (-__pyx_v_arg);
15594 goto __pyx_L0;
15595
15596 /* "View.MemoryView":1110
15597 *
15598 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
15599 * if arg < 0: # <<<<<<<<<<<<<<
15600 * return -arg
15601 * else:
15602 */
15603 }
15604
15605 /* "View.MemoryView":1113
15606 * return -arg
15607 * else:
15608 * return arg # <<<<<<<<<<<<<<
15609 *
15610 * @cname('__pyx_get_best_slice_order')
15611 */
15612 /*else*/ {
15613 __pyx_r = __pyx_v_arg;
15614 goto __pyx_L0;
15615 }
15616
15617 /* "View.MemoryView":1109
15618 *
15619 *
15620 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
15621 * if arg < 0:
15622 * return -arg
15623 */
15624
15625 /* function exit code */
15626 __pyx_L0:;
15627 return __pyx_r;
15628}
15629
15630/* "View.MemoryView":1116
15631 *
15632 * @cname('__pyx_get_best_slice_order')
15633 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
15634 * """
15635 * Figure out the best memory access order for a given slice.
15636 */
15637
15638static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
15639 int __pyx_v_i;
15640 Py_ssize_t __pyx_v_c_stride;
15641 Py_ssize_t __pyx_v_f_stride;
15642 char __pyx_r;
15643 int __pyx_t_1;
15644 int __pyx_t_2;
15645 int __pyx_t_3;
15646 int __pyx_t_4;
15647
15648 /* "View.MemoryView":1121
15649 * """
15650 * cdef int i
15651 * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
15652 * cdef Py_ssize_t f_stride = 0
15653 *
15654 */
15655 __pyx_v_c_stride = 0;
15656
15657 /* "View.MemoryView":1122
15658 * cdef int i
15659 * cdef Py_ssize_t c_stride = 0
15660 * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
15661 *
15662 * for i in range(ndim - 1, -1, -1):
15663 */
15664 __pyx_v_f_stride = 0;
15665
15666 /* "View.MemoryView":1124
15667 * cdef Py_ssize_t f_stride = 0
15668 *
15669 * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
15670 * if mslice.shape[i] > 1:
15671 * c_stride = mslice.strides[i]
15672 */
15673 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
15674 __pyx_v_i = __pyx_t_1;
15675
15676 /* "View.MemoryView":1125
15677 *
15678 * for i in range(ndim - 1, -1, -1):
15679 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
15680 * c_stride = mslice.strides[i]
15681 * break
15682 */
15683 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
15684 if (__pyx_t_2) {
15685
15686 /* "View.MemoryView":1126
15687 * for i in range(ndim - 1, -1, -1):
15688 * if mslice.shape[i] > 1:
15689 * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
15690 * break
15691 *
15692 */
15693 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
15694
15695 /* "View.MemoryView":1127
15696 * if mslice.shape[i] > 1:
15697 * c_stride = mslice.strides[i]
15698 * break # <<<<<<<<<<<<<<
15699 *
15700 * for i in range(ndim):
15701 */
15702 goto __pyx_L4_break;
15703
15704 /* "View.MemoryView":1125
15705 *
15706 * for i in range(ndim - 1, -1, -1):
15707 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
15708 * c_stride = mslice.strides[i]
15709 * break
15710 */
15711 }
15712 }
15713 __pyx_L4_break:;
15714
15715 /* "View.MemoryView":1129
15716 * break
15717 *
15718 * for i in range(ndim): # <<<<<<<<<<<<<<
15719 * if mslice.shape[i] > 1:
15720 * f_stride = mslice.strides[i]
15721 */
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;
15726
15727 /* "View.MemoryView":1130
15728 *
15729 * for i in range(ndim):
15730 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
15731 * f_stride = mslice.strides[i]
15732 * break
15733 */
15734 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
15735 if (__pyx_t_2) {
15736
15737 /* "View.MemoryView":1131
15738 * for i in range(ndim):
15739 * if mslice.shape[i] > 1:
15740 * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
15741 * break
15742 *
15743 */
15744 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
15745
15746 /* "View.MemoryView":1132
15747 * if mslice.shape[i] > 1:
15748 * f_stride = mslice.strides[i]
15749 * break # <<<<<<<<<<<<<<
15750 *
15751 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
15752 */
15753 goto __pyx_L7_break;
15754
15755 /* "View.MemoryView":1130
15756 *
15757 * for i in range(ndim):
15758 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
15759 * f_stride = mslice.strides[i]
15760 * break
15761 */
15762 }
15763 }
15764 __pyx_L7_break:;
15765
15766 /* "View.MemoryView":1134
15767 * break
15768 *
15769 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
15770 * return 'C'
15771 * else:
15772 */
15773 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
15774 if (__pyx_t_2) {
15775
15776 /* "View.MemoryView":1135
15777 *
15778 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
15779 * return 'C' # <<<<<<<<<<<<<<
15780 * else:
15781 * return 'F'
15782 */
15783 __pyx_r = 'C';
15784 goto __pyx_L0;
15785
15786 /* "View.MemoryView":1134
15787 * break
15788 *
15789 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
15790 * return 'C'
15791 * else:
15792 */
15793 }
15794
15795 /* "View.MemoryView":1137
15796 * return 'C'
15797 * else:
15798 * return 'F' # <<<<<<<<<<<<<<
15799 *
15800 * @cython.cdivision(True)
15801 */
15802 /*else*/ {
15803 __pyx_r = 'F';
15804 goto __pyx_L0;
15805 }
15806
15807 /* "View.MemoryView":1116
15808 *
15809 * @cname('__pyx_get_best_slice_order')
15810 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
15811 * """
15812 * Figure out the best memory access order for a given slice.
15813 */
15814
15815 /* function exit code */
15816 __pyx_L0:;
15817 return __pyx_r;
15818}
15819
15820/* "View.MemoryView":1140
15821 *
15822 * @cython.cdivision(True)
15823 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
15824 * char *dst_data, Py_ssize_t *dst_strides,
15825 * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
15826 */
15827
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;
15834 int __pyx_t_1;
15835 int __pyx_t_2;
15836 int __pyx_t_3;
15837 Py_ssize_t __pyx_t_4;
15838 Py_ssize_t __pyx_t_5;
15839 Py_ssize_t __pyx_t_6;
15840
15841 /* "View.MemoryView":1147
15842 *
15843 * cdef Py_ssize_t i
15844 * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
15845 * cdef Py_ssize_t dst_extent = dst_shape[0]
15846 * cdef Py_ssize_t src_stride = src_strides[0]
15847 */
15848 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
15849
15850 /* "View.MemoryView":1148
15851 * cdef Py_ssize_t i
15852 * cdef Py_ssize_t src_extent = src_shape[0]
15853 * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
15854 * cdef Py_ssize_t src_stride = src_strides[0]
15855 * cdef Py_ssize_t dst_stride = dst_strides[0]
15856 */
15857 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
15858
15859 /* "View.MemoryView":1149
15860 * cdef Py_ssize_t src_extent = src_shape[0]
15861 * cdef Py_ssize_t dst_extent = dst_shape[0]
15862 * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
15863 * cdef Py_ssize_t dst_stride = dst_strides[0]
15864 *
15865 */
15866 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
15867
15868 /* "View.MemoryView":1150
15869 * cdef Py_ssize_t dst_extent = dst_shape[0]
15870 * cdef Py_ssize_t src_stride = src_strides[0]
15871 * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
15872 *
15873 * if ndim == 1:
15874 */
15875 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
15876
15877 /* "View.MemoryView":1152
15878 * cdef Py_ssize_t dst_stride = dst_strides[0]
15879 *
15880 * if ndim == 1: # <<<<<<<<<<<<<<
15881 * if (src_stride > 0 and dst_stride > 0 and
15882 * <size_t> src_stride == itemsize == <size_t> dst_stride):
15883 */
15884 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
15885 if (__pyx_t_1) {
15886
15887 /* "View.MemoryView":1153
15888 *
15889 * if ndim == 1:
15890 * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
15891 * <size_t> src_stride == itemsize == <size_t> dst_stride):
15892 * memcpy(dst_data, src_data, itemsize * dst_extent)
15893 */
15894 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
15895 if (__pyx_t_2) {
15896 } else {
15897 __pyx_t_1 = __pyx_t_2;
15898 goto __pyx_L5_bool_binop_done;
15899 }
15900 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
15901 if (__pyx_t_2) {
15902 } else {
15903 __pyx_t_1 = __pyx_t_2;
15904 goto __pyx_L5_bool_binop_done;
15905 }
15906
15907 /* "View.MemoryView":1154
15908 * if ndim == 1:
15909 * if (src_stride > 0 and dst_stride > 0 and
15910 * <size_t> src_stride == itemsize == <size_t> dst_stride): # <<<<<<<<<<<<<<
15911 * memcpy(dst_data, src_data, itemsize * dst_extent)
15912 * else:
15913 */
15914 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
15915 if (__pyx_t_2) {
15916 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
15917 }
15918 __pyx_t_3 = (__pyx_t_2 != 0);
15919 __pyx_t_1 = __pyx_t_3;
15920 __pyx_L5_bool_binop_done:;
15921
15922 /* "View.MemoryView":1153
15923 *
15924 * if ndim == 1:
15925 * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
15926 * <size_t> src_stride == itemsize == <size_t> dst_stride):
15927 * memcpy(dst_data, src_data, itemsize * dst_extent)
15928 */
15929 if (__pyx_t_1) {
15930
15931 /* "View.MemoryView":1155
15932 * if (src_stride > 0 and dst_stride > 0 and
15933 * <size_t> src_stride == itemsize == <size_t> dst_stride):
15934 * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
15935 * else:
15936 * for i in range(dst_extent):
15937 */
15938 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
15939
15940 /* "View.MemoryView":1153
15941 *
15942 * if ndim == 1:
15943 * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
15944 * <size_t> src_stride == itemsize == <size_t> dst_stride):
15945 * memcpy(dst_data, src_data, itemsize * dst_extent)
15946 */
15947 goto __pyx_L4;
15948 }
15949
15950 /* "View.MemoryView":1157
15951 * memcpy(dst_data, src_data, itemsize * dst_extent)
15952 * else:
15953 * for i in range(dst_extent): # <<<<<<<<<<<<<<
15954 * memcpy(dst_data, src_data, itemsize)
15955 * src_data += src_stride
15956 */
15957 /*else*/ {
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;
15962
15963 /* "View.MemoryView":1158
15964 * else:
15965 * for i in range(dst_extent):
15966 * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
15967 * src_data += src_stride
15968 * dst_data += dst_stride
15969 */
15970 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
15971
15972 /* "View.MemoryView":1159
15973 * for i in range(dst_extent):
15974 * memcpy(dst_data, src_data, itemsize)
15975 * src_data += src_stride # <<<<<<<<<<<<<<
15976 * dst_data += dst_stride
15977 * else:
15978 */
15979 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
15980
15981 /* "View.MemoryView":1160
15982 * memcpy(dst_data, src_data, itemsize)
15983 * src_data += src_stride
15984 * dst_data += dst_stride # <<<<<<<<<<<<<<
15985 * else:
15986 * for i in range(dst_extent):
15987 */
15988 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
15989 }
15990 }
15991 __pyx_L4:;
15992
15993 /* "View.MemoryView":1152
15994 * cdef Py_ssize_t dst_stride = dst_strides[0]
15995 *
15996 * if ndim == 1: # <<<<<<<<<<<<<<
15997 * if (src_stride > 0 and dst_stride > 0 and
15998 * <size_t> src_stride == itemsize == <size_t> dst_stride):
15999 */
16000 goto __pyx_L3;
16001 }
16002
16003 /* "View.MemoryView":1162
16004 * dst_data += dst_stride
16005 * else:
16006 * for i in range(dst_extent): # <<<<<<<<<<<<<<
16007 * _copy_strided_to_strided(src_data, src_strides + 1,
16008 * dst_data, dst_strides + 1,
16009 */
16010 /*else*/ {
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;
16015
16016 /* "View.MemoryView":1163
16017 * else:
16018 * for i in range(dst_extent):
16019 * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
16020 * dst_data, dst_strides + 1,
16021 * src_shape + 1, dst_shape + 1,
16022 */
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);
16024
16025 /* "View.MemoryView":1167
16026 * src_shape + 1, dst_shape + 1,
16027 * ndim - 1, itemsize)
16028 * src_data += src_stride # <<<<<<<<<<<<<<
16029 * dst_data += dst_stride
16030 *
16031 */
16032 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
16033
16034 /* "View.MemoryView":1168
16035 * ndim - 1, itemsize)
16036 * src_data += src_stride
16037 * dst_data += dst_stride # <<<<<<<<<<<<<<
16038 *
16039 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
16040 */
16041 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
16042 }
16043 }
16044 __pyx_L3:;
16045
16046 /* "View.MemoryView":1140
16047 *
16048 * @cython.cdivision(True)
16049 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
16050 * char *dst_data, Py_ssize_t *dst_strides,
16051 * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
16052 */
16053
16054 /* function exit code */
16055}
16056
16057/* "View.MemoryView":1170
16058 * dst_data += dst_stride
16059 *
16060 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
16061 * __Pyx_memviewslice *dst,
16062 * int ndim, size_t itemsize) nogil:
16063 */
16064
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) {
16066
16067 /* "View.MemoryView":1173
16068 * __Pyx_memviewslice *dst,
16069 * int ndim, size_t itemsize) nogil:
16070 * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
16071 * src.shape, dst.shape, ndim, itemsize)
16072 *
16073 */
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);
16075
16076 /* "View.MemoryView":1170
16077 * dst_data += dst_stride
16078 *
16079 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
16080 * __Pyx_memviewslice *dst,
16081 * int ndim, size_t itemsize) nogil:
16082 */
16083
16084 /* function exit code */
16085}
16086
16087/* "View.MemoryView":1177
16088 *
16089 * @cname('__pyx_memoryview_slice_get_size')
16090 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
16091 * "Return the size of the memory occupied by the slice in number of bytes"
16092 * cdef Py_ssize_t shape, size = src.memview.view.itemsize
16093 */
16094
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;
16103
16104 /* "View.MemoryView":1179
16105 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
16106 * "Return the size of the memory occupied by the slice in number of bytes"
16107 * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
16108 *
16109 * for shape in src.shape[:ndim]:
16110 */
16111 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
16112 __pyx_v_size = __pyx_t_1;
16113
16114 /* "View.MemoryView":1181
16115 * cdef Py_ssize_t shape, size = src.memview.view.itemsize
16116 *
16117 * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
16118 * size *= shape
16119 *
16120 */
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]);
16125
16126 /* "View.MemoryView":1182
16127 *
16128 * for shape in src.shape[:ndim]:
16129 * size *= shape # <<<<<<<<<<<<<<
16130 *
16131 * return size
16132 */
16133 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
16134 }
16135
16136 /* "View.MemoryView":1184
16137 * size *= shape
16138 *
16139 * return size # <<<<<<<<<<<<<<
16140 *
16141 * @cname('__pyx_fill_contig_strides_array')
16142 */
16143 __pyx_r = __pyx_v_size;
16144 goto __pyx_L0;
16145
16146 /* "View.MemoryView":1177
16147 *
16148 * @cname('__pyx_memoryview_slice_get_size')
16149 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
16150 * "Return the size of the memory occupied by the slice in number of bytes"
16151 * cdef Py_ssize_t shape, size = src.memview.view.itemsize
16152 */
16153
16154 /* function exit code */
16155 __pyx_L0:;
16156 return __pyx_r;
16157}
16158
16159/* "View.MemoryView":1187
16160 *
16161 * @cname('__pyx_fill_contig_strides_array')
16162 * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
16163 * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
16164 * int ndim, char order) nogil:
16165 */
16166
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) {
16168 int __pyx_v_idx;
16169 Py_ssize_t __pyx_r;
16170 int __pyx_t_1;
16171 int __pyx_t_2;
16172 int __pyx_t_3;
16173 int __pyx_t_4;
16174
16175 /* "View.MemoryView":1196
16176 * cdef int idx
16177 *
16178 * if order == 'F': # <<<<<<<<<<<<<<
16179 * for idx in range(ndim):
16180 * strides[idx] = stride
16181 */
16182 __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
16183 if (__pyx_t_1) {
16184
16185 /* "View.MemoryView":1197
16186 *
16187 * if order == 'F':
16188 * for idx in range(ndim): # <<<<<<<<<<<<<<
16189 * strides[idx] = stride
16190 * stride *= shape[idx]
16191 */
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;
16196
16197 /* "View.MemoryView":1198
16198 * if order == 'F':
16199 * for idx in range(ndim):
16200 * strides[idx] = stride # <<<<<<<<<<<<<<
16201 * stride *= shape[idx]
16202 * else:
16203 */
16204 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
16205
16206 /* "View.MemoryView":1199
16207 * for idx in range(ndim):
16208 * strides[idx] = stride
16209 * stride *= shape[idx] # <<<<<<<<<<<<<<
16210 * else:
16211 * for idx in range(ndim - 1, -1, -1):
16212 */
16213 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
16214 }
16215
16216 /* "View.MemoryView":1196
16217 * cdef int idx
16218 *
16219 * if order == 'F': # <<<<<<<<<<<<<<
16220 * for idx in range(ndim):
16221 * strides[idx] = stride
16222 */
16223 goto __pyx_L3;
16224 }
16225
16226 /* "View.MemoryView":1201
16227 * stride *= shape[idx]
16228 * else:
16229 * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
16230 * strides[idx] = stride
16231 * stride *= shape[idx]
16232 */
16233 /*else*/ {
16234 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
16235 __pyx_v_idx = __pyx_t_2;
16236
16237 /* "View.MemoryView":1202
16238 * else:
16239 * for idx in range(ndim - 1, -1, -1):
16240 * strides[idx] = stride # <<<<<<<<<<<<<<
16241 * stride *= shape[idx]
16242 *
16243 */
16244 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
16245
16246 /* "View.MemoryView":1203
16247 * for idx in range(ndim - 1, -1, -1):
16248 * strides[idx] = stride
16249 * stride *= shape[idx] # <<<<<<<<<<<<<<
16250 *
16251 * return stride
16252 */
16253 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
16254 }
16255 }
16256 __pyx_L3:;
16257
16258 /* "View.MemoryView":1205
16259 * stride *= shape[idx]
16260 *
16261 * return stride # <<<<<<<<<<<<<<
16262 *
16263 * @cname('__pyx_memoryview_copy_data_to_temp')
16264 */
16265 __pyx_r = __pyx_v_stride;
16266 goto __pyx_L0;
16267
16268 /* "View.MemoryView":1187
16269 *
16270 * @cname('__pyx_fill_contig_strides_array')
16271 * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
16272 * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
16273 * int ndim, char order) nogil:
16274 */
16275
16276 /* function exit code */
16277 __pyx_L0:;
16278 return __pyx_r;
16279}
16280
16281/* "View.MemoryView":1208
16282 *
16283 * @cname('__pyx_memoryview_copy_data_to_temp')
16284 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
16285 * __Pyx_memviewslice *tmpslice,
16286 * char order,
16287 */
16288
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) {
16290 int __pyx_v_i;
16291 void *__pyx_v_result;
16292 size_t __pyx_v_itemsize;
16293 size_t __pyx_v_size;
16294 void *__pyx_r;
16295 Py_ssize_t __pyx_t_1;
16296 int __pyx_t_2;
16297 int __pyx_t_3;
16298 struct __pyx_memoryview_obj *__pyx_t_4;
16299 int __pyx_t_5;
16300 int __pyx_t_6;
16301 int __pyx_lineno = 0;
16302 const char *__pyx_filename = NULL;
16303 int __pyx_clineno = 0;
16304
16305 /* "View.MemoryView":1219
16306 * cdef void *result
16307 *
16308 * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
16309 * cdef size_t size = slice_get_size(src, ndim)
16310 *
16311 */
16312 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
16313 __pyx_v_itemsize = __pyx_t_1;
16314
16315 /* "View.MemoryView":1220
16316 *
16317 * cdef size_t itemsize = src.memview.view.itemsize
16318 * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
16319 *
16320 * result = malloc(size)
16321 */
16322 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
16323
16324 /* "View.MemoryView":1222
16325 * cdef size_t size = slice_get_size(src, ndim)
16326 *
16327 * result = malloc(size) # <<<<<<<<<<<<<<
16328 * if not result:
16329 * _err(MemoryError, NULL)
16330 */
16331 __pyx_v_result = malloc(__pyx_v_size);
16332
16333 /* "View.MemoryView":1223
16334 *
16335 * result = malloc(size)
16336 * if not result: # <<<<<<<<<<<<<<
16337 * _err(MemoryError, NULL)
16338 *
16339 */
16340 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
16341 if (__pyx_t_2) {
16342
16343 /* "View.MemoryView":1224
16344 * result = malloc(size)
16345 * if not result:
16346 * _err(MemoryError, NULL) # <<<<<<<<<<<<<<
16347 *
16348 *
16349 */
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)
16351
16352 /* "View.MemoryView":1223
16353 *
16354 * result = malloc(size)
16355 * if not result: # <<<<<<<<<<<<<<
16356 * _err(MemoryError, NULL)
16357 *
16358 */
16359 }
16360
16361 /* "View.MemoryView":1227
16362 *
16363 *
16364 * tmpslice.data = <char *> result # <<<<<<<<<<<<<<
16365 * tmpslice.memview = src.memview
16366 * for i in range(ndim):
16367 */
16368 __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
16369
16370 /* "View.MemoryView":1228
16371 *
16372 * tmpslice.data = <char *> result
16373 * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
16374 * for i in range(ndim):
16375 * tmpslice.shape[i] = src.shape[i]
16376 */
16377 __pyx_t_4 = __pyx_v_src->memview;
16378 __pyx_v_tmpslice->memview = __pyx_t_4;
16379
16380 /* "View.MemoryView":1229
16381 * tmpslice.data = <char *> result
16382 * tmpslice.memview = src.memview
16383 * for i in range(ndim): # <<<<<<<<<<<<<<
16384 * tmpslice.shape[i] = src.shape[i]
16385 * tmpslice.suboffsets[i] = -1
16386 */
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;
16391
16392 /* "View.MemoryView":1230
16393 * tmpslice.memview = src.memview
16394 * for i in range(ndim):
16395 * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
16396 * tmpslice.suboffsets[i] = -1
16397 *
16398 */
16399 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
16400
16401 /* "View.MemoryView":1231
16402 * for i in range(ndim):
16403 * tmpslice.shape[i] = src.shape[i]
16404 * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
16405 *
16406 * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
16407 */
16408 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
16409 }
16410
16411 /* "View.MemoryView":1233
16412 * tmpslice.suboffsets[i] = -1
16413 *
16414 * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<<
16415 * ndim, order)
16416 *
16417 */
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));
16419
16420 /* "View.MemoryView":1237
16421 *
16422 *
16423 * for i in range(ndim): # <<<<<<<<<<<<<<
16424 * if tmpslice.shape[i] == 1:
16425 * tmpslice.strides[i] = 0
16426 */
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;
16431
16432 /* "View.MemoryView":1238
16433 *
16434 * for i in range(ndim):
16435 * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
16436 * tmpslice.strides[i] = 0
16437 *
16438 */
16439 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
16440 if (__pyx_t_2) {
16441
16442 /* "View.MemoryView":1239
16443 * for i in range(ndim):
16444 * if tmpslice.shape[i] == 1:
16445 * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
16446 *
16447 * if slice_is_contig(src[0], order, ndim):
16448 */
16449 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
16450
16451 /* "View.MemoryView":1238
16452 *
16453 * for i in range(ndim):
16454 * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
16455 * tmpslice.strides[i] = 0
16456 *
16457 */
16458 }
16459 }
16460
16461 /* "View.MemoryView":1241
16462 * tmpslice.strides[i] = 0
16463 *
16464 * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
16465 * memcpy(result, src.data, size)
16466 * else:
16467 */
16468 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
16469 if (__pyx_t_2) {
16470
16471 /* "View.MemoryView":1242
16472 *
16473 * if slice_is_contig(src[0], order, ndim):
16474 * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
16475 * else:
16476 * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
16477 */
16478 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
16479
16480 /* "View.MemoryView":1241
16481 * tmpslice.strides[i] = 0
16482 *
16483 * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
16484 * memcpy(result, src.data, size)
16485 * else:
16486 */
16487 goto __pyx_L9;
16488 }
16489
16490 /* "View.MemoryView":1244
16491 * memcpy(result, src.data, size)
16492 * else:
16493 * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
16494 *
16495 * return result
16496 */
16497 /*else*/ {
16498 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
16499 }
16500 __pyx_L9:;
16501
16502 /* "View.MemoryView":1246
16503 * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
16504 *
16505 * return result # <<<<<<<<<<<<<<
16506 *
16507 *
16508 */
16509 __pyx_r = __pyx_v_result;
16510 goto __pyx_L0;
16511
16512 /* "View.MemoryView":1208
16513 *
16514 * @cname('__pyx_memoryview_copy_data_to_temp')
16515 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
16516 * __Pyx_memviewslice *tmpslice,
16517 * char order,
16518 */
16519
16520 /* function exit code */
16521 __pyx_L1_error:;
16522 {
16523 #ifdef WITH_THREAD
16524 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16525 #endif
16526 __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
16527 #ifdef WITH_THREAD
16528 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16529 #endif
16530 }
16531 __pyx_r = NULL;
16532 __pyx_L0:;
16533 return __pyx_r;
16534}
16535
16536/* "View.MemoryView":1251
16537 *
16538 * @cname('__pyx_memoryview_err_extents')
16539 * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
16540 * Py_ssize_t extent2) except -1 with gil:
16541 * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
16542 */
16543
16544static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
16545 int __pyx_r;
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;
16554 #ifdef WITH_THREAD
16555 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16556 #endif
16557 __Pyx_RefNannySetupContext("_err_extents", 0);
16558
16559 /* "View.MemoryView":1254
16560 * Py_ssize_t extent2) except -1 with gil:
16561 * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
16562 * (i, extent1, extent2)) # <<<<<<<<<<<<<<
16563 *
16564 * @cname('__pyx_memoryview_err_dim')
16565 */
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);
16580 __pyx_t_1 = 0;
16581 __pyx_t_2 = 0;
16582 __pyx_t_3 = 0;
16583
16584 /* "View.MemoryView":1253
16585 * cdef int _err_extents(int i, Py_ssize_t extent1,
16586 * Py_ssize_t extent2) except -1 with gil:
16587 * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<<
16588 * (i, extent1, extent2))
16589 *
16590 */
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)
16600
16601 /* "View.MemoryView":1251
16602 *
16603 * @cname('__pyx_memoryview_err_extents')
16604 * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
16605 * Py_ssize_t extent2) except -1 with gil:
16606 * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
16607 */
16608
16609 /* function exit code */
16610 __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);
16616 __pyx_r = -1;
16617 __Pyx_RefNannyFinishContext();
16618 #ifdef WITH_THREAD
16619 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16620 #endif
16621 return __pyx_r;
16622}
16623
16624/* "View.MemoryView":1257
16625 *
16626 * @cname('__pyx_memoryview_err_dim')
16627 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
16628 * raise error(msg.decode('ascii') % dim)
16629 *
16630 */
16631
16632static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
16633 int __pyx_r;
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;
16642 #ifdef WITH_THREAD
16643 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16644 #endif
16645 __Pyx_RefNannySetupContext("_err_dim", 0);
16646 __Pyx_INCREF(__pyx_v_error);
16647
16648 /* "View.MemoryView":1258
16649 * @cname('__pyx_memoryview_err_dim')
16650 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
16651 * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<<
16652 *
16653 * @cname('__pyx_memoryview_err')
16654 */
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);
16672 }
16673 }
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)
16683
16684 /* "View.MemoryView":1257
16685 *
16686 * @cname('__pyx_memoryview_err_dim')
16687 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
16688 * raise error(msg.decode('ascii') % dim)
16689 *
16690 */
16691
16692 /* function exit code */
16693 __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);
16699 __pyx_r = -1;
16700 __Pyx_XDECREF(__pyx_v_error);
16701 __Pyx_RefNannyFinishContext();
16702 #ifdef WITH_THREAD
16703 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16704 #endif
16705 return __pyx_r;
16706}
16707
16708/* "View.MemoryView":1261
16709 *
16710 * @cname('__pyx_memoryview_err')
16711 * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
16712 * if msg != NULL:
16713 * raise error(msg.decode('ascii'))
16714 */
16715
16716static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
16717 int __pyx_r;
16718 __Pyx_RefNannyDeclarations
16719 int __pyx_t_1;
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;
16727 #ifdef WITH_THREAD
16728 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16729 #endif
16730 __Pyx_RefNannySetupContext("_err", 0);
16731 __Pyx_INCREF(__pyx_v_error);
16732
16733 /* "View.MemoryView":1262
16734 * @cname('__pyx_memoryview_err')
16735 * cdef int _err(object error, char *msg) except -1 with gil:
16736 * if msg != NULL: # <<<<<<<<<<<<<<
16737 * raise error(msg.decode('ascii'))
16738 * else:
16739 */
16740 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
16741 if (unlikely(__pyx_t_1)) {
16742
16743 /* "View.MemoryView":1263
16744 * cdef int _err(object error, char *msg) except -1 with gil:
16745 * if msg != NULL:
16746 * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
16747 * else:
16748 * raise error
16749 */
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);
16761 }
16762 }
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)
16772
16773 /* "View.MemoryView":1262
16774 * @cname('__pyx_memoryview_err')
16775 * cdef int _err(object error, char *msg) except -1 with gil:
16776 * if msg != NULL: # <<<<<<<<<<<<<<
16777 * raise error(msg.decode('ascii'))
16778 * else:
16779 */
16780 }
16781
16782 /* "View.MemoryView":1265
16783 * raise error(msg.decode('ascii'))
16784 * else:
16785 * raise error # <<<<<<<<<<<<<<
16786 *
16787 * @cname('__pyx_memoryview_copy_contents')
16788 */
16789 /*else*/ {
16790 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
16791 __PYX_ERR(2, 1265, __pyx_L1_error)
16792 }
16793
16794 /* "View.MemoryView":1261
16795 *
16796 * @cname('__pyx_memoryview_err')
16797 * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
16798 * if msg != NULL:
16799 * raise error(msg.decode('ascii'))
16800 */
16801
16802 /* function exit code */
16803 __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);
16809 __pyx_r = -1;
16810 __Pyx_XDECREF(__pyx_v_error);
16811 __Pyx_RefNannyFinishContext();
16812 #ifdef WITH_THREAD
16813 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16814 #endif
16815 return __pyx_r;
16816}
16817
16818/* "View.MemoryView":1268
16819 *
16820 * @cname('__pyx_memoryview_copy_contents')
16821 * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
16822 * __Pyx_memviewslice dst,
16823 * int src_ndim, int dst_ndim,
16824 */
16825
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;
16829 int __pyx_v_i;
16830 char __pyx_v_order;
16831 int __pyx_v_broadcasting;
16832 int __pyx_v_direct_copy;
16833 __Pyx_memviewslice __pyx_v_tmp;
16834 int __pyx_v_ndim;
16835 int __pyx_r;
16836 Py_ssize_t __pyx_t_1;
16837 int __pyx_t_2;
16838 int __pyx_t_3;
16839 int __pyx_t_4;
16840 int __pyx_t_5;
16841 int __pyx_t_6;
16842 void *__pyx_t_7;
16843 int __pyx_t_8;
16844 int __pyx_lineno = 0;
16845 const char *__pyx_filename = NULL;
16846 int __pyx_clineno = 0;
16847
16848 /* "View.MemoryView":1276
16849 * Check for overlapping memory and verify the shapes.
16850 * """
16851 * cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
16852 * cdef size_t itemsize = src.memview.view.itemsize
16853 * cdef int i
16854 */
16855 __pyx_v_tmpdata = NULL;
16856
16857 /* "View.MemoryView":1277
16858 * """
16859 * cdef void *tmpdata = NULL
16860 * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
16861 * cdef int i
16862 * cdef char order = get_best_order(&src, src_ndim)
16863 */
16864 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
16865 __pyx_v_itemsize = __pyx_t_1;
16866
16867 /* "View.MemoryView":1279
16868 * cdef size_t itemsize = src.memview.view.itemsize
16869 * cdef int i
16870 * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
16871 * cdef bint broadcasting = False
16872 * cdef bint direct_copy = False
16873 */
16874 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
16875
16876 /* "View.MemoryView":1280
16877 * cdef int i
16878 * cdef char order = get_best_order(&src, src_ndim)
16879 * cdef bint broadcasting = False # <<<<<<<<<<<<<<
16880 * cdef bint direct_copy = False
16881 * cdef __Pyx_memviewslice tmp
16882 */
16883 __pyx_v_broadcasting = 0;
16884
16885 /* "View.MemoryView":1281
16886 * cdef char order = get_best_order(&src, src_ndim)
16887 * cdef bint broadcasting = False
16888 * cdef bint direct_copy = False # <<<<<<<<<<<<<<
16889 * cdef __Pyx_memviewslice tmp
16890 *
16891 */
16892 __pyx_v_direct_copy = 0;
16893
16894 /* "View.MemoryView":1284
16895 * cdef __Pyx_memviewslice tmp
16896 *
16897 * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
16898 * broadcast_leading(&src, src_ndim, dst_ndim)
16899 * elif dst_ndim < src_ndim:
16900 */
16901 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
16902 if (__pyx_t_2) {
16903
16904 /* "View.MemoryView":1285
16905 *
16906 * if src_ndim < dst_ndim:
16907 * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
16908 * elif dst_ndim < src_ndim:
16909 * broadcast_leading(&dst, dst_ndim, src_ndim)
16910 */
16911 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
16912
16913 /* "View.MemoryView":1284
16914 * cdef __Pyx_memviewslice tmp
16915 *
16916 * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
16917 * broadcast_leading(&src, src_ndim, dst_ndim)
16918 * elif dst_ndim < src_ndim:
16919 */
16920 goto __pyx_L3;
16921 }
16922
16923 /* "View.MemoryView":1286
16924 * if src_ndim < dst_ndim:
16925 * broadcast_leading(&src, src_ndim, dst_ndim)
16926 * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
16927 * broadcast_leading(&dst, dst_ndim, src_ndim)
16928 *
16929 */
16930 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
16931 if (__pyx_t_2) {
16932
16933 /* "View.MemoryView":1287
16934 * broadcast_leading(&src, src_ndim, dst_ndim)
16935 * elif dst_ndim < src_ndim:
16936 * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
16937 *
16938 * cdef int ndim = max(src_ndim, dst_ndim)
16939 */
16940 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
16941
16942 /* "View.MemoryView":1286
16943 * if src_ndim < dst_ndim:
16944 * broadcast_leading(&src, src_ndim, dst_ndim)
16945 * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
16946 * broadcast_leading(&dst, dst_ndim, src_ndim)
16947 *
16948 */
16949 }
16950 __pyx_L3:;
16951
16952 /* "View.MemoryView":1289
16953 * broadcast_leading(&dst, dst_ndim, src_ndim)
16954 *
16955 * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
16956 *
16957 * for i in range(ndim):
16958 */
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;
16963 } else {
16964 __pyx_t_5 = __pyx_t_4;
16965 }
16966 __pyx_v_ndim = __pyx_t_5;
16967
16968 /* "View.MemoryView":1291
16969 * cdef int ndim = max(src_ndim, dst_ndim)
16970 *
16971 * for i in range(ndim): # <<<<<<<<<<<<<<
16972 * if src.shape[i] != dst.shape[i]:
16973 * if src.shape[i] == 1:
16974 */
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;
16979
16980 /* "View.MemoryView":1292
16981 *
16982 * for i in range(ndim):
16983 * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
16984 * if src.shape[i] == 1:
16985 * broadcasting = True
16986 */
16987 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
16988 if (__pyx_t_2) {
16989
16990 /* "View.MemoryView":1293
16991 * for i in range(ndim):
16992 * if src.shape[i] != dst.shape[i]:
16993 * if src.shape[i] == 1: # <<<<<<<<<<<<<<
16994 * broadcasting = True
16995 * src.strides[i] = 0
16996 */
16997 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
16998 if (__pyx_t_2) {
16999
17000 /* "View.MemoryView":1294
17001 * if src.shape[i] != dst.shape[i]:
17002 * if src.shape[i] == 1:
17003 * broadcasting = True # <<<<<<<<<<<<<<
17004 * src.strides[i] = 0
17005 * else:
17006 */
17007 __pyx_v_broadcasting = 1;
17008
17009 /* "View.MemoryView":1295
17010 * if src.shape[i] == 1:
17011 * broadcasting = True
17012 * src.strides[i] = 0 # <<<<<<<<<<<<<<
17013 * else:
17014 * _err_extents(i, dst.shape[i], src.shape[i])
17015 */
17016 (__pyx_v_src.strides[__pyx_v_i]) = 0;
17017
17018 /* "View.MemoryView":1293
17019 * for i in range(ndim):
17020 * if src.shape[i] != dst.shape[i]:
17021 * if src.shape[i] == 1: # <<<<<<<<<<<<<<
17022 * broadcasting = True
17023 * src.strides[i] = 0
17024 */
17025 goto __pyx_L7;
17026 }
17027
17028 /* "View.MemoryView":1297
17029 * src.strides[i] = 0
17030 * else:
17031 * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
17032 *
17033 * if src.suboffsets[i] >= 0:
17034 */
17035 /*else*/ {
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)
17037 }
17038 __pyx_L7:;
17039
17040 /* "View.MemoryView":1292
17041 *
17042 * for i in range(ndim):
17043 * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
17044 * if src.shape[i] == 1:
17045 * broadcasting = True
17046 */
17047 }
17048
17049 /* "View.MemoryView":1299
17050 * _err_extents(i, dst.shape[i], src.shape[i])
17051 *
17052 * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
17053 * _err_dim(ValueError, "Dimension %d is not direct", i)
17054 *
17055 */
17056 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
17057 if (__pyx_t_2) {
17058
17059 /* "View.MemoryView":1300
17060 *
17061 * if src.suboffsets[i] >= 0:
17062 * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
17063 *
17064 * if slices_overlap(&src, &dst, ndim, itemsize):
17065 */
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)
17067
17068 /* "View.MemoryView":1299
17069 * _err_extents(i, dst.shape[i], src.shape[i])
17070 *
17071 * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
17072 * _err_dim(ValueError, "Dimension %d is not direct", i)
17073 *
17074 */
17075 }
17076 }
17077
17078 /* "View.MemoryView":1302
17079 * _err_dim(ValueError, "Dimension %d is not direct", i)
17080 *
17081 * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
17082 *
17083 * if not slice_is_contig(src, order, ndim):
17084 */
17085 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
17086 if (__pyx_t_2) {
17087
17088 /* "View.MemoryView":1304
17089 * if slices_overlap(&src, &dst, ndim, itemsize):
17090 *
17091 * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
17092 * order = get_best_order(&dst, ndim)
17093 *
17094 */
17095 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
17096 if (__pyx_t_2) {
17097
17098 /* "View.MemoryView":1305
17099 *
17100 * if not slice_is_contig(src, order, ndim):
17101 * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
17102 *
17103 * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
17104 */
17105 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
17106
17107 /* "View.MemoryView":1304
17108 * if slices_overlap(&src, &dst, ndim, itemsize):
17109 *
17110 * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
17111 * order = get_best_order(&dst, ndim)
17112 *
17113 */
17114 }
17115
17116 /* "View.MemoryView":1307
17117 * order = get_best_order(&dst, ndim)
17118 *
17119 * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
17120 * src = tmp
17121 *
17122 */
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;
17125
17126 /* "View.MemoryView":1308
17127 *
17128 * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
17129 * src = tmp # <<<<<<<<<<<<<<
17130 *
17131 * if not broadcasting:
17132 */
17133 __pyx_v_src = __pyx_v_tmp;
17134
17135 /* "View.MemoryView":1302
17136 * _err_dim(ValueError, "Dimension %d is not direct", i)
17137 *
17138 * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
17139 *
17140 * if not slice_is_contig(src, order, ndim):
17141 */
17142 }
17143
17144 /* "View.MemoryView":1310
17145 * src = tmp
17146 *
17147 * if not broadcasting: # <<<<<<<<<<<<<<
17148 *
17149 *
17150 */
17151 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
17152 if (__pyx_t_2) {
17153
17154 /* "View.MemoryView":1313
17155 *
17156 *
17157 * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
17158 * direct_copy = slice_is_contig(dst, 'C', ndim)
17159 * elif slice_is_contig(src, 'F', ndim):
17160 */
17161 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
17162 if (__pyx_t_2) {
17163
17164 /* "View.MemoryView":1314
17165 *
17166 * if slice_is_contig(src, 'C', ndim):
17167 * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<<
17168 * elif slice_is_contig(src, 'F', ndim):
17169 * direct_copy = slice_is_contig(dst, 'F', ndim)
17170 */
17171 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
17172
17173 /* "View.MemoryView":1313
17174 *
17175 *
17176 * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
17177 * direct_copy = slice_is_contig(dst, 'C', ndim)
17178 * elif slice_is_contig(src, 'F', ndim):
17179 */
17180 goto __pyx_L12;
17181 }
17182
17183 /* "View.MemoryView":1315
17184 * if slice_is_contig(src, 'C', ndim):
17185 * direct_copy = slice_is_contig(dst, 'C', ndim)
17186 * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
17187 * direct_copy = slice_is_contig(dst, 'F', ndim)
17188 *
17189 */
17190 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
17191 if (__pyx_t_2) {
17192
17193 /* "View.MemoryView":1316
17194 * direct_copy = slice_is_contig(dst, 'C', ndim)
17195 * elif slice_is_contig(src, 'F', ndim):
17196 * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<<
17197 *
17198 * if direct_copy:
17199 */
17200 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
17201
17202 /* "View.MemoryView":1315
17203 * if slice_is_contig(src, 'C', ndim):
17204 * direct_copy = slice_is_contig(dst, 'C', ndim)
17205 * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
17206 * direct_copy = slice_is_contig(dst, 'F', ndim)
17207 *
17208 */
17209 }
17210 __pyx_L12:;
17211
17212 /* "View.MemoryView":1318
17213 * direct_copy = slice_is_contig(dst, 'F', ndim)
17214 *
17215 * if direct_copy: # <<<<<<<<<<<<<<
17216 *
17217 * refcount_copying(&dst, dtype_is_object, ndim, False)
17218 */
17219 __pyx_t_2 = (__pyx_v_direct_copy != 0);
17220 if (__pyx_t_2) {
17221
17222 /* "View.MemoryView":1320
17223 * if direct_copy:
17224 *
17225 * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
17226 * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
17227 * refcount_copying(&dst, dtype_is_object, ndim, True)
17228 */
17229 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17230
17231 /* "View.MemoryView":1321
17232 *
17233 * refcount_copying(&dst, dtype_is_object, ndim, False)
17234 * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<<
17235 * refcount_copying(&dst, dtype_is_object, ndim, True)
17236 * free(tmpdata)
17237 */
17238 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
17239
17240 /* "View.MemoryView":1322
17241 * refcount_copying(&dst, dtype_is_object, ndim, False)
17242 * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
17243 * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
17244 * free(tmpdata)
17245 * return 0
17246 */
17247 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17248
17249 /* "View.MemoryView":1323
17250 * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
17251 * refcount_copying(&dst, dtype_is_object, ndim, True)
17252 * free(tmpdata) # <<<<<<<<<<<<<<
17253 * return 0
17254 *
17255 */
17256 free(__pyx_v_tmpdata);
17257
17258 /* "View.MemoryView":1324
17259 * refcount_copying(&dst, dtype_is_object, ndim, True)
17260 * free(tmpdata)
17261 * return 0 # <<<<<<<<<<<<<<
17262 *
17263 * if order == 'F' == get_best_order(&dst, ndim):
17264 */
17265 __pyx_r = 0;
17266 goto __pyx_L0;
17267
17268 /* "View.MemoryView":1318
17269 * direct_copy = slice_is_contig(dst, 'F', ndim)
17270 *
17271 * if direct_copy: # <<<<<<<<<<<<<<
17272 *
17273 * refcount_copying(&dst, dtype_is_object, ndim, False)
17274 */
17275 }
17276
17277 /* "View.MemoryView":1310
17278 * src = tmp
17279 *
17280 * if not broadcasting: # <<<<<<<<<<<<<<
17281 *
17282 *
17283 */
17284 }
17285
17286 /* "View.MemoryView":1326
17287 * return 0
17288 *
17289 * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
17290 *
17291 *
17292 */
17293 __pyx_t_2 = (__pyx_v_order == 'F');
17294 if (__pyx_t_2) {
17295 __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
17296 }
17297 __pyx_t_8 = (__pyx_t_2 != 0);
17298 if (__pyx_t_8) {
17299
17300 /* "View.MemoryView":1329
17301 *
17302 *
17303 * transpose_memslice(&src) # <<<<<<<<<<<<<<
17304 * transpose_memslice(&dst)
17305 *
17306 */
17307 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
17308
17309 /* "View.MemoryView":1330
17310 *
17311 * transpose_memslice(&src)
17312 * transpose_memslice(&dst) # <<<<<<<<<<<<<<
17313 *
17314 * refcount_copying(&dst, dtype_is_object, ndim, False)
17315 */
17316 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
17317
17318 /* "View.MemoryView":1326
17319 * return 0
17320 *
17321 * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
17322 *
17323 *
17324 */
17325 }
17326
17327 /* "View.MemoryView":1332
17328 * transpose_memslice(&dst)
17329 *
17330 * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
17331 * copy_strided_to_strided(&src, &dst, ndim, itemsize)
17332 * refcount_copying(&dst, dtype_is_object, ndim, True)
17333 */
17334 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17335
17336 /* "View.MemoryView":1333
17337 *
17338 * refcount_copying(&dst, dtype_is_object, ndim, False)
17339 * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
17340 * refcount_copying(&dst, dtype_is_object, ndim, True)
17341 *
17342 */
17343 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
17344
17345 /* "View.MemoryView":1334
17346 * refcount_copying(&dst, dtype_is_object, ndim, False)
17347 * copy_strided_to_strided(&src, &dst, ndim, itemsize)
17348 * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
17349 *
17350 * free(tmpdata)
17351 */
17352 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17353
17354 /* "View.MemoryView":1336
17355 * refcount_copying(&dst, dtype_is_object, ndim, True)
17356 *
17357 * free(tmpdata) # <<<<<<<<<<<<<<
17358 * return 0
17359 *
17360 */
17361 free(__pyx_v_tmpdata);
17362
17363 /* "View.MemoryView":1337
17364 *
17365 * free(tmpdata)
17366 * return 0 # <<<<<<<<<<<<<<
17367 *
17368 * @cname('__pyx_memoryview_broadcast_leading')
17369 */
17370 __pyx_r = 0;
17371 goto __pyx_L0;
17372
17373 /* "View.MemoryView":1268
17374 *
17375 * @cname('__pyx_memoryview_copy_contents')
17376 * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
17377 * __Pyx_memviewslice dst,
17378 * int src_ndim, int dst_ndim,
17379 */
17380
17381 /* function exit code */
17382 __pyx_L1_error:;
17383 {
17384 #ifdef WITH_THREAD
17385 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17386 #endif
17387 __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
17388 #ifdef WITH_THREAD
17389 __Pyx_PyGILState_Release(__pyx_gilstate_save);
17390 #endif
17391 }
17392 __pyx_r = -1;
17393 __pyx_L0:;
17394 return __pyx_r;
17395}
17396
17397/* "View.MemoryView":1340
17398 *
17399 * @cname('__pyx_memoryview_broadcast_leading')
17400 * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
17401 * int ndim,
17402 * int ndim_other) nogil:
17403 */
17404
17405static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
17406 int __pyx_v_i;
17407 int __pyx_v_offset;
17408 int __pyx_t_1;
17409 int __pyx_t_2;
17410 int __pyx_t_3;
17411
17412 /* "View.MemoryView":1344
17413 * int ndim_other) nogil:
17414 * cdef int i
17415 * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
17416 *
17417 * for i in range(ndim - 1, -1, -1):
17418 */
17419 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
17420
17421 /* "View.MemoryView":1346
17422 * cdef int offset = ndim_other - ndim
17423 *
17424 * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
17425 * mslice.shape[i + offset] = mslice.shape[i]
17426 * mslice.strides[i + offset] = mslice.strides[i]
17427 */
17428 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17429 __pyx_v_i = __pyx_t_1;
17430
17431 /* "View.MemoryView":1347
17432 *
17433 * for i in range(ndim - 1, -1, -1):
17434 * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<<
17435 * mslice.strides[i + offset] = mslice.strides[i]
17436 * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
17437 */
17438 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
17439
17440 /* "View.MemoryView":1348
17441 * for i in range(ndim - 1, -1, -1):
17442 * mslice.shape[i + offset] = mslice.shape[i]
17443 * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<<
17444 * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
17445 *
17446 */
17447 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
17448
17449 /* "View.MemoryView":1349
17450 * mslice.shape[i + offset] = mslice.shape[i]
17451 * mslice.strides[i + offset] = mslice.strides[i]
17452 * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<<
17453 *
17454 * for i in range(offset):
17455 */
17456 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
17457 }
17458
17459 /* "View.MemoryView":1351
17460 * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
17461 *
17462 * for i in range(offset): # <<<<<<<<<<<<<<
17463 * mslice.shape[i] = 1
17464 * mslice.strides[i] = mslice.strides[0]
17465 */
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;
17470
17471 /* "View.MemoryView":1352
17472 *
17473 * for i in range(offset):
17474 * mslice.shape[i] = 1 # <<<<<<<<<<<<<<
17475 * mslice.strides[i] = mslice.strides[0]
17476 * mslice.suboffsets[i] = -1
17477 */
17478 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
17479
17480 /* "View.MemoryView":1353
17481 * for i in range(offset):
17482 * mslice.shape[i] = 1
17483 * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<<
17484 * mslice.suboffsets[i] = -1
17485 *
17486 */
17487 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
17488
17489 /* "View.MemoryView":1354
17490 * mslice.shape[i] = 1
17491 * mslice.strides[i] = mslice.strides[0]
17492 * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
17493 *
17494 *
17495 */
17496 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
17497 }
17498
17499 /* "View.MemoryView":1340
17500 *
17501 * @cname('__pyx_memoryview_broadcast_leading')
17502 * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
17503 * int ndim,
17504 * int ndim_other) nogil:
17505 */
17506
17507 /* function exit code */
17508}
17509
17510/* "View.MemoryView":1362
17511 *
17512 * @cname('__pyx_memoryview_refcount_copying')
17513 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
17514 * int ndim, bint inc) nogil:
17515 *
17516 */
17517
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) {
17519 int __pyx_t_1;
17520
17521 /* "View.MemoryView":1366
17522 *
17523 *
17524 * if dtype_is_object: # <<<<<<<<<<<<<<
17525 * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
17526 * dst.strides, ndim, inc)
17527 */
17528 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
17529 if (__pyx_t_1) {
17530
17531 /* "View.MemoryView":1367
17532 *
17533 * if dtype_is_object:
17534 * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<<
17535 * dst.strides, ndim, inc)
17536 *
17537 */
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);
17539
17540 /* "View.MemoryView":1366
17541 *
17542 *
17543 * if dtype_is_object: # <<<<<<<<<<<<<<
17544 * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
17545 * dst.strides, ndim, inc)
17546 */
17547 }
17548
17549 /* "View.MemoryView":1362
17550 *
17551 * @cname('__pyx_memoryview_refcount_copying')
17552 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
17553 * int ndim, bint inc) nogil:
17554 *
17555 */
17556
17557 /* function exit code */
17558}
17559
17560/* "View.MemoryView":1371
17561 *
17562 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
17563 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
17564 * Py_ssize_t *strides, int ndim,
17565 * bint inc) with gil:
17566 */
17567
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
17570 #ifdef WITH_THREAD
17571 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17572 #endif
17573 __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
17574
17575 /* "View.MemoryView":1374
17576 * Py_ssize_t *strides, int ndim,
17577 * bint inc) with gil:
17578 * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
17579 *
17580 * @cname('__pyx_memoryview_refcount_objects_in_slice')
17581 */
17582 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
17583
17584 /* "View.MemoryView":1371
17585 *
17586 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
17587 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
17588 * Py_ssize_t *strides, int ndim,
17589 * bint inc) with gil:
17590 */
17591
17592 /* function exit code */
17593 __Pyx_RefNannyFinishContext();
17594 #ifdef WITH_THREAD
17595 __Pyx_PyGILState_Release(__pyx_gilstate_save);
17596 #endif
17597}
17598
17599/* "View.MemoryView":1377
17600 *
17601 * @cname('__pyx_memoryview_refcount_objects_in_slice')
17602 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
17603 * Py_ssize_t *strides, int ndim, bint inc):
17604 * cdef Py_ssize_t i
17605 */
17606
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;
17613 int __pyx_t_4;
17614 __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
17615
17616 /* "View.MemoryView":1381
17617 * cdef Py_ssize_t i
17618 *
17619 * for i in range(shape[0]): # <<<<<<<<<<<<<<
17620 * if ndim == 1:
17621 * if inc:
17622 */
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;
17627
17628 /* "View.MemoryView":1382
17629 *
17630 * for i in range(shape[0]):
17631 * if ndim == 1: # <<<<<<<<<<<<<<
17632 * if inc:
17633 * Py_INCREF((<PyObject **> data)[0])
17634 */
17635 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
17636 if (__pyx_t_4) {
17637
17638 /* "View.MemoryView":1383
17639 * for i in range(shape[0]):
17640 * if ndim == 1:
17641 * if inc: # <<<<<<<<<<<<<<
17642 * Py_INCREF((<PyObject **> data)[0])
17643 * else:
17644 */
17645 __pyx_t_4 = (__pyx_v_inc != 0);
17646 if (__pyx_t_4) {
17647
17648 /* "View.MemoryView":1384
17649 * if ndim == 1:
17650 * if inc:
17651 * Py_INCREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
17652 * else:
17653 * Py_DECREF((<PyObject **> data)[0])
17654 */
17655 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
17656
17657 /* "View.MemoryView":1383
17658 * for i in range(shape[0]):
17659 * if ndim == 1:
17660 * if inc: # <<<<<<<<<<<<<<
17661 * Py_INCREF((<PyObject **> data)[0])
17662 * else:
17663 */
17664 goto __pyx_L6;
17665 }
17666
17667 /* "View.MemoryView":1386
17668 * Py_INCREF((<PyObject **> data)[0])
17669 * else:
17670 * Py_DECREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
17671 * else:
17672 * refcount_objects_in_slice(data, shape + 1, strides + 1,
17673 */
17674 /*else*/ {
17675 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
17676 }
17677 __pyx_L6:;
17678
17679 /* "View.MemoryView":1382
17680 *
17681 * for i in range(shape[0]):
17682 * if ndim == 1: # <<<<<<<<<<<<<<
17683 * if inc:
17684 * Py_INCREF((<PyObject **> data)[0])
17685 */
17686 goto __pyx_L5;
17687 }
17688
17689 /* "View.MemoryView":1388
17690 * Py_DECREF((<PyObject **> data)[0])
17691 * else:
17692 * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
17693 * ndim - 1, inc)
17694 *
17695 */
17696 /*else*/ {
17697
17698 /* "View.MemoryView":1389
17699 * else:
17700 * refcount_objects_in_slice(data, shape + 1, strides + 1,
17701 * ndim - 1, inc) # <<<<<<<<<<<<<<
17702 *
17703 * data += strides[0]
17704 */
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);
17706 }
17707 __pyx_L5:;
17708
17709 /* "View.MemoryView":1391
17710 * ndim - 1, inc)
17711 *
17712 * data += strides[0] # <<<<<<<<<<<<<<
17713 *
17714 *
17715 */
17716 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
17717 }
17718
17719 /* "View.MemoryView":1377
17720 *
17721 * @cname('__pyx_memoryview_refcount_objects_in_slice')
17722 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
17723 * Py_ssize_t *strides, int ndim, bint inc):
17724 * cdef Py_ssize_t i
17725 */
17726
17727 /* function exit code */
17728 __Pyx_RefNannyFinishContext();
17729}
17730
17731/* "View.MemoryView":1397
17732 *
17733 * @cname('__pyx_memoryview_slice_assign_scalar')
17734 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
17735 * size_t itemsize, void *item,
17736 * bint dtype_is_object) nogil:
17737 */
17738
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) {
17740
17741 /* "View.MemoryView":1400
17742 * size_t itemsize, void *item,
17743 * bint dtype_is_object) nogil:
17744 * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
17745 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
17746 * itemsize, item)
17747 */
17748 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
17749
17750 /* "View.MemoryView":1401
17751 * bint dtype_is_object) nogil:
17752 * refcount_copying(dst, dtype_is_object, ndim, False)
17753 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<<
17754 * itemsize, item)
17755 * refcount_copying(dst, dtype_is_object, ndim, True)
17756 */
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);
17758
17759 /* "View.MemoryView":1403
17760 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
17761 * itemsize, item)
17762 * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
17763 *
17764 *
17765 */
17766 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
17767
17768 /* "View.MemoryView":1397
17769 *
17770 * @cname('__pyx_memoryview_slice_assign_scalar')
17771 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
17772 * size_t itemsize, void *item,
17773 * bint dtype_is_object) nogil:
17774 */
17775
17776 /* function exit code */
17777}
17778
17779/* "View.MemoryView":1407
17780 *
17781 * @cname('__pyx_memoryview__slice_assign_scalar')
17782 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
17783 * Py_ssize_t *strides, int ndim,
17784 * size_t itemsize, void *item) nogil:
17785 */
17786
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;
17791 int __pyx_t_1;
17792 Py_ssize_t __pyx_t_2;
17793 Py_ssize_t __pyx_t_3;
17794 Py_ssize_t __pyx_t_4;
17795
17796 /* "View.MemoryView":1411
17797 * size_t itemsize, void *item) nogil:
17798 * cdef Py_ssize_t i
17799 * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
17800 * cdef Py_ssize_t extent = shape[0]
17801 *
17802 */
17803 __pyx_v_stride = (__pyx_v_strides[0]);
17804
17805 /* "View.MemoryView":1412
17806 * cdef Py_ssize_t i
17807 * cdef Py_ssize_t stride = strides[0]
17808 * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
17809 *
17810 * if ndim == 1:
17811 */
17812 __pyx_v_extent = (__pyx_v_shape[0]);
17813
17814 /* "View.MemoryView":1414
17815 * cdef Py_ssize_t extent = shape[0]
17816 *
17817 * if ndim == 1: # <<<<<<<<<<<<<<
17818 * for i in range(extent):
17819 * memcpy(data, item, itemsize)
17820 */
17821 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17822 if (__pyx_t_1) {
17823
17824 /* "View.MemoryView":1415
17825 *
17826 * if ndim == 1:
17827 * for i in range(extent): # <<<<<<<<<<<<<<
17828 * memcpy(data, item, itemsize)
17829 * data += stride
17830 */
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;
17835
17836 /* "View.MemoryView":1416
17837 * if ndim == 1:
17838 * for i in range(extent):
17839 * memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
17840 * data += stride
17841 * else:
17842 */
17843 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
17844
17845 /* "View.MemoryView":1417
17846 * for i in range(extent):
17847 * memcpy(data, item, itemsize)
17848 * data += stride # <<<<<<<<<<<<<<
17849 * else:
17850 * for i in range(extent):
17851 */
17852 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
17853 }
17854
17855 /* "View.MemoryView":1414
17856 * cdef Py_ssize_t extent = shape[0]
17857 *
17858 * if ndim == 1: # <<<<<<<<<<<<<<
17859 * for i in range(extent):
17860 * memcpy(data, item, itemsize)
17861 */
17862 goto __pyx_L3;
17863 }
17864
17865 /* "View.MemoryView":1419
17866 * data += stride
17867 * else:
17868 * for i in range(extent): # <<<<<<<<<<<<<<
17869 * _slice_assign_scalar(data, shape + 1, strides + 1,
17870 * ndim - 1, itemsize, item)
17871 */
17872 /*else*/ {
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;
17877
17878 /* "View.MemoryView":1420
17879 * else:
17880 * for i in range(extent):
17881 * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
17882 * ndim - 1, itemsize, item)
17883 * data += stride
17884 */
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);
17886
17887 /* "View.MemoryView":1422
17888 * _slice_assign_scalar(data, shape + 1, strides + 1,
17889 * ndim - 1, itemsize, item)
17890 * data += stride # <<<<<<<<<<<<<<
17891 *
17892 *
17893 */
17894 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
17895 }
17896 }
17897 __pyx_L3:;
17898
17899 /* "View.MemoryView":1407
17900 *
17901 * @cname('__pyx_memoryview__slice_assign_scalar')
17902 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
17903 * Py_ssize_t *strides, int ndim,
17904 * size_t itemsize, void *item) nogil:
17905 */
17906
17907 /* function exit code */
17908}
17909
17910/* "(tree fragment)":1
17911 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
17912 * cdef object __pyx_PickleError
17913 * cdef object __pyx_result
17914 */
17915
17916/* Python wrapper */
17917static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
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);
17929 {
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;
17942 case 0: break;
17943 default: goto __pyx_L5_argtuple_error;
17944 }
17945 kw_args = PyDict_Size(__pyx_kwds);
17946 switch (pos_args) {
17947 case 0:
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;
17951 case 1:
17952 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
17953 else {
17954 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
17955 }
17956 CYTHON_FALLTHROUGH;
17957 case 2:
17958 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
17959 else {
17960 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
17961 }
17962 }
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)
17965 }
17966 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
17967 goto __pyx_L5_argtuple_error;
17968 } else {
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);
17972 }
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];
17976 }
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)
17980 __pyx_L3_error:;
17981 __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
17982 __Pyx_RefNannyFinishContext();
17983 return NULL;
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);
17986
17987 /* function exit code */
17988 __Pyx_RefNannyFinishContext();
17989 return __pyx_r;
17990}
17991
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
17997 int __pyx_t_1;
17998 PyObject *__pyx_t_2 = NULL;
17999 PyObject *__pyx_t_3 = NULL;
18000 PyObject *__pyx_t_4 = NULL;
18001 PyObject *__pyx_t_5 = NULL;
18002 int __pyx_t_6;
18003 int __pyx_lineno = 0;
18004 const char *__pyx_filename = NULL;
18005 int __pyx_clineno = 0;
18006 __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
18007
18008 /* "(tree fragment)":4
18009 * cdef object __pyx_PickleError
18010 * cdef object __pyx_result
18011 * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
18012 * from pickle import PickleError as __pyx_PickleError
18013 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18014 */
18015 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
18016 if (__pyx_t_1) {
18017
18018 /* "(tree fragment)":5
18019 * cdef object __pyx_result
18020 * if __pyx_checksum != 0xb068931:
18021 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
18022 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18023 * __pyx_result = Enum.__new__(__pyx_type)
18024 */
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;
18039
18040 /* "(tree fragment)":6
18041 * if __pyx_checksum != 0xb068931:
18042 * from pickle import PickleError as __pyx_PickleError
18043 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<<
18044 * __pyx_result = Enum.__new__(__pyx_type)
18045 * if __pyx_state is not None:
18046 */
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);
18061 }
18062 }
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)
18072
18073 /* "(tree fragment)":4
18074 * cdef object __pyx_PickleError
18075 * cdef object __pyx_result
18076 * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
18077 * from pickle import PickleError as __pyx_PickleError
18078 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18079 */
18080 }
18081
18082 /* "(tree fragment)":7
18083 * from pickle import PickleError as __pyx_PickleError
18084 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18085 * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<<
18086 * if __pyx_state is not None:
18087 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18088 */
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);
18091 __pyx_t_4 = NULL;
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);
18099 }
18100 }
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;
18107 __pyx_t_3 = 0;
18108
18109 /* "(tree fragment)":8
18110 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18111 * __pyx_result = Enum.__new__(__pyx_type)
18112 * if __pyx_state is not None: # <<<<<<<<<<<<<<
18113 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18114 * return __pyx_result
18115 */
18116 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
18117 __pyx_t_6 = (__pyx_t_1 != 0);
18118 if (__pyx_t_6) {
18119
18120 /* "(tree fragment)":9
18121 * __pyx_result = Enum.__new__(__pyx_type)
18122 * if __pyx_state is not None:
18123 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
18124 * return __pyx_result
18125 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18126 */
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;
18131
18132 /* "(tree fragment)":8
18133 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
18134 * __pyx_result = Enum.__new__(__pyx_type)
18135 * if __pyx_state is not None: # <<<<<<<<<<<<<<
18136 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18137 * return __pyx_result
18138 */
18139 }
18140
18141 /* "(tree fragment)":10
18142 * if __pyx_state is not None:
18143 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18144 * return __pyx_result # <<<<<<<<<<<<<<
18145 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18146 * __pyx_result.name = __pyx_state[0]
18147 */
18148 __Pyx_XDECREF(__pyx_r);
18149 __Pyx_INCREF(__pyx_v___pyx_result);
18150 __pyx_r = __pyx_v___pyx_result;
18151 goto __pyx_L0;
18152
18153 /* "(tree fragment)":1
18154 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
18155 * cdef object __pyx_PickleError
18156 * cdef object __pyx_result
18157 */
18158
18159 /* function exit code */
18160 __pyx_L1_error:;
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);
18166 __pyx_r = NULL;
18167 __pyx_L0:;
18168 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
18169 __Pyx_XDECREF(__pyx_v___pyx_result);
18170 __Pyx_XGIVEREF(__pyx_r);
18171 __Pyx_RefNannyFinishContext();
18172 return __pyx_r;
18173}
18174
18175/* "(tree fragment)":11
18176 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18177 * return __pyx_result
18178 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
18179 * __pyx_result.name = __pyx_state[0]
18180 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18181 */
18182
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;
18187 int __pyx_t_2;
18188 Py_ssize_t __pyx_t_3;
18189 int __pyx_t_4;
18190 int __pyx_t_5;
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);
18198
18199 /* "(tree fragment)":12
18200 * return __pyx_result
18201 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18202 * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<<
18203 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18204 * __pyx_result.__dict__.update(__pyx_state[1])
18205 */
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)
18209 }
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;
18216 __pyx_t_1 = 0;
18217
18218 /* "(tree fragment)":13
18219 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18220 * __pyx_result.name = __pyx_state[0]
18221 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
18222 * __pyx_result.__dict__.update(__pyx_state[1])
18223 */
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)
18227 }
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);
18230 if (__pyx_t_4) {
18231 } else {
18232 __pyx_t_2 = __pyx_t_4;
18233 goto __pyx_L4_bool_binop_done;
18234 }
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:;
18239 if (__pyx_t_2) {
18240
18241 /* "(tree fragment)":14
18242 * __pyx_result.name = __pyx_state[0]
18243 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18244 * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
18245 */
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)
18254 }
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);
18257 __pyx_t_8 = NULL;
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);
18265 }
18266 }
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;
18274
18275 /* "(tree fragment)":13
18276 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
18277 * __pyx_result.name = __pyx_state[0]
18278 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
18279 * __pyx_result.__dict__.update(__pyx_state[1])
18280 */
18281 }
18282
18283 /* "(tree fragment)":11
18284 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
18285 * return __pyx_result
18286 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
18287 * __pyx_result.name = __pyx_state[0]
18288 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
18289 */
18290
18291 /* function exit code */
18292 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18293 goto __pyx_L0;
18294 __pyx_L1_error:;
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);
18300 __pyx_r = 0;
18301 __pyx_L0:;
18302 __Pyx_XGIVEREF(__pyx_r);
18303 __Pyx_RefNannyFinishContext();
18304 return __pyx_r;
18305}
18306static struct __pyx_vtabstruct_array __pyx_vtable_array;
18307
18308static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
18309 struct __pyx_array_obj *p;
18310 PyObject *o;
18311 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18312 o = (*t->tp_alloc)(t, 0);
18313 } else {
18314 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18315 }
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;
18322 return o;
18323 bad:
18324 Py_DECREF(o); o = 0;
18325 return NULL;
18326}
18327
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;
18333 }
18334 #endif
18335 {
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);
18342 }
18343 Py_CLEAR(p->mode);
18344 Py_CLEAR(p->_format);
18345 (*Py_TYPE(o)->tp_free)(o);
18346}
18347static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
18348 PyObject *r;
18349 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
18350 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
18351 Py_DECREF(x);
18352 return r;
18353}
18354
18355static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
18356 if (v) {
18357 return __pyx_array___setitem__(o, i, v);
18358 }
18359 else {
18360 PyErr_Format(PyExc_NotImplementedError,
18361 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
18362 return -1;
18363 }
18364}
18365
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)) {
18369 PyErr_Clear();
18370 v = __pyx_array___getattr__(o, n);
18371 }
18372 return v;
18373}
18374
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);
18377}
18378
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},
18383 {0, 0, 0, 0}
18384};
18385
18386static struct PyGetSetDef __pyx_getsets_array[] = {
18387 {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
18388 {0, 0, 0, 0, 0}
18389};
18390
18391static PySequenceMethods __pyx_tp_as_sequence_array = {
18392 __pyx_array___len__, /*sq_length*/
18393 0, /*sq_concat*/
18394 0, /*sq_repeat*/
18395 __pyx_sq_item_array, /*sq_item*/
18396 0, /*sq_slice*/
18397 0, /*sq_ass_item*/
18398 0, /*sq_ass_slice*/
18399 0, /*sq_contains*/
18400 0, /*sq_inplace_concat*/
18401 0, /*sq_inplace_repeat*/
18402};
18403
18404static PyMappingMethods __pyx_tp_as_mapping_array = {
18405 __pyx_array___len__, /*mp_length*/
18406 __pyx_array___getitem__, /*mp_subscript*/
18407 __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
18408};
18409
18410static PyBufferProcs __pyx_tp_as_buffer_array = {
18411 #if PY_MAJOR_VERSION < 3
18412 0, /*bf_getreadbuffer*/
18413 #endif
18414 #if PY_MAJOR_VERSION < 3
18415 0, /*bf_getwritebuffer*/
18416 #endif
18417 #if PY_MAJOR_VERSION < 3
18418 0, /*bf_getsegcount*/
18419 #endif
18420 #if PY_MAJOR_VERSION < 3
18421 0, /*bf_getcharbuffer*/
18422 #endif
18423 __pyx_array_getbuffer, /*bf_getbuffer*/
18424 0, /*bf_releasebuffer*/
18425};
18426
18427static PyTypeObject __pyx_type___pyx_array = {
18428 PyVarObject_HEAD_INIT(0, 0)
18429 "roc_cy.array", /*tp_name*/
18430 sizeof(struct __pyx_array_obj), /*tp_basicsize*/
18431 0, /*tp_itemsize*/
18432 __pyx_tp_dealloc_array, /*tp_dealloc*/
18433 #if PY_VERSION_HEX < 0x030800b4
18434 0, /*tp_print*/
18435 #endif
18436 #if PY_VERSION_HEX >= 0x030800b4
18437 0, /*tp_vectorcall_offset*/
18438 #endif
18439 0, /*tp_getattr*/
18440 0, /*tp_setattr*/
18441 #if PY_MAJOR_VERSION < 3
18442 0, /*tp_compare*/
18443 #endif
18444 #if PY_MAJOR_VERSION >= 3
18445 0, /*tp_as_async*/
18446 #endif
18447 0, /*tp_repr*/
18448 0, /*tp_as_number*/
18449 &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
18450 &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
18451 0, /*tp_hash*/
18452 0, /*tp_call*/
18453 0, /*tp_str*/
18454 __pyx_tp_getattro_array, /*tp_getattro*/
18455 0, /*tp_setattro*/
18456 &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
18457 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
18458 0, /*tp_doc*/
18459 0, /*tp_traverse*/
18460 0, /*tp_clear*/
18461 0, /*tp_richcompare*/
18462 0, /*tp_weaklistoffset*/
18463 0, /*tp_iter*/
18464 0, /*tp_iternext*/
18465 __pyx_methods_array, /*tp_methods*/
18466 0, /*tp_members*/
18467 __pyx_getsets_array, /*tp_getset*/
18468 0, /*tp_base*/
18469 0, /*tp_dict*/
18470 0, /*tp_descr_get*/
18471 0, /*tp_descr_set*/
18472 0, /*tp_dictoffset*/
18473 0, /*tp_init*/
18474 0, /*tp_alloc*/
18475 __pyx_tp_new_array, /*tp_new*/
18476 0, /*tp_free*/
18477 0, /*tp_is_gc*/
18478 0, /*tp_bases*/
18479 0, /*tp_mro*/
18480 0, /*tp_cache*/
18481 0, /*tp_subclasses*/
18482 0, /*tp_weaklist*/
18483 0, /*tp_del*/
18484 0, /*tp_version_tag*/
18485 #if PY_VERSION_HEX >= 0x030400a1
18486 0, /*tp_finalize*/
18487 #endif
18488 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18489 0, /*tp_vectorcall*/
18490 #endif
18491 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18492 0, /*tp_print*/
18493 #endif
18494 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18495 0, /*tp_pypy_flags*/
18496 #endif
18497};
18498
18499static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
18500 struct __pyx_MemviewEnum_obj *p;
18501 PyObject *o;
18502 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18503 o = (*t->tp_alloc)(t, 0);
18504 } else {
18505 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18506 }
18507 if (unlikely(!o)) return 0;
18508 p = ((struct __pyx_MemviewEnum_obj *)o);
18509 p->name = Py_None; Py_INCREF(Py_None);
18510 return o;
18511}
18512
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;
18518 }
18519 #endif
18520 PyObject_GC_UnTrack(o);
18521 Py_CLEAR(p->name);
18522 (*Py_TYPE(o)->tp_free)(o);
18523}
18524
18525static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
18526 int e;
18527 struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
18528 if (p->name) {
18529 e = (*v)(p->name, a); if (e) return e;
18530 }
18531 return 0;
18532}
18533
18534static int __pyx_tp_clear_Enum(PyObject *o) {
18535 PyObject* tmp;
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);
18539 Py_XDECREF(tmp);
18540 return 0;
18541}
18542
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},
18546 {0, 0, 0, 0}
18547};
18548
18549static PyTypeObject __pyx_type___pyx_MemviewEnum = {
18550 PyVarObject_HEAD_INIT(0, 0)
18551 "roc_cy.Enum", /*tp_name*/
18552 sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
18553 0, /*tp_itemsize*/
18554 __pyx_tp_dealloc_Enum, /*tp_dealloc*/
18555 #if PY_VERSION_HEX < 0x030800b4
18556 0, /*tp_print*/
18557 #endif
18558 #if PY_VERSION_HEX >= 0x030800b4
18559 0, /*tp_vectorcall_offset*/
18560 #endif
18561 0, /*tp_getattr*/
18562 0, /*tp_setattr*/
18563 #if PY_MAJOR_VERSION < 3
18564 0, /*tp_compare*/
18565 #endif
18566 #if PY_MAJOR_VERSION >= 3
18567 0, /*tp_as_async*/
18568 #endif
18569 __pyx_MemviewEnum___repr__, /*tp_repr*/
18570 0, /*tp_as_number*/
18571 0, /*tp_as_sequence*/
18572 0, /*tp_as_mapping*/
18573 0, /*tp_hash*/
18574 0, /*tp_call*/
18575 0, /*tp_str*/
18576 0, /*tp_getattro*/
18577 0, /*tp_setattro*/
18578 0, /*tp_as_buffer*/
18579 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
18580 0, /*tp_doc*/
18581 __pyx_tp_traverse_Enum, /*tp_traverse*/
18582 __pyx_tp_clear_Enum, /*tp_clear*/
18583 0, /*tp_richcompare*/
18584 0, /*tp_weaklistoffset*/
18585 0, /*tp_iter*/
18586 0, /*tp_iternext*/
18587 __pyx_methods_Enum, /*tp_methods*/
18588 0, /*tp_members*/
18589 0, /*tp_getset*/
18590 0, /*tp_base*/
18591 0, /*tp_dict*/
18592 0, /*tp_descr_get*/
18593 0, /*tp_descr_set*/
18594 0, /*tp_dictoffset*/
18595 __pyx_MemviewEnum___init__, /*tp_init*/
18596 0, /*tp_alloc*/
18597 __pyx_tp_new_Enum, /*tp_new*/
18598 0, /*tp_free*/
18599 0, /*tp_is_gc*/
18600 0, /*tp_bases*/
18601 0, /*tp_mro*/
18602 0, /*tp_cache*/
18603 0, /*tp_subclasses*/
18604 0, /*tp_weaklist*/
18605 0, /*tp_del*/
18606 0, /*tp_version_tag*/
18607 #if PY_VERSION_HEX >= 0x030400a1
18608 0, /*tp_finalize*/
18609 #endif
18610 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18611 0, /*tp_vectorcall*/
18612 #endif
18613 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18614 0, /*tp_print*/
18615 #endif
18616 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18617 0, /*tp_pypy_flags*/
18618 #endif
18619};
18620static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
18621
18622static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
18623 struct __pyx_memoryview_obj *p;
18624 PyObject *o;
18625 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
18626 o = (*t->tp_alloc)(t, 0);
18627 } else {
18628 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
18629 }
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;
18638 return o;
18639 bad:
18640 Py_DECREF(o); o = 0;
18641 return NULL;
18642}
18643
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;
18649 }
18650 #endif
18651 PyObject_GC_UnTrack(o);
18652 {
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);
18659 }
18660 Py_CLEAR(p->obj);
18661 Py_CLEAR(p->_size);
18662 Py_CLEAR(p->_array_interface);
18663 (*Py_TYPE(o)->tp_free)(o);
18664}
18665
18666static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
18667 int e;
18668 struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
18669 if (p->obj) {
18670 e = (*v)(p->obj, a); if (e) return e;
18671 }
18672 if (p->_size) {
18673 e = (*v)(p->_size, a); if (e) return e;
18674 }
18675 if (p->_array_interface) {
18676 e = (*v)(p->_array_interface, a); if (e) return e;
18677 }
18678 if (p->view.obj) {
18679 e = (*v)(p->view.obj, a); if (e) return e;
18680 }
18681 return 0;
18682}
18683
18684static int __pyx_tp_clear_memoryview(PyObject *o) {
18685 PyObject* tmp;
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);
18689 Py_XDECREF(tmp);
18690 tmp = ((PyObject*)p->_size);
18691 p->_size = Py_None; Py_INCREF(Py_None);
18692 Py_XDECREF(tmp);
18693 tmp = ((PyObject*)p->_array_interface);
18694 p->_array_interface = Py_None; Py_INCREF(Py_None);
18695 Py_XDECREF(tmp);
18696 Py_CLEAR(p->view.obj);
18697 return 0;
18698}
18699static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
18700 PyObject *r;
18701 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
18702 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
18703 Py_DECREF(x);
18704 return r;
18705}
18706
18707static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
18708 if (v) {
18709 return __pyx_memoryview___setitem__(o, i, v);
18710 }
18711 else {
18712 PyErr_Format(PyExc_NotImplementedError,
18713 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
18714 return -1;
18715 }
18716}
18717
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);
18720}
18721
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);
18724}
18725
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);
18728}
18729
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);
18732}
18733
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);
18736}
18737
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);
18740}
18741
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);
18744}
18745
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);
18748}
18749
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);
18752}
18753
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},
18761 {0, 0, 0, 0}
18762};
18763
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},
18774 {0, 0, 0, 0, 0}
18775};
18776
18777static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
18778 __pyx_memoryview___len__, /*sq_length*/
18779 0, /*sq_concat*/
18780 0, /*sq_repeat*/
18781 __pyx_sq_item_memoryview, /*sq_item*/
18782 0, /*sq_slice*/
18783 0, /*sq_ass_item*/
18784 0, /*sq_ass_slice*/
18785 0, /*sq_contains*/
18786 0, /*sq_inplace_concat*/
18787 0, /*sq_inplace_repeat*/
18788};
18789
18790static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
18791 __pyx_memoryview___len__, /*mp_length*/
18792 __pyx_memoryview___getitem__, /*mp_subscript*/
18793 __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
18794};
18795
18796static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
18797 #if PY_MAJOR_VERSION < 3
18798 0, /*bf_getreadbuffer*/
18799 #endif
18800 #if PY_MAJOR_VERSION < 3
18801 0, /*bf_getwritebuffer*/
18802 #endif
18803 #if PY_MAJOR_VERSION < 3
18804 0, /*bf_getsegcount*/
18805 #endif
18806 #if PY_MAJOR_VERSION < 3
18807 0, /*bf_getcharbuffer*/
18808 #endif
18809 __pyx_memoryview_getbuffer, /*bf_getbuffer*/
18810 0, /*bf_releasebuffer*/
18811};
18812
18813static PyTypeObject __pyx_type___pyx_memoryview = {
18814 PyVarObject_HEAD_INIT(0, 0)
18815 "roc_cy.memoryview", /*tp_name*/
18816 sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
18817 0, /*tp_itemsize*/
18818 __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
18819 #if PY_VERSION_HEX < 0x030800b4
18820 0, /*tp_print*/
18821 #endif
18822 #if PY_VERSION_HEX >= 0x030800b4
18823 0, /*tp_vectorcall_offset*/
18824 #endif
18825 0, /*tp_getattr*/
18826 0, /*tp_setattr*/
18827 #if PY_MAJOR_VERSION < 3
18828 0, /*tp_compare*/
18829 #endif
18830 #if PY_MAJOR_VERSION >= 3
18831 0, /*tp_as_async*/
18832 #endif
18833 __pyx_memoryview___repr__, /*tp_repr*/
18834 0, /*tp_as_number*/
18835 &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
18836 &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
18837 0, /*tp_hash*/
18838 0, /*tp_call*/
18839 __pyx_memoryview___str__, /*tp_str*/
18840 0, /*tp_getattro*/
18841 0, /*tp_setattro*/
18842 &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
18843 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
18844 0, /*tp_doc*/
18845 __pyx_tp_traverse_memoryview, /*tp_traverse*/
18846 __pyx_tp_clear_memoryview, /*tp_clear*/
18847 0, /*tp_richcompare*/
18848 0, /*tp_weaklistoffset*/
18849 0, /*tp_iter*/
18850 0, /*tp_iternext*/
18851 __pyx_methods_memoryview, /*tp_methods*/
18852 0, /*tp_members*/
18853 __pyx_getsets_memoryview, /*tp_getset*/
18854 0, /*tp_base*/
18855 0, /*tp_dict*/
18856 0, /*tp_descr_get*/
18857 0, /*tp_descr_set*/
18858 0, /*tp_dictoffset*/
18859 0, /*tp_init*/
18860 0, /*tp_alloc*/
18861 __pyx_tp_new_memoryview, /*tp_new*/
18862 0, /*tp_free*/
18863 0, /*tp_is_gc*/
18864 0, /*tp_bases*/
18865 0, /*tp_mro*/
18866 0, /*tp_cache*/
18867 0, /*tp_subclasses*/
18868 0, /*tp_weaklist*/
18869 0, /*tp_del*/
18870 0, /*tp_version_tag*/
18871 #if PY_VERSION_HEX >= 0x030400a1
18872 0, /*tp_finalize*/
18873 #endif
18874 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
18875 0, /*tp_vectorcall*/
18876 #endif
18877 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
18878 0, /*tp_print*/
18879 #endif
18880 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
18881 0, /*tp_pypy_flags*/
18882 #endif
18883};
18884static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
18885
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;
18894 return o;
18895}
18896
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;
18902 }
18903 #endif
18904 PyObject_GC_UnTrack(o);
18905 {
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);
18912 }
18913 Py_CLEAR(p->from_object);
18914 PyObject_GC_Track(o);
18915 __pyx_tp_dealloc_memoryview(o);
18916}
18917
18918static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
18919 int e;
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;
18924 }
18925 return 0;
18926}
18927
18928static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
18929 PyObject* tmp;
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);
18934 Py_XDECREF(tmp);
18935 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
18936 return 0;
18937}
18938
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);
18941}
18942
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},
18946 {0, 0, 0, 0}
18947};
18948
18949static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
18950 {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
18951 {0, 0, 0, 0, 0}
18952};
18953
18954static PyTypeObject __pyx_type___pyx_memoryviewslice = {
18955 PyVarObject_HEAD_INIT(0, 0)
18956 "roc_cy._memoryviewslice", /*tp_name*/
18957 sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
18958 0, /*tp_itemsize*/
18959 __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
18960 #if PY_VERSION_HEX < 0x030800b4
18961 0, /*tp_print*/
18962 #endif
18963 #if PY_VERSION_HEX >= 0x030800b4
18964 0, /*tp_vectorcall_offset*/
18965 #endif
18966 0, /*tp_getattr*/
18967 0, /*tp_setattr*/
18968 #if PY_MAJOR_VERSION < 3
18969 0, /*tp_compare*/
18970 #endif
18971 #if PY_MAJOR_VERSION >= 3
18972 0, /*tp_as_async*/
18973 #endif
18974 #if CYTHON_COMPILING_IN_PYPY
18975 __pyx_memoryview___repr__, /*tp_repr*/
18976 #else
18977 0, /*tp_repr*/
18978 #endif
18979 0, /*tp_as_number*/
18980 0, /*tp_as_sequence*/
18981 0, /*tp_as_mapping*/
18982 0, /*tp_hash*/
18983 0, /*tp_call*/
18984 #if CYTHON_COMPILING_IN_PYPY
18985 __pyx_memoryview___str__, /*tp_str*/
18986 #else
18987 0, /*tp_str*/
18988 #endif
18989 0, /*tp_getattro*/
18990 0, /*tp_setattro*/
18991 0, /*tp_as_buffer*/
18992 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
18993 "Internal class for passing memoryview slices to Python", /*tp_doc*/
18994 __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
18995 __pyx_tp_clear__memoryviewslice, /*tp_clear*/
18996 0, /*tp_richcompare*/
18997 0, /*tp_weaklistoffset*/
18998 0, /*tp_iter*/
18999 0, /*tp_iternext*/
19000 __pyx_methods__memoryviewslice, /*tp_methods*/
19001 0, /*tp_members*/
19002 __pyx_getsets__memoryviewslice, /*tp_getset*/
19003 0, /*tp_base*/
19004 0, /*tp_dict*/
19005 0, /*tp_descr_get*/
19006 0, /*tp_descr_set*/
19007 0, /*tp_dictoffset*/
19008 0, /*tp_init*/
19009 0, /*tp_alloc*/
19010 __pyx_tp_new__memoryviewslice, /*tp_new*/
19011 0, /*tp_free*/
19012 0, /*tp_is_gc*/
19013 0, /*tp_bases*/
19014 0, /*tp_mro*/
19015 0, /*tp_cache*/
19016 0, /*tp_subclasses*/
19017 0, /*tp_weaklist*/
19018 0, /*tp_del*/
19019 0, /*tp_version_tag*/
19020 #if PY_VERSION_HEX >= 0x030400a1
19021 0, /*tp_finalize*/
19022 #endif
19023 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
19024 0, /*tp_vectorcall*/
19025 #endif
19026 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
19027 0, /*tp_print*/
19028 #endif
19029 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
19030 0, /*tp_pypy_flags*/
19031 #endif
19032};
19033
19034static PyMethodDef __pyx_methods[] = {
19035 {"evaluate_roc_cy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6roc_cy_1evaluate_roc_cy, METH_VARARGS|METH_KEYWORDS, 0},
19036 {0, 0, 0, 0}
19037};
19038
19039#if PY_MAJOR_VERSION >= 3
19040#if CYTHON_PEP489_MULTI_PHASE_INIT
19041static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
19042static int __pyx_pymod_exec_roc_cy(PyObject* module); /*proto*/
19043static PyModuleDef_Slot __pyx_moduledef_slots[] = {
19044 {Py_mod_create, (void*)__pyx_pymod_create},
19045 {Py_mod_exec, (void*)__pyx_pymod_exec_roc_cy},
19046 {0, NULL}
19047};
19048#endif
19049
19050static struct PyModuleDef __pyx_moduledef = {
19051 PyModuleDef_HEAD_INIT,
19052 "roc_cy",
19053 0, /* m_doc */
19054 #if CYTHON_PEP489_MULTI_PHASE_INIT
19055 0, /* m_size */
19056 #else
19057 -1, /* m_size */
19058 #endif
19059 __pyx_methods /* m_methods */,
19060 #if CYTHON_PEP489_MULTI_PHASE_INIT
19061 __pyx_moduledef_slots, /* m_slots */
19062 #else
19063 NULL, /* m_reload */
19064 #endif
19065 NULL, /* m_traverse */
19066 NULL, /* m_clear */
19067 NULL /* m_free */
19068};
19069#endif
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))
19075#else
19076 #define CYTHON_SMALL_CODE
19077#endif
19078#endif
19079
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}
19194};
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)
19205 return 0;
19206 __pyx_L1_error:;
19207 return -1;
19208}
19209
19210static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
19211 __Pyx_RefNannyDeclarations
19212 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
19213
19214 /* "roc_cy.pyx":42
19215 *
19216 * cdef:
19217 * long[:,:] matches = (np.asarray(g_pids)[np.asarray(indices)] == np.asarray(q_pids)[:, np.newaxis]).astype(np.int64) # <<<<<<<<<<<<<<
19218 *
19219 * float[:] pos = np.zeros(num_q*num_g, dtype=np.float32)
19220 */
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_);
19224
19225 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":945
19226 * __pyx_import_array()
19227 * except Exception:
19228 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
19229 *
19230 * cdef inline int import_umath() except -1:
19231 */
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);
19235
19236 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":951
19237 * _import_umath()
19238 * except Exception:
19239 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
19240 *
19241 * cdef inline int import_ufunc() except -1:
19242 */
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);
19246
19247 /* "View.MemoryView":133
19248 *
19249 * if not self.ndim:
19250 * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
19251 *
19252 * if itemsize <= 0:
19253 */
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);
19257
19258 /* "View.MemoryView":136
19259 *
19260 * if itemsize <= 0:
19261 * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
19262 *
19263 * if not isinstance(format, bytes):
19264 */
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);
19268
19269 /* "View.MemoryView":148
19270 *
19271 * if not self._shape:
19272 * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
19273 *
19274 *
19275 */
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);
19279
19280 /* "View.MemoryView":176
19281 * self.data = <char *>malloc(self.len)
19282 * if not self.data:
19283 * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
19284 *
19285 * if self.dtype_is_object:
19286 */
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);
19290
19291 /* "View.MemoryView":192
19292 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
19293 * if not (flags & bufmode):
19294 * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
19295 * info.buf = self.data
19296 * info.len = self.len
19297 */
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);
19301
19302 /* "(tree fragment)":2
19303 * def __reduce_cython__(self):
19304 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
19305 * def __setstate_cython__(self, __pyx_state):
19306 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19307 */
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);
19311
19312 /* "(tree fragment)":4
19313 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19314 * def __setstate_cython__(self, __pyx_state):
19315 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
19316 */
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);
19320
19321 /* "View.MemoryView":418
19322 * def __setitem__(memoryview self, object index, object value):
19323 * if self.view.readonly:
19324 * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
19325 *
19326 * have_slices, index = _unellipsify(index, self.view.ndim)
19327 */
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);
19331
19332 /* "View.MemoryView":495
19333 * result = struct.unpack(self.view.format, bytesitem)
19334 * except struct.error:
19335 * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
19336 * else:
19337 * if len(self.view.format) == 1:
19338 */
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);
19342
19343 /* "View.MemoryView":520
19344 * def __getbuffer__(self, Py_buffer *info, int flags):
19345 * if flags & PyBUF_WRITABLE and self.view.readonly:
19346 * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
19347 *
19348 * if flags & PyBUF_ND:
19349 */
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);
19353
19354 /* "View.MemoryView":570
19355 * if self.view.strides == NULL:
19356 *
19357 * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
19358 *
19359 * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
19360 */
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);
19364
19365 /* "View.MemoryView":577
19366 * def suboffsets(self):
19367 * if self.view.suboffsets == NULL:
19368 * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
19369 *
19370 * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
19371 */
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);
19378
19379 /* "(tree fragment)":2
19380 * def __reduce_cython__(self):
19381 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
19382 * def __setstate_cython__(self, __pyx_state):
19383 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19384 */
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);
19388
19389 /* "(tree fragment)":4
19390 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19391 * def __setstate_cython__(self, __pyx_state):
19392 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
19393 */
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);
19397
19398 /* "View.MemoryView":703
19399 * for suboffset in suboffsets[:ndim]:
19400 * if suboffset >= 0:
19401 * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
19402 *
19403 *
19404 */
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);
19408
19409 /* "(tree fragment)":2
19410 * def __reduce_cython__(self):
19411 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
19412 * def __setstate_cython__(self, __pyx_state):
19413 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19414 */
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);
19418
19419 /* "(tree fragment)":4
19420 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19421 * def __setstate_cython__(self, __pyx_state):
19422 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
19423 */
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);
19427
19428 /* "View.MemoryView":286
19429 * return self.name
19430 *
19431 * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
19432 * cdef strided = Enum("<strided and direct>") # default
19433 * cdef indirect = Enum("<strided and indirect>")
19434 */
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);
19438
19439 /* "View.MemoryView":287
19440 *
19441 * cdef generic = Enum("<strided and direct or indirect>")
19442 * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
19443 * cdef indirect = Enum("<strided and indirect>")
19444 *
19445 */
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);
19449
19450 /* "View.MemoryView":288
19451 * cdef generic = Enum("<strided and direct or indirect>")
19452 * cdef strided = Enum("<strided and direct>") # default
19453 * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
19454 *
19455 *
19456 */
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);
19460
19461 /* "View.MemoryView":291
19462 *
19463 *
19464 * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
19465 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
19466 *
19467 */
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);
19471
19472 /* "View.MemoryView":292
19473 *
19474 * cdef contiguous = Enum("<contiguous and direct>")
19475 * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
19476 *
19477 *
19478 */
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);
19482
19483 /* "(tree fragment)":1
19484 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
19485 * cdef object __pyx_PickleError
19486 * cdef object __pyx_result
19487 */
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();
19493 return 0;
19494 __pyx_L1_error:;
19495 __Pyx_RefNannyFinishContext();
19496 return -1;
19497}
19498
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)
19505 return 0;
19506 __pyx_L1_error:;
19507 return -1;
19508}
19509
19510static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
19511static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
19512static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
19513static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
19514static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
19515static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
19516static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
19517
19518static int __Pyx_modinit_global_init_code(void) {
19519 __Pyx_RefNannyDeclarations
19520 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
19521 /*--- Global init code ---*/
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();
19528 return 0;
19529}
19530
19531static int __Pyx_modinit_variable_export_code(void) {
19532 __Pyx_RefNannyDeclarations
19533 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
19534 /*--- Variable export code ---*/
19535 __Pyx_RefNannyFinishContext();
19536 return 0;
19537}
19538
19539static int __Pyx_modinit_function_export_code(void) {
19540 __Pyx_RefNannyDeclarations
19541 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
19542 /*--- Function export code ---*/
19543 __Pyx_RefNannyFinishContext();
19544 return 0;
19545}
19546
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);
19553 /*--- Type init code ---*/
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;
19559 #endif
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;
19566 #endif
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;
19569 }
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;
19583 #endif
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;
19586 }
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;
19598 #endif
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;
19601 }
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();
19606 return 0;
19607 __pyx_L1_error:;
19608 __Pyx_RefNannyFinishContext();
19609 return -1;
19610}
19611
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);
19619 /*--- Type import code ---*/
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),
19625 #else
19626 sizeof(PyHeapTypeObject),
19627 #endif
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();
19665 return 0;
19666 __pyx_L1_error:;
19667 __Pyx_XDECREF(__pyx_t_1);
19668 __Pyx_RefNannyFinishContext();
19669 return -1;
19670}
19671
19672static int __Pyx_modinit_variable_import_code(void) {
19673 __Pyx_RefNannyDeclarations
19674 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
19675 /*--- Variable import code ---*/
19676 __Pyx_RefNannyFinishContext();
19677 return 0;
19678}
19679
19680static int __Pyx_modinit_function_import_code(void) {
19681 __Pyx_RefNannyDeclarations
19682 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
19683 /*--- Function import code ---*/
19684 __Pyx_RefNannyFinishContext();
19685 return 0;
19686}
19687
19688
19689#ifndef CYTHON_NO_PYINIT_EXPORT
19690#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
19691#elif PY_MAJOR_VERSION < 3
19692#ifdef __cplusplus
19693#define __Pyx_PyMODINIT_FUNC extern "C" void
19694#else
19695#define __Pyx_PyMODINIT_FUNC void
19696#endif
19697#else
19698#ifdef __cplusplus
19699#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
19700#else
19701#define __Pyx_PyMODINIT_FUNC PyObject *
19702#endif
19703#endif
19704
19705
19706#if PY_MAJOR_VERSION < 3
19707__Pyx_PyMODINIT_FUNC initroc_cy(void) CYTHON_SMALL_CODE; /*proto*/
19708__Pyx_PyMODINIT_FUNC initroc_cy(void)
19709#else
19710__Pyx_PyMODINIT_FUNC PyInit_roc_cy(void) CYTHON_SMALL_CODE; /*proto*/
19711__Pyx_PyMODINIT_FUNC PyInit_roc_cy(void)
19712#if CYTHON_PEP489_MULTI_PHASE_INIT
19713{
19714 return PyModuleDef_Init(&__pyx_moduledef);
19715}
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))
19724 #else
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))
19730 #endif
19731 {
19732 PyErr_SetString(
19733 PyExc_ImportError,
19734 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
19735 return -1;
19736 }
19737 return 0;
19738}
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);
19741 int result = 0;
19742 if (likely(value)) {
19743 if (allow_none || value != Py_None) {
19744 result = PyDict_SetItemString(moddict, to_name, value);
19745 }
19746 Py_DECREF(value);
19747 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
19748 PyErr_Clear();
19749 } else {
19750 result = -1;
19751 }
19752 return result;
19753}
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())
19757 return NULL;
19758 if (__pyx_m)
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;
19771 return module;
19772bad:
19773 Py_XDECREF(module);
19774 return NULL;
19775}
19776
19777
19778static CYTHON_SMALL_CODE int __pyx_pymod_exec_roc_cy(PyObject *__pyx_pyinit_module)
19779#endif
19780#endif
19781{
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
19789 if (__pyx_m) {
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.");
19792 return -1;
19793 }
19794 #elif PY_MAJOR_VERSION >= 3
19795 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
19796 #endif
19797 #if CYTHON_REFNANNY
19798__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
19799if (!__Pyx_RefNanny) {
19800 PyErr_Clear();
19801 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
19802 if (!__Pyx_RefNanny)
19803 Py_FatalError("failed to import 'refnanny' module");
19804}
19805#endif
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();
19810 #endif
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)
19816 #endif
19817 #ifdef __Pyx_FusedFunction_USED
19818 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19819 #endif
19820 #ifdef __Pyx_Coroutine_USED
19821 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19822 #endif
19823 #ifdef __Pyx_Generator_USED
19824 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19825 #endif
19826 #ifdef __Pyx_AsyncGen_USED
19827 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19828 #endif
19829 #ifdef __Pyx_StopAsyncIteration_USED
19830 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19831 #endif
19832 /*--- Library function declarations ---*/
19833 /*--- Threads initialization code ---*/
19834 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
19835 PyEval_InitThreads();
19836 #endif
19837 /*--- Module creation code ---*/
19838 #if CYTHON_PEP489_MULTI_PHASE_INIT
19839 __pyx_m = __pyx_pyinit_module;
19840 Py_INCREF(__pyx_m);
19841 #else
19842 #if PY_MAJOR_VERSION < 3
19843 __pyx_m = Py_InitModule4("roc_cy", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
19844 #else
19845 __pyx_m = PyModule_Create(&__pyx_moduledef);
19846 #endif
19847 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
19848 #endif
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);
19856 /*--- Initialize various global constants etc. ---*/
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)
19860 #endif
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)
19863 }
19864 #if PY_MAJOR_VERSION >= 3
19865 {
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)
19869 }
19870 }
19871 #endif
19872 /*--- Builtin init code ---*/
19873 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19874 /*--- Constants init code ---*/
19875 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19876 /*--- Global type/function init code ---*/
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();
19884 /*--- Execution code ---*/
19885 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
19886 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
19887 #endif
19888
19889 /* "roc_cy.pyx":5
19890 *
19891 * import cython
19892 * import faiss # <<<<<<<<<<<<<<
19893 * import numpy as np
19894 * cimport numpy as np
19895 */
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;
19900
19901 /* "roc_cy.pyx":6
19902 * import cython
19903 * import faiss
19904 * import numpy as np # <<<<<<<<<<<<<<
19905 * cimport numpy as np
19906 *
19907 */
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;
19912
19913 /* "roc_cy.pyx":1
19914 * # cython: boundscheck=False, wraparound=False, nonecheck=False, cdivision=True # <<<<<<<<<<<<<<
19915 * # credits: https://github.com/KaiyangZhou/deep-person-reid/blob/master/torchreid/metrics/rank_cylib/rank_cy.pyx
19916 *
19917 */
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;
19922
19923 /* "View.MemoryView":209
19924 * info.obj = self
19925 *
19926 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
19927 *
19928 * def __dealloc__(array self):
19929 */
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);
19935
19936 /* "View.MemoryView":286
19937 * return self.name
19938 *
19939 * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
19940 * cdef strided = Enum("<strided and direct>") # default
19941 * cdef indirect = Enum("<strided and indirect>")
19942 */
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);
19948 __pyx_t_1 = 0;
19949
19950 /* "View.MemoryView":287
19951 *
19952 * cdef generic = Enum("<strided and direct or indirect>")
19953 * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
19954 * cdef indirect = Enum("<strided and indirect>")
19955 *
19956 */
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);
19962 __pyx_t_1 = 0;
19963
19964 /* "View.MemoryView":288
19965 * cdef generic = Enum("<strided and direct or indirect>")
19966 * cdef strided = Enum("<strided and direct>") # default
19967 * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
19968 *
19969 *
19970 */
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);
19976 __pyx_t_1 = 0;
19977
19978 /* "View.MemoryView":291
19979 *
19980 *
19981 * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
19982 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
19983 *
19984 */
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);
19990 __pyx_t_1 = 0;
19991
19992 /* "View.MemoryView":292
19993 *
19994 * cdef contiguous = Enum("<contiguous and direct>")
19995 * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
19996 *
19997 *
19998 */
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);
20004 __pyx_t_1 = 0;
20005
20006 /* "View.MemoryView":316
20007 *
20008 * DEF THREAD_LOCKS_PREALLOCATED = 8
20009 * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<<
20010 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
20011 * PyThread_allocate_lock(),
20012 */
20013 __pyx_memoryview_thread_locks_used = 0;
20014
20015 /* "View.MemoryView":317
20016 * DEF THREAD_LOCKS_PREALLOCATED = 8
20017 * cdef int __pyx_memoryview_thread_locks_used = 0
20018 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<<
20019 * PyThread_allocate_lock(),
20020 * PyThread_allocate_lock(),
20021 */
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));
20031
20032 /* "View.MemoryView":549
20033 * info.obj = self
20034 *
20035 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
20036 *
20037 *
20038 */
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);
20044
20045 /* "View.MemoryView":995
20046 * return self.from_object
20047 *
20048 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
20049 *
20050 *
20051 */
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);
20057
20058 /* "(tree fragment)":1
20059 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
20060 * cdef object __pyx_PickleError
20061 * cdef object __pyx_result
20062 */
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;
20067
20068 /* "(tree fragment)":11
20069 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20070 * return __pyx_result
20071 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
20072 * __pyx_result.name = __pyx_state[0]
20073 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
20074 */
20075
20076 /*--- Wrapped vars code ---*/
20077
20078 goto __pyx_L0;
20079 __pyx_L1_error:;
20080 __Pyx_XDECREF(__pyx_t_1);
20081 if (__pyx_m) {
20082 if (__pyx_d) {
20083 __Pyx_AddTraceback("init roc_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
20084 }
20085 Py_CLEAR(__pyx_m);
20086 } else if (!PyErr_Occurred()) {
20087 PyErr_SetString(PyExc_ImportError, "init roc_cy");
20088 }
20089 __pyx_L0:;
20090 __Pyx_RefNannyFinishContext();
20091 #if CYTHON_PEP489_MULTI_PHASE_INIT
20092 return (__pyx_m != NULL) ? 0 : -1;
20093 #elif PY_MAJOR_VERSION >= 3
20094 return __pyx_m;
20095 #else
20096 return;
20097 #endif
20098}
20099
20100/* --- Runtime support code --- */
20101/* Refnanny */
20102#if CYTHON_REFNANNY
20103static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
20104 PyObject *m = NULL, *p = NULL;
20105 void *r = NULL;
20106 m = PyImport_ImportModule(modname);
20107 if (!m) goto end;
20108 p = PyObject_GetAttrString(m, "RefNannyAPI");
20109 if (!p) goto end;
20110 r = PyLong_AsVoidPtr(p);
20111end:
20112 Py_XDECREF(p);
20113 Py_XDECREF(m);
20114 return (__Pyx_RefNannyAPIStruct *)r;
20115}
20116#endif
20117
20118/* PyObjectGetAttrStr */
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));
20127#endif
20128 return PyObject_GetAttr(obj, attr_name);
20129}
20130#endif
20131
20132/* GetBuiltinName */
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);
20139#else
20140 "name '%.200s' is not defined", PyString_AS_STRING(name));
20141#endif
20142 }
20143 return result;
20144}
20145
20146/* MemviewSliceInit */
20147static int
20148__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
20149 int ndim,
20150 __Pyx_memviewslice *memviewslice,
20151 int memview_is_new_reference)
20152{
20153 __Pyx_RefNannyDeclarations
20154 int i, retval=-1;
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!");
20160 goto fail;
20161 }
20162 if (buf->strides) {
20163 for (i = 0; i < ndim; i++) {
20164 memviewslice->strides[i] = buf->strides[i];
20165 }
20166 } else {
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];
20171 }
20172 }
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];
20177 } else {
20178 memviewslice->suboffsets[i] = -1;
20179 }
20180 }
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);
20185 }
20186 retval = 0;
20187 goto no_fail;
20188fail:
20189 memviewslice->memview = 0;
20190 memviewslice->data = 0;
20191 retval = -1;
20192no_fail:
20193 __Pyx_RefNannyFinishContext();
20194 return retval;
20195}
20196#ifndef Py_NO_RETURN
20197#define Py_NO_RETURN
20198#endif
20199static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
20200 va_list vargs;
20201 char msg[200];
20202#ifdef HAVE_STDARG_PROTOTYPES
20203 va_start(vargs, fmt);
20204#else
20205 va_start(vargs);
20206#endif
20207 vsnprintf(msg, 200, fmt, vargs);
20208 va_end(vargs);
20209 Py_FatalError(msg);
20210}
20211static CYTHON_INLINE int
20212__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
20213 PyThread_type_lock lock)
20214{
20215 int result;
20216 PyThread_acquire_lock(lock, 1);
20217 result = (*acquisition_count)++;
20218 PyThread_release_lock(lock);
20219 return result;
20220}
20221static CYTHON_INLINE int
20222__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
20223 PyThread_type_lock lock)
20224{
20225 int result;
20226 PyThread_acquire_lock(lock, 1);
20227 result = (*acquisition_count)--;
20228 PyThread_release_lock(lock);
20229 return result;
20230}
20231static CYTHON_INLINE void
20232__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
20233{
20234 int first_time;
20235 struct __pyx_memoryview_obj *memview = memslice->memview;
20236 if (unlikely(!memview || (PyObject *) memview == Py_None))
20237 return;
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)) {
20243 if (have_gil) {
20244 Py_INCREF((PyObject *) memview);
20245 } else {
20246 PyGILState_STATE _gilstate = PyGILState_Ensure();
20247 Py_INCREF((PyObject *) memview);
20248 PyGILState_Release(_gilstate);
20249 }
20250 }
20251}
20252static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
20253 int have_gil, int lineno) {
20254 int last_time;
20255 struct __pyx_memoryview_obj *memview = memslice->memview;
20256 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
20257 memslice->memview = NULL;
20258 return;
20259 }
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)) {
20266 if (have_gil) {
20267 Py_CLEAR(memslice->memview);
20268 } else {
20269 PyGILState_STATE _gilstate = PyGILState_Ensure();
20270 Py_CLEAR(memslice->memview);
20271 PyGILState_Release(_gilstate);
20272 }
20273 } else {
20274 memslice->memview = NULL;
20275 }
20276}
20277
20278/* PyDictVersioning */
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;
20283}
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;
20287 if (offset) {
20288#if CYTHON_COMPILING_IN_CPYTHON
20289 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
20290#else
20291 dictptr = _PyObject_GetDictPtr(obj);
20292#endif
20293 }
20294 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
20295}
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)))
20299 return 0;
20300 return obj_dict_version == __Pyx_get_object_dict_version(obj);
20301}
20302#endif
20303
20304/* GetModuleGlobalName */
20305#if CYTHON_USE_DICT_VERSIONS
20306static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
20307#else
20308static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
20309#endif
20310{
20311 PyObject *result;
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())) {
20319 return NULL;
20320 }
20321#else
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);
20326 }
20327#endif
20328#else
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);
20333 }
20334 PyErr_Clear();
20335#endif
20336 return __Pyx_GetBuiltinName(name);
20337}
20338
20339/* PyObjectCall */
20340#if CYTHON_COMPILING_IN_CPYTHON
20341static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
20342 PyObject *result;
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")))
20347 return NULL;
20348 result = (*call)(func, arg, kw);
20349 Py_LeaveRecursiveCall();
20350 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
20351 PyErr_SetString(
20352 PyExc_SystemError,
20353 "NULL result without error in PyObject_Call");
20354 }
20355 return result;
20356}
20357#endif
20358
20359/* PyCFunctionFastCall */
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);
20370 /* _PyCFunction_FastCallDict() must not be called with an exception set,
20371 because it may clear it (directly or indirectly) and so the
20372 caller loses its exception */
20373 assert(!PyErr_Occurred());
20374 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
20375 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
20376 } else {
20377 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
20378 }
20379}
20380#endif
20381
20382/* PyFunctionFastCall */
20383#if CYTHON_FAST_PYCALL
20384static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
20385 PyObject *globals) {
20386 PyFrameObject *f;
20387 PyThreadState *tstate = __Pyx_PyThreadState_Current;
20388 PyObject **fastlocals;
20389 Py_ssize_t i;
20390 PyObject *result;
20391 assert(globals != NULL);
20392 /* XXX Perhaps we should create a specialized
20393 PyFrame_New() that doesn't take locals, but does
20394 take builtins without sanity checking them.
20395 */
20396 assert(tstate != NULL);
20397 f = PyFrame_New(tstate, co, globals, NULL);
20398 if (f == NULL) {
20399 return NULL;
20400 }
20401 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
20402 for (i = 0; i < na; i++) {
20403 Py_INCREF(*args);
20404 fastlocals[i] = *args++;
20405 }
20406 result = PyEval_EvalFrameEx(f,0);
20407 ++tstate->recursion_depth;
20408 Py_DECREF(f);
20409 --tstate->recursion_depth;
20410 return result;
20411}
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);
20417 PyObject *closure;
20418#if PY_MAJOR_VERSION >= 3
20419 PyObject *kwdefs;
20420#endif
20421 PyObject *kwtuple, **k;
20422 PyObject **d;
20423 Py_ssize_t nd;
20424 Py_ssize_t nk;
20425 PyObject *result;
20426 assert(kwargs == NULL || PyDict_Check(kwargs));
20427 nk = kwargs ? PyDict_Size(kwargs) : 0;
20428 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
20429 return NULL;
20430 }
20431 if (
20432#if PY_MAJOR_VERSION >= 3
20433 co->co_kwonlyargcount == 0 &&
20434#endif
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);
20439 goto done;
20440 }
20441 else if (nargs == 0 && argdefs != NULL
20442 && co->co_argcount == Py_SIZE(argdefs)) {
20443 /* function called with no arguments, but all parameters have
20444 a default value: use default values as arguments .*/
20445 args = &PyTuple_GET_ITEM(argdefs, 0);
20446 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
20447 goto done;
20448 }
20449 }
20450 if (kwargs != NULL) {
20451 Py_ssize_t pos, i;
20452 kwtuple = PyTuple_New(2 * nk);
20453 if (kwtuple == NULL) {
20454 result = NULL;
20455 goto done;
20456 }
20457 k = &PyTuple_GET_ITEM(kwtuple, 0);
20458 pos = i = 0;
20459 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
20460 Py_INCREF(k[i]);
20461 Py_INCREF(k[i+1]);
20462 i += 2;
20463 }
20464 nk = i / 2;
20465 }
20466 else {
20467 kwtuple = NULL;
20468 k = NULL;
20469 }
20470 closure = PyFunction_GET_CLOSURE(func);
20471#if PY_MAJOR_VERSION >= 3
20472 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
20473#endif
20474 if (argdefs != NULL) {
20475 d = &PyTuple_GET_ITEM(argdefs, 0);
20476 nd = Py_SIZE(argdefs);
20477 }
20478 else {
20479 d = NULL;
20480 nd = 0;
20481 }
20482#if PY_MAJOR_VERSION >= 3
20483 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
20484 args, (int)nargs,
20485 k, (int)nk,
20486 d, (int)nd, kwdefs, closure);
20487#else
20488 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
20489 args, (int)nargs,
20490 k, (int)nk,
20491 d, (int)nd, closure);
20492#endif
20493 Py_XDECREF(kwtuple);
20494done:
20495 Py_LeaveRecursiveCall();
20496 return result;
20497}
20498#endif
20499#endif
20500
20501/* PyObjectCall2Args */
20502static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
20503 PyObject *args, *result = NULL;
20504 #if CYTHON_FAST_PYCALL
20505 if (PyFunction_Check(function)) {
20506 PyObject *args[2] = {arg1, arg2};
20507 return __Pyx_PyFunction_FastCall(function, args, 2);
20508 }
20509 #endif
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);
20514 }
20515 #endif
20516 args = PyTuple_New(2);
20517 if (unlikely(!args)) goto done;
20518 Py_INCREF(arg1);
20519 PyTuple_SET_ITEM(args, 0, arg1);
20520 Py_INCREF(arg2);
20521 PyTuple_SET_ITEM(args, 1, arg2);
20522 Py_INCREF(function);
20523 result = __Pyx_PyObject_Call(function, args, NULL);
20524 Py_DECREF(args);
20525 Py_DECREF(function);
20526done:
20527 return result;
20528}
20529
20530/* PyObjectCallMethO */
20531#if CYTHON_COMPILING_IN_CPYTHON
20532static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
20533 PyObject *self, *result;
20534 PyCFunction cfunc;
20535 cfunc = PyCFunction_GET_FUNCTION(func);
20536 self = PyCFunction_GET_SELF(func);
20537 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
20538 return NULL;
20539 result = cfunc(self, arg);
20540 Py_LeaveRecursiveCall();
20541 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
20542 PyErr_SetString(
20543 PyExc_SystemError,
20544 "NULL result without error in PyObject_Call");
20545 }
20546 return result;
20547}
20548#endif
20549
20550/* PyObjectCallOneArg */
20551#if CYTHON_COMPILING_IN_CPYTHON
20552static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20553 PyObject *result;
20554 PyObject *args = PyTuple_New(1);
20555 if (unlikely(!args)) return NULL;
20556 Py_INCREF(arg);
20557 PyTuple_SET_ITEM(args, 0, arg);
20558 result = __Pyx_PyObject_Call(func, args, NULL);
20559 Py_DECREF(args);
20560 return result;
20561}
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);
20566 }
20567#endif
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);
20574#endif
20575 }
20576 }
20577 return __Pyx__PyObject_CallOneArg(func, arg);
20578}
20579#else
20580static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
20581 PyObject *result;
20582 PyObject *args = PyTuple_Pack(1, arg);
20583 if (unlikely(!args)) return NULL;
20584 result = __Pyx_PyObject_Call(func, args, NULL);
20585 Py_DECREF(args);
20586 return result;
20587}
20588#endif
20589
20590/* GetItemInt */
20591static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
20592 PyObject *r;
20593 if (!j) return NULL;
20594 r = PyObject_GetItem(o, j);
20595 Py_DECREF(j);
20596 return r;
20597}
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);
20605 }
20606 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
20607 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
20608 Py_INCREF(r);
20609 return r;
20610 }
20611 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
20612#else
20613 return PySequence_GetItem(o, i);
20614#endif
20615}
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);
20623 }
20624 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
20625 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
20626 Py_INCREF(r);
20627 return r;
20628 }
20629 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
20630#else
20631 return PySequence_GetItem(o, i);
20632#endif
20633}
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);
20642 Py_INCREF(r);
20643 return r;
20644 }
20645 }
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);
20650 Py_INCREF(r);
20651 return r;
20652 }
20653 } else {
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)) {
20659 i += l;
20660 } else {
20661 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
20662 return NULL;
20663 PyErr_Clear();
20664 }
20665 }
20666 return m->sq_item(o, i);
20667 }
20668 }
20669#else
20670 if (is_list || PySequence_Check(o)) {
20671 return PySequence_GetItem(o, i);
20672 }
20673#endif
20674 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
20675}
20676
20677/* ObjectGetItem */
20678#if CYTHON_USE_TYPE_SLOTS
20679static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
20680 PyObject *runerr;
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);
20685 return NULL;
20686 }
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);
20690 }
20691 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
20692 PyErr_Clear();
20693 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
20694 }
20695 return NULL;
20696}
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);
20701 }
20702 return __Pyx_PyObject_GetIndex(obj, key);
20703}
20704#endif
20705
20706/* PyIntBinop */
20707#if !CYTHON_COMPILING_IN_PYPY
20708static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
20709 (void)inplace;
20710 (void)zerodivision_check;
20711 #if PY_MAJOR_VERSION < 3
20712 if (likely(PyInt_CheckExact(op1))) {
20713 const long b = intval;
20714 long x;
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);
20720 }
20721 #endif
20722 #if CYTHON_USE_PYLONG_INTERNALS
20723 if (likely(PyLong_CheckExact(op1))) {
20724 const long b = intval;
20725 long a, x;
20726#ifdef HAVE_LONG_LONG
20727 const PY_LONG_LONG llb = intval;
20728 PY_LONG_LONG lla, llx;
20729#endif
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;
20735 } else {
20736 switch (size) {
20737 case -2:
20738 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
20739 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
20740 break;
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]));
20744 goto long_long;
20745#endif
20746 }
20747 CYTHON_FALLTHROUGH;
20748 case 2:
20749 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
20750 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
20751 break;
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]));
20755 goto long_long;
20756#endif
20757 }
20758 CYTHON_FALLTHROUGH;
20759 case -3:
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]));
20762 break;
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]));
20766 goto long_long;
20767#endif
20768 }
20769 CYTHON_FALLTHROUGH;
20770 case 3:
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]));
20773 break;
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]));
20777 goto long_long;
20778#endif
20779 }
20780 CYTHON_FALLTHROUGH;
20781 case -4:
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]));
20784 break;
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]));
20788 goto long_long;
20789#endif
20790 }
20791 CYTHON_FALLTHROUGH;
20792 case 4:
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]));
20795 break;
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]));
20799 goto long_long;
20800#endif
20801 }
20802 CYTHON_FALLTHROUGH;
20803 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
20804 }
20805 }
20806 x = a + b;
20807 return PyLong_FromLong(x);
20808#ifdef HAVE_LONG_LONG
20809 long_long:
20810 llx = lla + llb;
20811 return PyLong_FromLongLong(llx);
20812#endif
20813
20814
20815 }
20816 #endif
20817 if (PyFloat_CheckExact(op1)) {
20818 const long b = intval;
20819 double a = PyFloat_AS_DOUBLE(op1);
20820 double result;
20821 PyFPE_START_PROTECT("add", return NULL)
20822 result = ((double)a) + (double)b;
20823 PyFPE_END_PROTECT(result)
20824 return PyFloat_FromDouble(result);
20825 }
20826 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
20827}
20828#endif
20829
20830/* RaiseArgTupleInvalid */
20831static void __Pyx_RaiseArgtupleInvalid(
20832 const char* func_name,
20833 int exact,
20834 Py_ssize_t num_min,
20835 Py_ssize_t num_max,
20836 Py_ssize_t num_found)
20837{
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";
20843 } else {
20844 num_expected = num_max;
20845 more_or_less = "at most";
20846 }
20847 if (exact) {
20848 more_or_less = "exactly";
20849 }
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);
20854}
20855
20856/* RaiseDoubleKeywords */
20857static void __Pyx_RaiseDoubleKeywordsError(
20858 const char* func_name,
20859 PyObject* kw_name)
20860{
20861 PyErr_Format(PyExc_TypeError,
20862 #if PY_MAJOR_VERSION >= 3
20863 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
20864 #else
20865 "%s() got multiple values for keyword argument '%s'", func_name,
20866 PyString_AsString(kw_name));
20867 #endif
20868}
20869
20870/* ParseKeywords */
20871static int __Pyx_ParseOptionalKeywords(
20872 PyObject *kwds,
20873 PyObject **argnames[],
20874 PyObject *kwds2,
20875 PyObject *values[],
20876 Py_ssize_t num_pos_args,
20877 const char* function_name)
20878{
20879 PyObject *key = 0, *value = 0;
20880 Py_ssize_t pos = 0;
20881 PyObject*** name;
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++;
20886 if (*name) {
20887 values[name-argnames] = value;
20888 continue;
20889 }
20890 name = first_kw_arg;
20891 #if PY_MAJOR_VERSION < 3
20892 if (likely(PyString_Check(key))) {
20893 while (*name) {
20894 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
20895 && _PyString_Eq(**name, key)) {
20896 values[name-argnames] = value;
20897 break;
20898 }
20899 name++;
20900 }
20901 if (*name) continue;
20902 else {
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;
20909 }
20910 argname++;
20911 }
20912 }
20913 } else
20914 #endif
20915 if (likely(PyUnicode_Check(key))) {
20916 while (*name) {
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 :
20920 #endif
20921 PyUnicode_Compare(**name, key);
20922 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
20923 if (cmp == 0) {
20924 values[name-argnames] = value;
20925 break;
20926 }
20927 name++;
20928 }
20929 if (*name) continue;
20930 else {
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 :
20936 #endif
20937 PyUnicode_Compare(**argname, key);
20938 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
20939 if (cmp == 0) goto arg_passed_twice;
20940 argname++;
20941 }
20942 }
20943 } else
20944 goto invalid_keyword_type;
20945 if (kwds2) {
20946 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
20947 } else {
20948 goto invalid_keyword;
20949 }
20950 }
20951 return 0;
20952arg_passed_twice:
20953 __Pyx_RaiseDoubleKeywordsError(function_name, key);
20954 goto bad;
20955invalid_keyword_type:
20956 PyErr_Format(PyExc_TypeError,
20957 "%.200s() keywords must be strings", function_name);
20958 goto bad;
20959invalid_keyword:
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));
20964 #else
20965 "%s() got an unexpected keyword argument '%U'",
20966 function_name, key);
20967 #endif
20968bad:
20969 return -1;
20970}
20971
20972/* None */
20973static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
20974 PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
20975}
20976
20977/* GetTopmostException */
20978#if CYTHON_USE_EXC_INFO_STACK
20979static _PyErr_StackItem *
20980__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
20981{
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)
20985 {
20986 exc_info = exc_info->previous_item;
20987 }
20988 return exc_info;
20989}
20990#endif
20991
20992/* SaveResetException */
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;
21000 #else
21001 *type = tstate->exc_type;
21002 *value = tstate->exc_value;
21003 *tb = tstate->exc_traceback;
21004 #endif
21005 Py_XINCREF(*type);
21006 Py_XINCREF(*value);
21007 Py_XINCREF(*tb);
21008}
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;
21019 #else
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;
21026 #endif
21027 Py_XDECREF(tmp_type);
21028 Py_XDECREF(tmp_value);
21029 Py_XDECREF(tmp_tb);
21030}
21031#endif
21032
21033/* PyErrExceptionMatches */
21034#if CYTHON_FAST_THREAD_STATE
21035static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
21036 Py_ssize_t i, n;
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;
21041 }
21042#endif
21043 for (i=0; i<n; i++) {
21044 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
21045 }
21046 return 0;
21047}
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);
21055}
21056#endif
21057
21058/* GetException */
21059#if CYTHON_FAST_THREAD_STATE
21060static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
21061#else
21062static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
21063#endif
21064{
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;
21074#else
21075 PyErr_Fetch(&local_type, &local_value, &local_tb);
21076#endif
21077 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
21078#if CYTHON_FAST_THREAD_STATE
21079 if (unlikely(tstate->curexc_type))
21080#else
21081 if (unlikely(PyErr_Occurred()))
21082#endif
21083 goto bad;
21084 #if PY_MAJOR_VERSION >= 3
21085 if (local_tb) {
21086 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
21087 goto bad;
21088 }
21089 #endif
21090 Py_XINCREF(local_tb);
21091 Py_XINCREF(local_type);
21092 Py_XINCREF(local_value);
21093 *type = local_type;
21094 *value = local_value;
21095 *tb = local_tb;
21096#if CYTHON_FAST_THREAD_STATE
21097 #if CYTHON_USE_EXC_INFO_STACK
21098 {
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;
21106 }
21107 #else
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;
21114 #endif
21115 Py_XDECREF(tmp_type);
21116 Py_XDECREF(tmp_value);
21117 Py_XDECREF(tmp_tb);
21118#else
21119 PyErr_SetExcInfo(local_type, local_value, local_tb);
21120#endif
21121 return 0;
21122bad:
21123 *type = 0;
21124 *value = 0;
21125 *tb = 0;
21126 Py_XDECREF(local_type);
21127 Py_XDECREF(local_value);
21128 Py_XDECREF(local_tb);
21129 return -1;
21130}
21131
21132/* PyErrFetchRestore */
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);
21145}
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;
21153}
21154#endif
21155
21156/* RaiseException */
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
21161 Py_XINCREF(type);
21162 if (!value || value == Py_None)
21163 value = NULL;
21164 else
21165 Py_INCREF(value);
21166 if (!tb || tb == Py_None)
21167 tb = NULL;
21168 else {
21169 Py_INCREF(tb);
21170 if (!PyTraceBack_Check(tb)) {
21171 PyErr_SetString(PyExc_TypeError,
21172 "raise: arg 3 must be a traceback or None");
21173 goto raise_error;
21174 }
21175 }
21176 if (PyType_Check(type)) {
21177#if CYTHON_COMPILING_IN_PYPY
21178 if (!value) {
21179 Py_INCREF(Py_None);
21180 value = Py_None;
21181 }
21182#endif
21183 PyErr_NormalizeException(&type, &value, &tb);
21184 } else {
21185 if (value) {
21186 PyErr_SetString(PyExc_TypeError,
21187 "instance exception may not have a separate value");
21188 goto raise_error;
21189 }
21190 value = type;
21191 type = (PyObject*) Py_TYPE(type);
21192 Py_INCREF(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");
21196 goto raise_error;
21197 }
21198 }
21199 __Pyx_PyThreadState_assign
21200 __Pyx_ErrRestore(type, value, tb);
21201 return;
21202raise_error:
21203 Py_XDECREF(value);
21204 Py_XDECREF(type);
21205 Py_XDECREF(tb);
21206 return;
21207}
21208#else
21209static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
21210 PyObject* owned_instance = NULL;
21211 if (tb == Py_None) {
21212 tb = 0;
21213 } else if (tb && !PyTraceBack_Check(tb)) {
21214 PyErr_SetString(PyExc_TypeError,
21215 "raise: arg 3 must be a traceback or None");
21216 goto bad;
21217 }
21218 if (value == Py_None)
21219 value = 0;
21220 if (PyExceptionInstance_Check(type)) {
21221 if (value) {
21222 PyErr_SetString(PyExc_TypeError,
21223 "instance exception may not have a separate value");
21224 goto bad;
21225 }
21226 value = type;
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)) {
21237 goto bad;
21238 } else {
21239 type = instance_class;
21240 }
21241 }
21242 }
21243 if (!instance_class) {
21244 PyObject *args;
21245 if (!value)
21246 args = PyTuple_New(0);
21247 else if (PyTuple_Check(value)) {
21248 Py_INCREF(value);
21249 args = value;
21250 } else
21251 args = PyTuple_Pack(1, value);
21252 if (!args)
21253 goto bad;
21254 owned_instance = PyObject_Call(type, args, NULL);
21255 Py_DECREF(args);
21256 if (!owned_instance)
21257 goto bad;
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));
21264 goto bad;
21265 }
21266 }
21267 } else {
21268 PyErr_SetString(PyExc_TypeError,
21269 "raise: exception class must be a subclass of BaseException");
21270 goto bad;
21271 }
21272 if (cause) {
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)
21279 goto bad;
21280 } else if (PyExceptionInstance_Check(cause)) {
21281 fixed_cause = cause;
21282 Py_INCREF(fixed_cause);
21283 } else {
21284 PyErr_SetString(PyExc_TypeError,
21285 "exception causes must derive from "
21286 "BaseException");
21287 goto bad;
21288 }
21289 PyException_SetCause(value, fixed_cause);
21290 }
21291 PyErr_SetObject(type, value);
21292 if (tb) {
21293#if CYTHON_COMPILING_IN_PYPY
21294 PyObject *tmp_type, *tmp_value, *tmp_tb;
21295 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
21296 Py_INCREF(tb);
21297 PyErr_Restore(tmp_type, tmp_value, tb);
21298 Py_XDECREF(tmp_tb);
21299#else
21300 PyThreadState *tstate = __Pyx_PyThreadState_Current;
21301 PyObject* tmp_tb = tstate->curexc_traceback;
21302 if (tb != tmp_tb) {
21303 Py_INCREF(tb);
21304 tstate->curexc_traceback = tb;
21305 Py_XDECREF(tmp_tb);
21306 }
21307#endif
21308 }
21309bad:
21310 Py_XDECREF(owned_instance);
21311 return;
21312}
21313#endif
21314
21315/* ArgTypeTest */
21316static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
21317{
21318 if (unlikely(!type)) {
21319 PyErr_SetString(PyExc_SystemError, "Missing type object");
21320 return 0;
21321 }
21322 else if (exact) {
21323 #if PY_MAJOR_VERSION == 2
21324 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
21325 #endif
21326 }
21327 else {
21328 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
21329 }
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);
21333 return 0;
21334}
21335
21336/* BytesEquals */
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);
21340#else
21341 if (s1 == s2) {
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);
21354 } else {
21355 int result;
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);
21362 }
21363#endif
21364 result = memcmp(ps1, ps2, (size_t)length);
21365 return (equals == Py_EQ) ? (result == 0) : (result != 0);
21366 }
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);
21371 } else {
21372 int result;
21373 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
21374 if (!py_result)
21375 return -1;
21376 result = __Pyx_PyObject_IsTrue(py_result);
21377 Py_DECREF(py_result);
21378 return result;
21379 }
21380#endif
21381}
21382
21383/* UnicodeEquals */
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);
21387#else
21388#if PY_MAJOR_VERSION < 3
21389 PyObject* owned_ref = NULL;
21390#endif
21391 int s1_is_unicode, s2_is_unicode;
21392 if (s1 == s2) {
21393 goto return_eq;
21394 }
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))
21401 return -1;
21402 s2 = owned_ref;
21403 s2_is_unicode = 1;
21404 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
21405 owned_ref = PyUnicode_FromObject(s1);
21406 if (unlikely(!owned_ref))
21407 return -1;
21408 s1 = owned_ref;
21409 s1_is_unicode = 1;
21410 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
21411 return __Pyx_PyBytes_Equals(s1, s2, equals);
21412 }
21413#endif
21414 if (s1_is_unicode & s2_is_unicode) {
21415 Py_ssize_t length;
21416 int kind;
21417 void *data1, *data2;
21418 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
21419 return -1;
21420 length = __Pyx_PyUnicode_GET_LENGTH(s1);
21421 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
21422 goto return_ne;
21423 }
21424#if CYTHON_USE_UNICODE_INTERNALS
21425 {
21426 Py_hash_t hash1, hash2;
21427 #if CYTHON_PEP393_ENABLED
21428 hash1 = ((PyASCIIObject*)s1)->hash;
21429 hash2 = ((PyASCIIObject*)s2)->hash;
21430 #else
21431 hash1 = ((PyUnicodeObject*)s1)->hash;
21432 hash2 = ((PyUnicodeObject*)s2)->hash;
21433 #endif
21434 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
21435 goto return_ne;
21436 }
21437 }
21438#endif
21439 kind = __Pyx_PyUnicode_KIND(s1);
21440 if (kind != __Pyx_PyUnicode_KIND(s2)) {
21441 goto return_ne;
21442 }
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)) {
21446 goto return_ne;
21447 } else if (length == 1) {
21448 goto return_eq;
21449 } else {
21450 int result = memcmp(data1, data2, (size_t)(length * kind));
21451 #if PY_MAJOR_VERSION < 3
21452 Py_XDECREF(owned_ref);
21453 #endif
21454 return (equals == Py_EQ) ? (result == 0) : (result != 0);
21455 }
21456 } else if ((s1 == Py_None) & s2_is_unicode) {
21457 goto return_ne;
21458 } else if ((s2 == Py_None) & s1_is_unicode) {
21459 goto return_ne;
21460 } else {
21461 int result;
21462 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
21463 #if PY_MAJOR_VERSION < 3
21464 Py_XDECREF(owned_ref);
21465 #endif
21466 if (!py_result)
21467 return -1;
21468 result = __Pyx_PyObject_IsTrue(py_result);
21469 Py_DECREF(py_result);
21470 return result;
21471 }
21472return_eq:
21473 #if PY_MAJOR_VERSION < 3
21474 Py_XDECREF(owned_ref);
21475 #endif
21476 return (equals == Py_EQ);
21477return_ne:
21478 #if PY_MAJOR_VERSION < 3
21479 Py_XDECREF(owned_ref);
21480 #endif
21481 return (equals == Py_NE);
21482#endif
21483}
21484
21485/* GetAttr */
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)))
21490#else
21491 if (likely(PyString_Check(n)))
21492#endif
21493 return __Pyx_PyObject_GetAttrStr(o, n);
21494#endif
21495 return PyObject_GetAttr(o, n);
21496}
21497
21498/* decode_c_string */
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)) {
21503 Py_ssize_t length;
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");
21509 return NULL;
21510 }
21511 length = (Py_ssize_t) slen;
21512 if (start < 0) {
21513 start += length;
21514 if (start < 0)
21515 start = 0;
21516 }
21517 if (stop < 0)
21518 stop += length;
21519 }
21520 if (unlikely(stop <= start))
21521 return __Pyx_NewRef(__pyx_empty_unicode);
21522 length = stop - start;
21523 cstring += start;
21524 if (decode_func) {
21525 return decode_func(cstring, length, errors);
21526 } else {
21527 return PyUnicode_Decode(cstring, length, encoding, errors);
21528 }
21529}
21530
21531/* GetAttr3 */
21532static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
21533 __Pyx_PyThreadState_declare
21534 __Pyx_PyThreadState_assign
21535 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
21536 return NULL;
21537 __Pyx_PyErr_Clear();
21538 Py_INCREF(d);
21539 return d;
21540}
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);
21544}
21545
21546/* RaiseTooManyValuesToUnpack */
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);
21550}
21551
21552/* RaiseNeedMoreValuesToUnpack */
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");
21557}
21558
21559/* RaiseNoneIterError */
21560static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
21561 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
21562}
21563
21564/* ExtTypeTest */
21565static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
21566 if (unlikely(!type)) {
21567 PyErr_SetString(PyExc_SystemError, "Missing type object");
21568 return 0;
21569 }
21570 if (likely(__Pyx_TypeCheck(obj, type)))
21571 return 1;
21572 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
21573 Py_TYPE(obj)->tp_name, type->tp_name);
21574 return 0;
21575}
21576
21577/* SwapException */
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;
21589 #else
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;
21596 #endif
21597 *type = tmp_type;
21598 *value = tmp_value;
21599 *tb = tmp_tb;
21600}
21601#else
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);
21606 *type = tmp_type;
21607 *value = tmp_value;
21608 *tb = tmp_tb;
21609}
21610#endif
21611
21612/* Import */
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;
21618 PyObject *list;
21619 #if PY_MAJOR_VERSION < 3
21620 PyObject *py_import;
21621 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
21622 if (!py_import)
21623 goto bad;
21624 #endif
21625 if (from_list)
21626 list = from_list;
21627 else {
21628 empty_list = PyList_New(0);
21629 if (!empty_list)
21630 goto bad;
21631 list = empty_list;
21632 }
21633 global_dict = PyModule_GetDict(__pyx_m);
21634 if (!global_dict)
21635 goto bad;
21636 empty_dict = PyDict_New();
21637 if (!empty_dict)
21638 goto bad;
21639 {
21640 #if PY_MAJOR_VERSION >= 3
21641 if (level == -1) {
21642 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
21643 module = PyImport_ImportModuleLevelObject(
21644 name, global_dict, empty_dict, list, 1);
21645 if (!module) {
21646 if (!PyErr_ExceptionMatches(PyExc_ImportError))
21647 goto bad;
21648 PyErr_Clear();
21649 }
21650 }
21651 level = 0;
21652 }
21653 #endif
21654 if (!module) {
21655 #if PY_MAJOR_VERSION < 3
21656 PyObject *py_level = PyInt_FromLong(level);
21657 if (!py_level)
21658 goto bad;
21659 module = PyObject_CallFunctionObjArgs(py_import,
21660 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
21661 Py_DECREF(py_level);
21662 #else
21663 module = PyImport_ImportModuleLevelObject(
21664 name, global_dict, empty_dict, list, level);
21665 #endif
21666 }
21667 }
21668bad:
21669 #if PY_MAJOR_VERSION < 3
21670 Py_XDECREF(py_import);
21671 #endif
21672 Py_XDECREF(empty_list);
21673 Py_XDECREF(empty_dict);
21674 return module;
21675}
21676
21677/* FastTypeChecks */
21678#if CYTHON_COMPILING_IN_CPYTHON
21679static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
21680 while (a) {
21681 a = a->tp_base;
21682 if (a == b)
21683 return 1;
21684 }
21685 return b == &PyBaseObject_Type;
21686}
21687static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
21688 PyObject *mro;
21689 if (a == b) return 1;
21690 mro = a->tp_mro;
21691 if (likely(mro)) {
21692 Py_ssize_t i, n;
21693 n = PyTuple_GET_SIZE(mro);
21694 for (i = 0; i < n; i++) {
21695 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
21696 return 1;
21697 }
21698 return 0;
21699 }
21700 return __Pyx_InBases(a, b);
21701}
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;
21705 int res;
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);
21712 res = 0;
21713 }
21714 if (!res) {
21715 res = PyObject_IsSubclass(err, exc_type2);
21716 if (unlikely(res == -1)) {
21717 PyErr_WriteUnraisable(err);
21718 res = 0;
21719 }
21720 }
21721 __Pyx_ErrRestore(exception, value, tb);
21722 return res;
21723}
21724#else
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;
21727 if (!res) {
21728 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
21729 }
21730 return res;
21731}
21732#endif
21733static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
21734 Py_ssize_t i, n;
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;
21740 }
21741#endif
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;
21746 #endif
21747 if (likely(PyExceptionClass_Check(t))) {
21748 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
21749 } else {
21750 }
21751 }
21752 return 0;
21753}
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);
21761 } else {
21762 }
21763 }
21764 return PyErr_GivenExceptionMatches(err, exc_type);
21765}
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);
21772 }
21773 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
21774}
21775#endif
21776
21777/* ImportFrom */
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));
21784 #else
21785 "cannot import name %S", name);
21786 #endif
21787 }
21788 return value;
21789}
21790
21791/* HasAttr */
21792static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
21793 PyObject *r;
21794 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
21795 PyErr_SetString(PyExc_TypeError,
21796 "hasattr(): attribute name must be string");
21797 return -1;
21798 }
21799 r = __Pyx_GetAttr(o, n);
21800 if (unlikely(!r)) {
21801 PyErr_Clear();
21802 return 0;
21803 } else {
21804 Py_DECREF(r);
21805 return 1;
21806 }
21807}
21808
21809/* PyObject_GenericGetAttrNoDict */
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);
21816#else
21817 "'%.50s' object has no attribute '%.400s'",
21818 tp->tp_name, PyString_AS_STRING(attr_name));
21819#endif
21820 return NULL;
21821}
21822static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
21823 PyObject *descr;
21824 PyTypeObject *tp = Py_TYPE(obj);
21825 if (unlikely(!PyString_Check(attr_name))) {
21826 return PyObject_GenericGetAttr(obj, attr_name);
21827 }
21828 assert(!tp->tp_dictoffset);
21829 descr = _PyType_Lookup(tp, attr_name);
21830 if (unlikely(!descr)) {
21831 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
21832 }
21833 Py_INCREF(descr);
21834 #if PY_MAJOR_VERSION < 3
21835 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
21836 #endif
21837 {
21838 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
21839 if (unlikely(f)) {
21840 PyObject *res = f(descr, obj, (PyObject *)tp);
21841 Py_DECREF(descr);
21842 return res;
21843 }
21844 }
21845 return descr;
21846}
21847#endif
21848
21849/* PyObject_GenericGetAttr */
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);
21854 }
21855 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
21856}
21857#endif
21858
21859/* SetVTable */
21860static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
21861#if PY_VERSION_HEX >= 0x02070000
21862 PyObject *ob = PyCapsule_New(vtable, 0, 0);
21863#else
21864 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
21865#endif
21866 if (!ob)
21867 goto bad;
21868 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
21869 goto bad;
21870 Py_DECREF(ob);
21871 return 0;
21872bad:
21873 Py_XDECREF(ob);
21874 return -1;
21875}
21876
21877/* PyObjectGetAttrStrNoError */
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();
21883}
21884static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
21885 PyObject *result;
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);
21890 }
21891#endif
21892 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
21893 if (unlikely(!result)) {
21894 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
21895 }
21896 return result;
21897}
21898
21899/* SetupReduce */
21900static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
21901 int ret;
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);
21906 } else {
21907 ret = -1;
21908 }
21909 if (unlikely(ret < 0)) {
21910 PyErr_Clear();
21911 ret = 0;
21912 }
21913 Py_XDECREF(name_attr);
21914 return ret;
21915}
21916static int __Pyx_setup_reduce(PyObject* type_obj) {
21917 int ret = 0;
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;
21927#else
21928 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
21929#endif
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;
21932#else
21933 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
21934#endif
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;
21939#else
21940 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
21941#endif
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()) {
21949 goto __PYX_BAD;
21950 }
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()) {
21959 goto __PYX_BAD;
21960 }
21961 }
21962 PyType_Modified((PyTypeObject*)type_obj);
21963 }
21964 }
21965 goto __PYX_GOOD;
21966__PYX_BAD:
21967 if (!PyErr_Occurred())
21968 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
21969 ret = -1;
21970__PYX_GOOD:
21971#if !CYTHON_USE_PYTYPE_LOOKUP
21972 Py_XDECREF(object_reduce);
21973 Py_XDECREF(object_reduce_ex);
21974#endif
21975 Py_XDECREF(reduce);
21976 Py_XDECREF(reduce_ex);
21977 Py_XDECREF(reduce_cython);
21978 Py_XDECREF(setstate);
21979 Py_XDECREF(setstate_cython);
21980 return ret;
21981}
21982
21983/* TypeImport */
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)
21988{
21989 PyObject *result = 0;
21990 char warning[200];
21991 Py_ssize_t basicsize;
21992#ifdef Py_LIMITED_API
21993 PyObject *py_basicsize;
21994#endif
21995 result = PyObject_GetAttrString(module, class_name);
21996 if (!result)
21997 goto bad;
21998 if (!PyType_Check(result)) {
21999 PyErr_Format(PyExc_TypeError,
22000 "%.200s.%.200s is not a type object",
22001 module_name, class_name);
22002 goto bad;
22003 }
22004#ifndef Py_LIMITED_API
22005 basicsize = ((PyTypeObject *)result)->tp_basicsize;
22006#else
22007 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
22008 if (!py_basicsize)
22009 goto bad;
22010 basicsize = PyLong_AsSsize_t(py_basicsize);
22011 Py_DECREF(py_basicsize);
22012 py_basicsize = 0;
22013 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
22014 goto bad;
22015#endif
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);
22021 goto bad;
22022 }
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);
22028 goto bad;
22029 }
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;
22036 }
22037 return (PyTypeObject *)result;
22038bad:
22039 Py_XDECREF(result);
22040 return NULL;
22041}
22042#endif
22043
22044/* CLineInTraceback */
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;
22051#endif
22052 if (unlikely(!__pyx_cython_runtime)) {
22053 return c_line;
22054 }
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))
22062 } else
22063#endif
22064 {
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);
22069 } else {
22070 PyErr_Clear();
22071 use_cline = NULL;
22072 }
22073 }
22074 if (!use_cline) {
22075 c_line = 0;
22076 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
22077 }
22078 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
22079 c_line = 0;
22080 }
22081 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
22082 return c_line;
22083}
22084#endif
22085
22086/* CodeObjectCache */
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) {
22090 return count;
22091 }
22092 while (start < end) {
22093 mid = start + (end - start) / 2;
22094 if (code_line < entries[mid].code_line) {
22095 end = mid;
22096 } else if (code_line > entries[mid].code_line) {
22097 start = mid + 1;
22098 } else {
22099 return mid;
22100 }
22101 }
22102 if (code_line <= entries[mid].code_line) {
22103 return mid;
22104 } else {
22105 return mid + 1;
22106 }
22107}
22108static PyCodeObject *__pyx_find_code_object(int code_line) {
22109 PyCodeObject* code_object;
22110 int pos;
22111 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
22112 return NULL;
22113 }
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)) {
22116 return NULL;
22117 }
22118 code_object = __pyx_code_cache.entries[pos].code_object;
22119 Py_INCREF(code_object);
22120 return code_object;
22121}
22122static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
22123 int pos, i;
22124 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
22125 if (unlikely(!code_line)) {
22126 return;
22127 }
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);
22137 }
22138 return;
22139 }
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;
22144 Py_DECREF(tmp);
22145 return;
22146 }
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)) {
22152 return;
22153 }
22154 __pyx_code_cache.entries = entries;
22155 __pyx_code_cache.max_count = new_max;
22156 }
22157 for (i=__pyx_code_cache.count; i>pos; i--) {
22158 entries[i] = entries[i-1];
22159 }
22160 entries[pos].code_line = code_line;
22161 entries[pos].code_object = code_object;
22162 __pyx_code_cache.count++;
22163 Py_INCREF(code_object);
22164}
22165
22166/* AddTraceback */
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;
22179 #endif
22180 if (c_line) {
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;
22184 #else
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;
22189 #endif
22190 }
22191 else {
22192 #if PY_MAJOR_VERSION < 3
22193 py_funcname = PyString_FromString(funcname);
22194 if (!py_funcname) goto bad;
22195 #endif
22196 }
22197 #if PY_MAJOR_VERSION < 3
22198 py_code = __Pyx_PyCode_New(
22199 0,
22200 0,
22201 0,
22202 0,
22203 0,
22204 __pyx_empty_bytes, /*PyObject *code,*/
22205 __pyx_empty_tuple, /*PyObject *consts,*/
22206 __pyx_empty_tuple, /*PyObject *names,*/
22207 __pyx_empty_tuple, /*PyObject *varnames,*/
22208 __pyx_empty_tuple, /*PyObject *freevars,*/
22209 __pyx_empty_tuple, /*PyObject *cellvars,*/
22210 py_srcfile, /*PyObject *filename,*/
22211 py_funcname, /*PyObject *name,*/
22212 py_line,
22213 __pyx_empty_bytes /*PyObject *lnotab*/
22214 );
22215 Py_DECREF(py_srcfile);
22216 #else
22217 py_code = PyCode_NewEmpty(filename, funcname, py_line);
22218 #endif
22219 Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
22220 return py_code;
22221bad:
22222 Py_XDECREF(py_funcname);
22223 #if PY_MAJOR_VERSION < 3
22224 Py_XDECREF(py_srcfile);
22225 #endif
22226 return NULL;
22227}
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;
22233 if (c_line) {
22234 c_line = __Pyx_CLineForTraceback(tstate, c_line);
22235 }
22236 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
22237 if (!py_code) {
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);
22242 }
22243 py_frame = PyFrame_New(
22244 tstate, /*PyThreadState *tstate,*/
22245 py_code, /*PyCodeObject *code,*/
22246 __pyx_d, /*PyObject *globals,*/
22247 0 /*PyObject *locals*/
22248 );
22249 if (!py_frame) goto bad;
22250 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
22251 PyTraceBack_Here(py_frame);
22252bad:
22253 Py_XDECREF(py_code);
22254 Py_XDECREF(py_frame);
22255}
22256
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);
22263 return -1;
22264}
22265static void __Pyx_ReleaseBuffer(Py_buffer *view) {
22266 PyObject *obj = view->obj;
22267 if (!obj) return;
22268 if (PyObject_CheckBuffer(obj)) {
22269 PyBuffer_Release(view);
22270 return;
22271 }
22272 if ((0)) {}
22273 view->obj = NULL;
22274 Py_DECREF(obj);
22275}
22276#endif
22277
22278
22279/* MemviewSliceIsContig */
22280static int
22281__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
22282{
22283 int i, index, step, start;
22284 Py_ssize_t itemsize = mvs.memview->view.itemsize;
22285 if (order == 'F') {
22286 step = 1;
22287 start = 0;
22288 } else {
22289 step = -1;
22290 start = ndim - 1;
22291 }
22292 for (i = 0; i < ndim; i++) {
22293 index = start + step * i;
22294 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
22295 return 0;
22296 itemsize *= mvs.shape[index];
22297 }
22298 return 1;
22299}
22300
22301/* OverlappingSlices */
22302static void
22303__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
22304 void **out_start, void **out_end,
22305 int ndim, size_t itemsize)
22306{
22307 char *start, *end;
22308 int i;
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];
22313 if (extent == 0) {
22314 *out_start = *out_end = start;
22315 return;
22316 } else {
22317 if (stride > 0)
22318 end += stride * (extent - 1);
22319 else
22320 start += stride * (extent - 1);
22321 }
22322 }
22323 *out_start = start;
22324 *out_end = end + itemsize;
22325}
22326static int
22327__pyx_slices_overlap(__Pyx_memviewslice *slice1,
22328 __Pyx_memviewslice *slice2,
22329 int ndim, size_t itemsize)
22330{
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);
22335}
22336
22337/* Capsule */
22338static CYTHON_INLINE PyObject *
22339__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
22340{
22341 PyObject *cobj;
22342#if PY_VERSION_HEX >= 0x02070000
22343 cobj = PyCapsule_New(p, sig, NULL);
22344#else
22345 cobj = PyCObject_FromVoidPtr(p, NULL);
22346#endif
22347 return cobj;
22348}
22349
22350/* IsLittleEndian */
22351static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
22352{
22353 union {
22354 uint32_t u32;
22355 uint8_t u8[4];
22356 } S;
22357 S.u32 = 0x01020304;
22358 return S.u8[0] == 4;
22359}
22360
22361/* BufferFormatCheck */
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;
22370 ctx->head = stack;
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;
22378 ctx->enc_type = 0;
22379 ctx->is_complex = 0;
22380 ctx->is_valid_array = 0;
22381 ctx->struct_alignment = 0;
22382 while (type->typegroup == 'S') {
22383 ++ctx->head;
22384 ctx->head->field = type->fields;
22385 ctx->head->parent_offset = 0;
22386 type = type->fields->type;
22387 }
22388}
22389static int __Pyx_BufFmt_ParseNumber(const char** ts) {
22390 int count;
22391 const char* t = *ts;
22392 if (*t < '0' || *t > '9') {
22393 return -1;
22394 } else {
22395 count = *t++ - '0';
22396 while (*t >= '0' && *t <= '9') {
22397 count *= 10;
22398 count += *t++ - '0';
22399 }
22400 }
22401 *ts = t;
22402 return count;
22403}
22404static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
22405 int number = __Pyx_BufFmt_ParseNumber(ts);
22406 if (number == -1)
22407 PyErr_Format(PyExc_ValueError,\
22408 "Does not understand character buffer dtype format string ('%c')", **ts);
22409 return number;
22410}
22411static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
22412 PyErr_Format(PyExc_ValueError,
22413 "Unexpected format string character: '%c'", ch);
22414}
22415static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
22416 switch (ch) {
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";
22438 }
22439}
22440static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
22441 switch (ch) {
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);
22448 case 'g': {
22449 PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
22450 return 0;
22451 }
22452 case 'O': case 'P': return sizeof(void*);
22453 default:
22454 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22455 return 0;
22456 }
22457}
22458static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
22459 switch (ch) {
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);
22466 #endif
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*);
22471 default: {
22472 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22473 return 0;
22474 }
22475 }
22476}
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;
22486#endif
22487static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
22488 switch (ch) {
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);
22495#endif
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*);
22500 default:
22501 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22502 return 0;
22503 }
22504}
22505/* These are for computing the padding at the end of the struct to align
22506 on the first member of the struct. This will probably the same as above,
22507 but we don't have any guarantees.
22508 */
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;
22518#endif
22519static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
22520 switch (ch) {
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);
22527#endif
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*);
22532 default:
22533 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22534 return 0;
22535 }
22536}
22537static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
22538 switch (ch) {
22539 case 'c':
22540 return 'H';
22541 case 'b': case 'h': case 'i':
22542 case 'l': case 'q': case 's': case 'p':
22543 return 'I';
22544 case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
22545 return 'U';
22546 case 'f': case 'd': case 'g':
22547 return (is_complex ? 'C' : 'R');
22548 case 'O':
22549 return 'O';
22550 case 'P':
22551 return 'P';
22552 default: {
22553 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
22554 return 0;
22555 }
22556 }
22557}
22558static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
22559 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
22560 const char* expected;
22561 const char* quote;
22562 if (ctx->head == NULL) {
22563 expected = "end";
22564 quote = "";
22565 } else {
22566 expected = ctx->head->field->type->name;
22567 quote = "'";
22568 }
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));
22573 } else {
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);
22580 }
22581}
22582static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
22583 char group;
22584 size_t size, offset, arraysize = 1;
22585 if (ctx->enc_type == 0) return 0;
22586 if (ctx->head->field->type->arraysize[0]) {
22587 int i, ndim = 0;
22588 if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
22589 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
22590 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);
22595 return -1;
22596 }
22597 }
22598 if (!ctx->is_valid_array) {
22599 PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
22600 ctx->head->field->type->ndim, ndim);
22601 return -1;
22602 }
22603 for (i = 0; i < ctx->head->field->type->ndim; i++) {
22604 arraysize *= ctx->head->field->type->arraysize[i];
22605 }
22606 ctx->is_valid_array = 0;
22607 ctx->enc_count = 1;
22608 }
22609 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
22610 do {
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);
22615 } else {
22616 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
22617 }
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,
22626 ctx->is_complex);
22627 }
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;
22631 ++ctx->head;
22632 ctx->head->field = type->fields;
22633 ctx->head->parent_offset = parent_offset;
22634 continue;
22635 }
22636 if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
22637 } else {
22638 __Pyx_BufFmt_RaiseExpected(ctx);
22639 return -1;
22640 }
22641 }
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);
22647 return -1;
22648 }
22649 ctx->fmt_offset += size;
22650 if (arraysize)
22651 ctx->fmt_offset += (arraysize - 1) * size;
22652 --ctx->enc_count;
22653 while (1) {
22654 if (field == &ctx->root) {
22655 ctx->head = NULL;
22656 if (ctx->enc_count != 0) {
22657 __Pyx_BufFmt_RaiseExpected(ctx);
22658 return -1;
22659 }
22660 break;
22661 }
22662 ctx->head->field = ++field;
22663 if (field->type == NULL) {
22664 --ctx->head;
22665 field = ctx->head->field;
22666 continue;
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;
22671 ++ctx->head;
22672 ctx->head->field = field;
22673 ctx->head->parent_offset = parent_offset;
22674 break;
22675 } else {
22676 break;
22677 }
22678 }
22679 } while (ctx->enc_count);
22680 ctx->enc_type = 0;
22681 ctx->is_complex = 0;
22682 return 0;
22683}
22684static PyObject *
22685__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
22686{
22687 const char *ts = *tsp;
22688 int i = 0, number, ndim;
22689 ++ts;
22690 if (ctx->new_count != 1) {
22691 PyErr_SetString(PyExc_ValueError,
22692 "Cannot handle repeated arrays in format string");
22693 return NULL;
22694 }
22695 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22696 ndim = ctx->head->field->type->ndim;
22697 while (*ts && *ts != ')') {
22698 switch (*ts) {
22699 case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
22700 default: break;
22701 }
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++;
22712 i++;
22713 }
22714 if (i != ndim)
22715 return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
22716 ctx->head->field->type->ndim, i);
22717 if (!*ts) {
22718 PyErr_SetString(PyExc_ValueError,
22719 "Unexpected end of format string, expected ')'");
22720 return NULL;
22721 }
22722 ctx->is_valid_array = 1;
22723 ctx->new_count = 1;
22724 *tsp = ++ts;
22725 return Py_None;
22726}
22727static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
22728 int got_Z = 0;
22729 while (1) {
22730 switch(*ts) {
22731 case 0:
22732 if (ctx->enc_type != 0 && ctx->head == NULL) {
22733 __Pyx_BufFmt_RaiseExpected(ctx);
22734 return NULL;
22735 }
22736 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22737 if (ctx->head != NULL) {
22738 __Pyx_BufFmt_RaiseExpected(ctx);
22739 return NULL;
22740 }
22741 return ts;
22742 case ' ':
22743 case '\r':
22744 case '\n':
22745 ++ts;
22746 break;
22747 case '<':
22748 if (!__Pyx_Is_Little_Endian()) {
22749 PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
22750 return NULL;
22751 }
22752 ctx->new_packmode = '=';
22753 ++ts;
22754 break;
22755 case '>':
22756 case '!':
22757 if (__Pyx_Is_Little_Endian()) {
22758 PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
22759 return NULL;
22760 }
22761 ctx->new_packmode = '=';
22762 ++ts;
22763 break;
22764 case '=':
22765 case '@':
22766 case '^':
22767 ctx->new_packmode = *ts++;
22768 break;
22769 case 'T':
22770 {
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;
22775 ++ts;
22776 if (*ts != '{') {
22777 PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
22778 return NULL;
22779 }
22780 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22781 ctx->enc_type = 0;
22782 ctx->enc_count = 0;
22783 ctx->struct_alignment = 0;
22784 ++ts;
22785 ts_after_sub = ts;
22786 for (i = 0; i != struct_count; ++i) {
22787 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
22788 if (!ts_after_sub) return NULL;
22789 }
22790 ts = ts_after_sub;
22791 if (struct_alignment) ctx->struct_alignment = struct_alignment;
22792 }
22793 break;
22794 case '}':
22795 {
22796 size_t alignment = ctx->struct_alignment;
22797 ++ts;
22798 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
22799 ctx->enc_type = 0;
22800 if (alignment && ctx->fmt_offset % alignment) {
22801 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
22802 }
22803 }
22804 return ts;
22805 case 'x':
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;
22810 ctx->enc_type = 0;
22811 ctx->enc_packmode = ctx->new_packmode;
22812 ++ts;
22813 break;
22814 case 'Z':
22815 got_Z = 1;
22816 ++ts;
22817 if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
22818 __Pyx_BufFmt_RaiseUnexpectedChar('Z');
22819 return NULL;
22820 }
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;
22830 got_Z = 0;
22831 ++ts;
22832 break;
22833 }
22834 CYTHON_FALLTHROUGH;
22835 case 's':
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;
22841 ++ts;
22842 ctx->new_count = 1;
22843 got_Z = 0;
22844 break;
22845 case ':':
22846 ++ts;
22847 while(*ts != ':') ++ts;
22848 ++ts;
22849 break;
22850 case '(':
22851 if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
22852 break;
22853 default:
22854 {
22855 int number = __Pyx_BufFmt_ExpectNumber(&ts);
22856 if (number == -1) return NULL;
22857 ctx->new_count = (size_t)number;
22858 }
22859 }
22860 }
22861}
22862
22863/* TypeInfoCompare */
22864 static int
22865__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
22866{
22867 int i;
22868 if (!a || !b)
22869 return 0;
22870 if (a == b)
22871 return 1;
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;
22876 } else {
22877 return 0;
22878 }
22879 }
22880 if (a->ndim) {
22881 for (i = 0; i < a->ndim; i++)
22882 if (a->arraysize[i] != b->arraysize[i])
22883 return 0;
22884 }
22885 if (a->typegroup == 'S') {
22886 if (a->flags != b->flags)
22887 return 0;
22888 if (a->fields || b->fields) {
22889 if (!(a->fields && b->fields))
22890 return 0;
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))
22896 return 0;
22897 }
22898 return !a->fields[i].type && !b->fields[i].type;
22899 }
22900 }
22901 return 1;
22902}
22903
22904/* MemviewSliceValidateAndInit */
22905 static int
22906__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
22907{
22908 if (buf->shape[dim] <= 1)
22909 return 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);
22917 goto fail;
22918 }
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.");
22923 goto fail;
22924 }
22925 }
22926 if (spec & __Pyx_MEMVIEW_FOLLOW) {
22927 Py_ssize_t stride = buf->strides[dim];
22928 if (stride < 0)
22929 stride = -stride;
22930 if (unlikely(stride < buf->itemsize)) {
22931 PyErr_SetString(PyExc_ValueError,
22932 "Buffer and memoryview are not contiguous "
22933 "in the same dimension.");
22934 goto fail;
22935 }
22936 }
22937 } else {
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);
22942 goto fail;
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);
22947 goto fail;
22948 } else if (unlikely(buf->suboffsets)) {
22949 PyErr_SetString(PyExc_ValueError,
22950 "Buffer exposes suboffsets but no strides");
22951 goto fail;
22952 }
22953 }
22954 return 1;
22955fail:
22956 return 0;
22957}
22958static int
22959__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
22960{
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);
22966 goto fail;
22967 }
22968 }
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);
22974 goto fail;
22975 }
22976 }
22977 return 1;
22978fail:
22979 return 0;
22980}
22981static int
22982__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
22983{
22984 int i;
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.");
22991 goto fail;
22992 }
22993 stride = stride * buf->shape[i];
22994 }
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.");
23001 goto fail;
23002 }
23003 stride = stride * buf->shape[i];
23004 }
23005 }
23006 return 1;
23007fail:
23008 return 0;
23009}
23010static int __Pyx_ValidateAndInit_memviewslice(
23011 int *axes_specs,
23012 int c_or_f_flag,
23013 int buf_flags,
23014 int ndim,
23015 __Pyx_TypeInfo *dtype,
23016 __Pyx_BufFmt_StackElem stack[],
23017 __Pyx_memviewslice *memviewslice,
23018 PyObject *original_obj)
23019{
23020 struct __pyx_memoryview_obj *memview, *new_memview;
23021 __Pyx_RefNannyDeclarations
23022 Py_buffer *buf;
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;
23031 } else {
23032 memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
23033 original_obj, buf_flags, 0, dtype);
23034 new_memview = memview;
23035 if (unlikely(!memview))
23036 goto fail;
23037 }
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)",
23042 ndim, buf->ndim);
23043 goto fail;
23044 }
23045 if (new_memview) {
23046 __Pyx_BufFmt_Init(&ctx, stack, dtype);
23047 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
23048 }
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)",
23053 buf->itemsize,
23054 (buf->itemsize > 1) ? "s" : "",
23055 dtype->name,
23056 dtype->size,
23057 (dtype->size > 1) ? "s" : "");
23058 goto fail;
23059 }
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)))
23064 goto fail;
23065 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
23066 goto fail;
23067 }
23068 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
23069 goto fail;
23070 }
23071 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
23072 new_memview != NULL) == -1)) {
23073 goto fail;
23074 }
23075 retval = 0;
23076 goto no_fail;
23077fail:
23078 Py_XDECREF(new_memview);
23079 retval = -1;
23080no_fail:
23081 __Pyx_RefNannyFinishContext();
23082 return retval;
23083}
23084
23085/* ObjectToMemviewSlice */
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) };
23090 int retcode;
23091 if (obj == Py_None) {
23092 result.memview = (struct __pyx_memoryview_obj *) Py_None;
23093 return result;
23094 }
23095 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
23096 PyBUF_RECORDS_RO | writable_flag, 2,
23097 &__Pyx_TypeInfo_float, stack,
23098 &result, obj);
23099 if (unlikely(retcode == -1))
23100 goto __pyx_fail;
23101 return result;
23102__pyx_fail:
23103 result.memview = NULL;
23104 result.data = NULL;
23105 return result;
23106}
23107
23108/* ObjectToMemviewSlice */
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) };
23113 int retcode;
23114 if (obj == Py_None) {
23115 result.memview = (struct __pyx_memoryview_obj *) Py_None;
23116 return result;
23117 }
23118 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
23119 PyBUF_RECORDS_RO | writable_flag, 1,
23120 &__Pyx_TypeInfo_long, stack,
23121 &result, obj);
23122 if (unlikely(retcode == -1))
23123 goto __pyx_fail;
23124 return result;
23125__pyx_fail:
23126 result.memview = NULL;
23127 result.data = NULL;
23128 return result;
23129}
23130
23131/* Declarations */
23132 #if CYTHON_CCOMPLEX
23133 #ifdef __cplusplus
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);
23136 }
23137 #else
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;
23140 }
23141 #endif
23142#else
23143 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
23144 __pyx_t_float_complex z;
23145 z.real = x;
23146 z.imag = y;
23147 return z;
23148 }
23149#endif
23150
23151/* Arithmetic */
23152 #if CYTHON_CCOMPLEX
23153#else
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);
23156 }
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;
23161 return z;
23162 }
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;
23167 return z;
23168 }
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;
23173 return z;
23174 }
23175 #if 1
23176 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
23177 if (b.imag == 0) {
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);
23182 } else {
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);
23187 }
23188 } else {
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);
23193 }
23194 }
23195 #else
23196 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
23197 if (b.imag == 0) {
23198 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
23199 } else {
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);
23204 }
23205 }
23206 #endif
23207 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
23208 __pyx_t_float_complex z;
23209 z.real = -a.real;
23210 z.imag = -a.imag;
23211 return z;
23212 }
23213 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
23214 return (a.real == 0) && (a.imag == 0);
23215 }
23216 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
23217 __pyx_t_float_complex z;
23218 z.real = a.real;
23219 z.imag = -a.imag;
23220 return z;
23221 }
23222 #if 1
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);
23226 #else
23227 return hypotf(z.real, z.imag);
23228 #endif
23229 }
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) {
23234 if (b.real < 0) {
23235 float denom = a.real * a.real + a.imag * a.imag;
23236 a.real = a.real / denom;
23237 a.imag = -a.imag / denom;
23238 b.real = -b.real;
23239 }
23240 switch ((int)b.real) {
23241 case 0:
23242 z.real = 1;
23243 z.imag = 0;
23244 return z;
23245 case 1:
23246 return a;
23247 case 2:
23248 return __Pyx_c_prod_float(a, a);
23249 case 3:
23250 z = __Pyx_c_prod_float(a, a);
23251 return __Pyx_c_prod_float(z, a);
23252 case 4:
23253 z = __Pyx_c_prod_float(a, a);
23254 return __Pyx_c_prod_float(z, z);
23255 }
23256 }
23257 if (a.imag == 0) {
23258 if (a.real == 0) {
23259 return a;
23260 } else if (b.imag == 0) {
23261 z.real = powf(a.real, b.real);
23262 z.imag = 0;
23263 return z;
23264 } else if (a.real > 0) {
23265 r = a.real;
23266 theta = 0;
23267 } else {
23268 r = -a.real;
23269 theta = atan2f(0.0, -1.0);
23270 }
23271 } else {
23272 r = __Pyx_c_abs_float(a);
23273 theta = atan2f(a.imag, a.real);
23274 }
23275 lnr = logf(r);
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);
23280 return z;
23281 }
23282 #endif
23283#endif
23284
23285/* Declarations */
23286 #if CYTHON_CCOMPLEX
23287 #ifdef __cplusplus
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);
23290 }
23291 #else
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;
23294 }
23295 #endif
23296#else
23297 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
23298 __pyx_t_double_complex z;
23299 z.real = x;
23300 z.imag = y;
23301 return z;
23302 }
23303#endif
23304
23305/* Arithmetic */
23306 #if CYTHON_CCOMPLEX
23307#else
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);
23310 }
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;
23315 return z;
23316 }
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;
23321 return z;
23322 }
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;
23327 return z;
23328 }
23329 #if 1
23330 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
23331 if (b.imag == 0) {
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);
23336 } else {
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);
23341 }
23342 } else {
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);
23347 }
23348 }
23349 #else
23350 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
23351 if (b.imag == 0) {
23352 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
23353 } else {
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);
23358 }
23359 }
23360 #endif
23361 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
23362 __pyx_t_double_complex z;
23363 z.real = -a.real;
23364 z.imag = -a.imag;
23365 return z;
23366 }
23367 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
23368 return (a.real == 0) && (a.imag == 0);
23369 }
23370 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
23371 __pyx_t_double_complex z;
23372 z.real = a.real;
23373 z.imag = -a.imag;
23374 return z;
23375 }
23376 #if 1
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);
23380 #else
23381 return hypot(z.real, z.imag);
23382 #endif
23383 }
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) {
23388 if (b.real < 0) {
23389 double denom = a.real * a.real + a.imag * a.imag;
23390 a.real = a.real / denom;
23391 a.imag = -a.imag / denom;
23392 b.real = -b.real;
23393 }
23394 switch ((int)b.real) {
23395 case 0:
23396 z.real = 1;
23397 z.imag = 0;
23398 return z;
23399 case 1:
23400 return a;
23401 case 2:
23402 return __Pyx_c_prod_double(a, a);
23403 case 3:
23404 z = __Pyx_c_prod_double(a, a);
23405 return __Pyx_c_prod_double(z, a);
23406 case 4:
23407 z = __Pyx_c_prod_double(a, a);
23408 return __Pyx_c_prod_double(z, z);
23409 }
23410 }
23411 if (a.imag == 0) {
23412 if (a.real == 0) {
23413 return a;
23414 } else if (b.imag == 0) {
23415 z.real = pow(a.real, b.real);
23416 z.imag = 0;
23417 return z;
23418 } else if (a.real > 0) {
23419 r = a.real;
23420 theta = 0;
23421 } else {
23422 r = -a.real;
23423 theta = atan2(0.0, -1.0);
23424 }
23425 } else {
23426 r = __Pyx_c_abs_double(a);
23427 theta = atan2(a.imag, a.real);
23428 }
23429 lnr = log(r);
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);
23434 return z;
23435 }
23436 #endif
23437#endif
23438
23439/* MemviewDtypeToObject */
23440 static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp) {
23441 return (PyObject *) PyFloat_FromDouble(*(float *) itemp);
23442}
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())
23446 return 0;
23447 *(float *) itemp = value;
23448 return 1;
23449}
23450
23451/* CIntFromPyVerify */
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)\
23457 {\
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;\
23466 else\
23467 goto raise_overflow;\
23468 }\
23469 }\
23470 return (target_type) value;\
23471 }
23472
23473/* MemviewDtypeToObject */
23474 static CYTHON_INLINE PyObject *__pyx_memview_get_long(const char *itemp) {
23475 return (PyObject *) __Pyx_PyInt_From_long(*(long *) itemp);
23476}
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())
23480 return 0;
23481 *(long *) itemp = value;
23482 return 1;
23483}
23484
23485/* ObjectToMemviewSlice */
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) };
23490 int retcode;
23491 if (obj == Py_None) {
23492 result.memview = (struct __pyx_memoryview_obj *) Py_None;
23493 return result;
23494 }
23495 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
23496 PyBUF_RECORDS_RO | writable_flag, 2,
23497 &__Pyx_TypeInfo_long, stack,
23498 &result, obj);
23499 if (unlikely(retcode == -1))
23500 goto __pyx_fail;
23501 return result;
23502__pyx_fail:
23503 result.memview = NULL;
23504 result.data = NULL;
23505 return result;
23506}
23507
23508/* ObjectToMemviewSlice */
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) };
23513 int retcode;
23514 if (obj == Py_None) {
23515 result.memview = (struct __pyx_memoryview_obj *) Py_None;
23516 return result;
23517 }
23518 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
23519 PyBUF_RECORDS_RO | writable_flag, 1,
23520 &__Pyx_TypeInfo_float, stack,
23521 &result, obj);
23522 if (unlikely(retcode == -1))
23523 goto __pyx_fail;
23524 return result;
23525__pyx_fail:
23526 result.memview = NULL;
23527 result.data = NULL;
23528 return result;
23529}
23530
23531/* MemviewSliceCopyTemplate */
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)
23537{
23538 __Pyx_RefNannyDeclarations
23539 int i;
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);
23552 goto fail;
23553 }
23554 }
23555 shape_tuple = PyTuple_New(ndim);
23556 if (unlikely(!shape_tuple)) {
23557 goto fail;
23558 }
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)) {
23563 goto fail;
23564 } else {
23565 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
23566 temp_int = NULL;
23567 }
23568 }
23569 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
23570 if (unlikely(!array_obj)) {
23571 goto fail;
23572 }
23573 __Pyx_GOTREF(array_obj);
23574 memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
23575 (PyObject *) array_obj, contig_flag,
23576 dtype_is_object,
23577 from_mvs->memview->typeinfo);
23578 if (unlikely(!memview_obj))
23579 goto fail;
23580 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
23581 goto fail;
23582 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
23583 dtype_is_object) < 0))
23584 goto fail;
23585 goto no_fail;
23586fail:
23587 __Pyx_XDECREF(new_mvs.memview);
23588 new_mvs.memview = NULL;
23589 new_mvs.data = NULL;
23590no_fail:
23591 __Pyx_XDECREF(shape_tuple);
23592 __Pyx_XDECREF(temp_int);
23593 __Pyx_XDECREF(array_obj);
23594 __Pyx_RefNannyFinishContext();
23595 return new_mvs;
23596}
23597
23598/* CIntToPy */
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"
23603#endif
23604 const long neg_one = (long) -1, const_zero = (long) 0;
23605#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23606#pragma GCC diagnostic pop
23607#endif
23608 const int is_unsigned = neg_one > const_zero;
23609 if (is_unsigned) {
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);
23617#endif
23618 }
23619 } else {
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);
23625#endif
23626 }
23627 }
23628 {
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);
23633 }
23634}
23635
23636/* CIntFromPy */
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"
23641#endif
23642 const long neg_one = (long) -1, const_zero = (long) 0;
23643#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23644#pragma GCC diagnostic pop
23645#endif
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))
23651 } else {
23652 long val = PyInt_AS_LONG(x);
23653 if (is_unsigned && unlikely(val < 0)) {
23654 goto raise_neg_overflow;
23655 }
23656 return (long) val;
23657 }
23658 } else
23659#endif
23660 if (likely(PyLong_Check(x))) {
23661 if (is_unsigned) {
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])
23667 case 2:
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]));
23673 }
23674 }
23675 break;
23676 case 3:
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]));
23682 }
23683 }
23684 break;
23685 case 4:
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]));
23691 }
23692 }
23693 break;
23694 }
23695#endif
23696#if CYTHON_COMPILING_IN_CPYTHON
23697 if (unlikely(Py_SIZE(x) < 0)) {
23698 goto raise_neg_overflow;
23699 }
23700#else
23701 {
23702 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
23703 if (unlikely(result < 0))
23704 return (long) -1;
23705 if (unlikely(result == 1))
23706 goto raise_neg_overflow;
23707 }
23708#endif
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))
23714#endif
23715 }
23716 } else {
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])
23723 case -2:
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])));
23729 }
23730 }
23731 break;
23732 case 2:
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])));
23738 }
23739 }
23740 break;
23741 case -3:
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])));
23747 }
23748 }
23749 break;
23750 case 3:
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])));
23756 }
23757 }
23758 break;
23759 case -4:
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])));
23765 }
23766 }
23767 break;
23768 case 4:
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])));
23774 }
23775 }
23776 break;
23777 }
23778#endif
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))
23784#endif
23785 }
23786 }
23787 {
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");
23791#else
23792 long val;
23793 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
23794 #if PY_MAJOR_VERSION < 3
23795 if (likely(v) && !PyLong_Check(v)) {
23796 PyObject *tmp = v;
23797 v = PyNumber_Long(tmp);
23798 Py_DECREF(tmp);
23799 }
23800 #endif
23801 if (likely(v)) {
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);
23807 Py_DECREF(v);
23808 if (likely(!ret))
23809 return val;
23810 }
23811#endif
23812 return (long) -1;
23813 }
23814 } else {
23815 long val;
23816 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
23817 if (!tmp) return (long) -1;
23818 val = __Pyx_PyInt_As_long(tmp);
23819 Py_DECREF(tmp);
23820 return val;
23821 }
23822raise_overflow:
23823 PyErr_SetString(PyExc_OverflowError,
23824 "value too large to convert to long");
23825 return (long) -1;
23826raise_neg_overflow:
23827 PyErr_SetString(PyExc_OverflowError,
23828 "can't convert negative value to long");
23829 return (long) -1;
23830}
23831
23832/* CIntFromPy */
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"
23837#endif
23838 const int neg_one = (int) -1, const_zero = (int) 0;
23839#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
23840#pragma GCC diagnostic pop
23841#endif
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))
23847 } else {
23848 long val = PyInt_AS_LONG(x);
23849 if (is_unsigned && unlikely(val < 0)) {
23850 goto raise_neg_overflow;
23851 }
23852 return (int) val;
23853 }
23854 } else
23855#endif
23856 if (likely(PyLong_Check(x))) {
23857 if (is_unsigned) {
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])
23863 case 2:
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]));
23869 }
23870 }
23871 break;
23872 case 3:
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]));
23878 }
23879 }
23880 break;
23881 case 4:
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]));
23887 }
23888 }
23889 break;
23890 }
23891#endif
23892#if CYTHON_COMPILING_IN_CPYTHON
23893 if (unlikely(Py_SIZE(x) < 0)) {
23894 goto raise_neg_overflow;
23895 }
23896#else
23897 {
23898 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
23899 if (unlikely(result < 0))
23900 return (int) -1;
23901 if (unlikely(result == 1))
23902 goto raise_neg_overflow;
23903 }
23904#endif
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))
23910#endif
23911 }
23912 } else {
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])
23919 case -2:
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])));
23925 }
23926 }
23927 break;
23928 case 2:
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])));
23934 }
23935 }
23936 break;
23937 case -3:
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])));
23943 }
23944 }
23945 break;
23946 case 3:
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])));
23952 }
23953 }
23954 break;
23955 case -4:
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])));
23961 }
23962 }
23963 break;
23964 case 4:
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])));
23970 }
23971 }
23972 break;
23973 }
23974#endif
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))
23980#endif
23981 }
23982 }
23983 {
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");
23987#else
23988 int val;
23989 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
23990 #if PY_MAJOR_VERSION < 3
23991 if (likely(v) && !PyLong_Check(v)) {
23992 PyObject *tmp = v;
23993 v = PyNumber_Long(tmp);
23994 Py_DECREF(tmp);
23995 }
23996 #endif
23997 if (likely(v)) {
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);
24003 Py_DECREF(v);
24004 if (likely(!ret))
24005 return val;
24006 }
24007#endif
24008 return (int) -1;
24009 }
24010 } else {
24011 int val;
24012 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
24013 if (!tmp) return (int) -1;
24014 val = __Pyx_PyInt_As_int(tmp);
24015 Py_DECREF(tmp);
24016 return val;
24017 }
24018raise_overflow:
24019 PyErr_SetString(PyExc_OverflowError,
24020 "value too large to convert to int");
24021 return (int) -1;
24022raise_neg_overflow:
24023 PyErr_SetString(PyExc_OverflowError,
24024 "can't convert negative value to int");
24025 return (int) -1;
24026}
24027
24028/* CIntToPy */
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"
24033#endif
24034 const int neg_one = (int) -1, const_zero = (int) 0;
24035#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24036#pragma GCC diagnostic pop
24037#endif
24038 const int is_unsigned = neg_one > const_zero;
24039 if (is_unsigned) {
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);
24047#endif
24048 }
24049 } else {
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);
24055#endif
24056 }
24057 }
24058 {
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);
24063 }
24064}
24065
24066/* CIntFromPy */
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"
24071#endif
24072 const char neg_one = (char) -1, const_zero = (char) 0;
24073#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
24074#pragma GCC diagnostic pop
24075#endif
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))
24081 } else {
24082 long val = PyInt_AS_LONG(x);
24083 if (is_unsigned && unlikely(val < 0)) {
24084 goto raise_neg_overflow;
24085 }
24086 return (char) val;
24087 }
24088 } else
24089#endif
24090 if (likely(PyLong_Check(x))) {
24091 if (is_unsigned) {
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])
24097 case 2:
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]));
24103 }
24104 }
24105 break;
24106 case 3:
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]));
24112 }
24113 }
24114 break;
24115 case 4:
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]));
24121 }
24122 }
24123 break;
24124 }
24125#endif
24126#if CYTHON_COMPILING_IN_CPYTHON
24127 if (unlikely(Py_SIZE(x) < 0)) {
24128 goto raise_neg_overflow;
24129 }
24130#else
24131 {
24132 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
24133 if (unlikely(result < 0))
24134 return (char) -1;
24135 if (unlikely(result == 1))
24136 goto raise_neg_overflow;
24137 }
24138#endif
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))
24144#endif
24145 }
24146 } else {
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])
24153 case -2:
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])));
24159 }
24160 }
24161 break;
24162 case 2:
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])));
24168 }
24169 }
24170 break;
24171 case -3:
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])));
24177 }
24178 }
24179 break;
24180 case 3:
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])));
24186 }
24187 }
24188 break;
24189 case -4:
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])));
24195 }
24196 }
24197 break;
24198 case 4:
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])));
24204 }
24205 }
24206 break;
24207 }
24208#endif
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))
24214#endif
24215 }
24216 }
24217 {
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");
24221#else
24222 char val;
24223 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
24224 #if PY_MAJOR_VERSION < 3
24225 if (likely(v) && !PyLong_Check(v)) {
24226 PyObject *tmp = v;
24227 v = PyNumber_Long(tmp);
24228 Py_DECREF(tmp);
24229 }
24230 #endif
24231 if (likely(v)) {
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);
24237 Py_DECREF(v);
24238 if (likely(!ret))
24239 return val;
24240 }
24241#endif
24242 return (char) -1;
24243 }
24244 } else {
24245 char val;
24246 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
24247 if (!tmp) return (char) -1;
24248 val = __Pyx_PyInt_As_char(tmp);
24249 Py_DECREF(tmp);
24250 return val;
24251 }
24252raise_overflow:
24253 PyErr_SetString(PyExc_OverflowError,
24254 "value too large to convert to char");
24255 return (char) -1;
24256raise_neg_overflow:
24257 PyErr_SetString(PyExc_OverflowError,
24258 "can't convert negative value to char");
24259 return (char) -1;
24260}
24261
24262/* CheckBinaryVersion */
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]) {
24268 char message[200];
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);
24274 }
24275 return 0;
24276}
24277
24278/* InitStrings */
24279 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
24280 while (t->p) {
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);
24286 } else {
24287 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
24288 }
24289 #else
24290 if (t->is_unicode | t->is_str) {
24291 if (t->intern) {
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);
24295 } else {
24296 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
24297 }
24298 } else {
24299 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
24300 }
24301 #endif
24302 if (!*t->p)
24303 return -1;
24304 if (PyObject_Hash(*t->p) == -1)
24305 return -1;
24306 ++t;
24307 }
24308 return 0;
24309}
24310
24311static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
24312 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
24313}
24314static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
24315 Py_ssize_t ignore;
24316 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
24317}
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) {
24321 char* defenc_c;
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
24326 {
24327 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
24328 char* c;
24329 for (c = defenc_c; c < end; c++) {
24330 if ((unsigned char) (*c) >= 128) {
24331 PyUnicode_AsASCIIString(o);
24332 return NULL;
24333 }
24334 }
24335 }
24336#endif
24337 *length = PyBytes_GET_SIZE(defenc);
24338 return defenc_c;
24339}
24340#else
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);
24347 } else {
24348 PyUnicode_AsASCIIString(o);
24349 return NULL;
24350 }
24351#else
24352 return PyUnicode_AsUTF8AndSize(o, length);
24353#endif
24354}
24355#endif
24356#endif
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
24359 if (
24360#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
24361 __Pyx_sys_getdefaultencoding_not_ascii &&
24362#endif
24363 PyUnicode_Check(o)) {
24364 return __Pyx_PyUnicode_AsStringAndSize(o, length);
24365 } else
24366#endif
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);
24371 } else
24372#endif
24373 {
24374 char* result;
24375 int r = PyBytes_AsStringAndSize(o, &result, length);
24376 if (unlikely(r < 0)) {
24377 return NULL;
24378 } else {
24379 return result;
24380 }
24381 }
24382}
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);
24387}
24388static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
24389 int retval;
24390 if (unlikely(!x)) return -1;
24391 retval = __Pyx_PyObject_IsTrue(x);
24392 Py_DECREF(x);
24393 return retval;
24394}
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)) {
24403 Py_DECREF(result);
24404 return NULL;
24405 }
24406 return result;
24407 }
24408#endif
24409 PyErr_Format(PyExc_TypeError,
24410 "__%.4s__ returned non-%.4s (type %.200s)",
24411 type_name, type_name, Py_TYPE(result)->tp_name);
24412 Py_DECREF(result);
24413 return NULL;
24414}
24415static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
24416#if CYTHON_USE_TYPE_SLOTS
24417 PyNumberMethods *m;
24418#endif
24419 const char *name = NULL;
24420 PyObject *res = NULL;
24421#if PY_MAJOR_VERSION < 3
24422 if (likely(PyInt_Check(x) || PyLong_Check(x)))
24423#else
24424 if (likely(PyLong_Check(x)))
24425#endif
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) {
24431 name = "int";
24432 res = m->nb_int(x);
24433 }
24434 else if (m && m->nb_long) {
24435 name = "long";
24436 res = m->nb_long(x);
24437 }
24438 #else
24439 if (likely(m && m->nb_int)) {
24440 name = "int";
24441 res = m->nb_int(x);
24442 }
24443 #endif
24444#else
24445 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
24446 res = PyNumber_Int(x);
24447 }
24448#endif
24449 if (likely(res)) {
24450#if PY_MAJOR_VERSION < 3
24451 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
24452#else
24453 if (unlikely(!PyLong_CheckExact(res))) {
24454#endif
24455 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
24456 }
24457 }
24458 else if (!PyErr_Occurred()) {
24459 PyErr_SetString(PyExc_TypeError,
24460 "an integer is required");
24461 }
24462 return res;
24463}
24464static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
24465 Py_ssize_t ival;
24466 PyObject *x;
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);
24471 else
24472 return PyInt_AsSsize_t(b);
24473 }
24474#endif
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;
24482 return ival;
24483 } else {
24484 switch (size) {
24485 case 2:
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]));
24488 }
24489 break;
24490 case -2:
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]));
24493 }
24494 break;
24495 case 3:
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]));
24498 }
24499 break;
24500 case -3:
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]));
24503 }
24504 break;
24505 case 4:
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]));
24508 }
24509 break;
24510 case -4:
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]));
24513 }
24514 break;
24515 }
24516 }
24517 #endif
24518 return PyLong_AsSsize_t(b);
24519 }
24520 x = PyNumber_Index(b);
24521 if (!x) return -1;
24522 ival = PyInt_AsSsize_t(x);
24523 Py_DECREF(x);
24524 return ival;
24525}
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);
24532#endif
24533 } else {
24534 Py_ssize_t ival;
24535 PyObject *x;
24536 x = PyNumber_Index(o);
24537 if (!x) return -1;
24538 ival = PyInt_AsLong(x);
24539 Py_DECREF(x);
24540 return ival;
24541 }
24542}
24543static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
24544 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
24545}
24546static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
24547 return PyInt_FromSize_t(ival);
24548}
24549
24550
24551#endif /* Py_PYTHON_H */