Safemotion Lib
Loading...
Searching...
No Matches
rank_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": "rank_cy",
17 "sources": [
18 "rank_cy.pyx"
19 ]
20 },
21 "module_name": "rank_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__rank_cy
705#define __PYX_HAVE_API__rank_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 "rank_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;
1319struct __pyx_opt_args_7rank_cy_evaluate_cy;
1320
1321/* "rank_cy.pyx":21
1322 *
1323 * # Main interface
1324 * cpdef evaluate_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_metric_cuhk03=False, # <<<<<<<<<<<<<<
1325 * use_distmat=False):
1326 * distmat = np.asarray(distmat, dtype=np.float32)
1327 */
1328struct __pyx_opt_args_7rank_cy_evaluate_cy {
1329 int __pyx_n;
1330 PyObject *use_metric_cuhk03;
1331 PyObject *use_distmat;
1332};
1333
1334/* "View.MemoryView":105
1335 *
1336 * @cname("__pyx_array")
1337 * cdef class array: # <<<<<<<<<<<<<<
1338 *
1339 * cdef:
1340 */
1341struct __pyx_array_obj {
1342 PyObject_HEAD
1343 struct __pyx_vtabstruct_array *__pyx_vtab;
1344 char *data;
1345 Py_ssize_t len;
1346 char *format;
1347 int ndim;
1348 Py_ssize_t *_shape;
1349 Py_ssize_t *_strides;
1350 Py_ssize_t itemsize;
1351 PyObject *mode;
1352 PyObject *_format;
1353 void (*callback_free_data)(void *);
1354 int free_data;
1355 int dtype_is_object;
1356};
1357
1358
1359/* "View.MemoryView":279
1360 *
1361 * @cname('__pyx_MemviewEnum')
1362 * cdef class Enum(object): # <<<<<<<<<<<<<<
1363 * cdef object name
1364 * def __init__(self, name):
1365 */
1366struct __pyx_MemviewEnum_obj {
1367 PyObject_HEAD
1368 PyObject *name;
1369};
1370
1371
1372/* "View.MemoryView":330
1373 *
1374 * @cname('__pyx_memoryview')
1375 * cdef class memoryview(object): # <<<<<<<<<<<<<<
1376 *
1377 * cdef object obj
1378 */
1379struct __pyx_memoryview_obj {
1380 PyObject_HEAD
1381 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1382 PyObject *obj;
1383 PyObject *_size;
1384 PyObject *_array_interface;
1385 PyThread_type_lock lock;
1386 __pyx_atomic_int acquisition_count[2];
1387 __pyx_atomic_int *acquisition_count_aligned_p;
1388 Py_buffer view;
1389 int flags;
1390 int dtype_is_object;
1391 __Pyx_TypeInfo *typeinfo;
1392};
1393
1394
1395/* "View.MemoryView":965
1396 *
1397 * @cname('__pyx_memoryviewslice')
1398 * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1399 * "Internal class for passing memoryview slices to Python"
1400 *
1401 */
1402struct __pyx_memoryviewslice_obj {
1403 struct __pyx_memoryview_obj __pyx_base;
1404 __Pyx_memviewslice from_slice;
1405 PyObject *from_object;
1406 PyObject *(*to_object_func)(char *);
1407 int (*to_dtype_func)(char *, PyObject *);
1408};
1409
1410
1411
1412/* "View.MemoryView":105
1413 *
1414 * @cname("__pyx_array")
1415 * cdef class array: # <<<<<<<<<<<<<<
1416 *
1417 * cdef:
1418 */
1419
1420struct __pyx_vtabstruct_array {
1421 PyObject *(*get_memview)(struct __pyx_array_obj *);
1422};
1423static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1424
1425
1426/* "View.MemoryView":330
1427 *
1428 * @cname('__pyx_memoryview')
1429 * cdef class memoryview(object): # <<<<<<<<<<<<<<
1430 *
1431 * cdef object obj
1432 */
1433
1434struct __pyx_vtabstruct_memoryview {
1435 char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1436 PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1437 PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1438 PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1439 PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1440 PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1441 PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1442};
1443static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1444
1445
1446/* "View.MemoryView":965
1447 *
1448 * @cname('__pyx_memoryviewslice')
1449 * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1450 * "Internal class for passing memoryview slices to Python"
1451 *
1452 */
1453
1454struct __pyx_vtabstruct__memoryviewslice {
1455 struct __pyx_vtabstruct_memoryview __pyx_base;
1456};
1457static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1458
1459/* --- Runtime support code (head) --- */
1460/* Refnanny.proto */
1461#ifndef CYTHON_REFNANNY
1462 #define CYTHON_REFNANNY 0
1463#endif
1464#if CYTHON_REFNANNY
1465 typedef struct {
1466 void (*INCREF)(void*, PyObject*, int);
1467 void (*DECREF)(void*, PyObject*, int);
1468 void (*GOTREF)(void*, PyObject*, int);
1469 void (*GIVEREF)(void*, PyObject*, int);
1470 void* (*SetupContext)(const char*, int, const char*);
1471 void (*FinishContext)(void**);
1472 } __Pyx_RefNannyAPIStruct;
1473 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1474 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1475 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1476#ifdef WITH_THREAD
1477 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1478 if (acquire_gil) {\
1479 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1480 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1481 PyGILState_Release(__pyx_gilstate_save);\
1482 } else {\
1483 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1484 }
1485#else
1486 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1487 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1488#endif
1489 #define __Pyx_RefNannyFinishContext()\
1490 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1491 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1492 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1493 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1494 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1495 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1496 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1497 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1498 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1499#else
1500 #define __Pyx_RefNannyDeclarations
1501 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1502 #define __Pyx_RefNannyFinishContext()
1503 #define __Pyx_INCREF(r) Py_INCREF(r)
1504 #define __Pyx_DECREF(r) Py_DECREF(r)
1505 #define __Pyx_GOTREF(r)
1506 #define __Pyx_GIVEREF(r)
1507 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1508 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1509 #define __Pyx_XGOTREF(r)
1510 #define __Pyx_XGIVEREF(r)
1511#endif
1512#define __Pyx_XDECREF_SET(r, v) do {\
1513 PyObject *tmp = (PyObject *) r;\
1514 r = v; __Pyx_XDECREF(tmp);\
1515 } while (0)
1516#define __Pyx_DECREF_SET(r, v) do {\
1517 PyObject *tmp = (PyObject *) r;\
1518 r = v; __Pyx_DECREF(tmp);\
1519 } while (0)
1520#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1521#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1522
1523/* PyObjectGetAttrStr.proto */
1524#if CYTHON_USE_TYPE_SLOTS
1525static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1526#else
1527#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1528#endif
1529
1530/* GetBuiltinName.proto */
1531static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1532
1533/* PyDictVersioning.proto */
1534#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1535#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1536#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1537#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1538 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1539 (cache_var) = (value);
1540#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1541 static PY_UINT64_T __pyx_dict_version = 0;\
1542 static PyObject *__pyx_dict_cached_value = NULL;\
1543 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1544 (VAR) = __pyx_dict_cached_value;\
1545 } else {\
1546 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1547 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1548 }\
1549}
1550static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1551static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1552static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1553#else
1554#define __PYX_GET_DICT_VERSION(dict) (0)
1555#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1556#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1557#endif
1558
1559/* GetModuleGlobalName.proto */
1560#if CYTHON_USE_DICT_VERSIONS
1561#define __Pyx_GetModuleGlobalName(var, name) {\
1562 static PY_UINT64_T __pyx_dict_version = 0;\
1563 static PyObject *__pyx_dict_cached_value = NULL;\
1564 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1565 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1566 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1567}
1568#define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1569 PY_UINT64_T __pyx_dict_version;\
1570 PyObject *__pyx_dict_cached_value;\
1571 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1572}
1573static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1574#else
1575#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1576#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1577static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1578#endif
1579
1580/* PyObjectCall.proto */
1581#if CYTHON_COMPILING_IN_CPYTHON
1582static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1583#else
1584#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1585#endif
1586
1587/* MemviewSliceInit.proto */
1588#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1589#define __Pyx_MEMVIEW_DIRECT 1
1590#define __Pyx_MEMVIEW_PTR 2
1591#define __Pyx_MEMVIEW_FULL 4
1592#define __Pyx_MEMVIEW_CONTIG 8
1593#define __Pyx_MEMVIEW_STRIDED 16
1594#define __Pyx_MEMVIEW_FOLLOW 32
1595#define __Pyx_IS_C_CONTIG 1
1596#define __Pyx_IS_F_CONTIG 2
1597static int __Pyx_init_memviewslice(
1598 struct __pyx_memoryview_obj *memview,
1599 int ndim,
1600 __Pyx_memviewslice *memviewslice,
1601 int memview_is_new_reference);
1602static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1603 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1604static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1605 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1606#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1607#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1608#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1609#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1610static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1611static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1612
1613/* RaiseArgTupleInvalid.proto */
1614static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1615 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1616
1617/* RaiseDoubleKeywords.proto */
1618static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1619
1620/* ParseKeywords.proto */
1621static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1622 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1623 const char* function_name);
1624
1625/* PyCFunctionFastCall.proto */
1626#if CYTHON_FAST_PYCCALL
1627static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1628#else
1629#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1630#endif
1631
1632/* PyFunctionFastCall.proto */
1633#if CYTHON_FAST_PYCALL
1634#define __Pyx_PyFunction_FastCall(func, args, nargs)\
1635 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1636#if 1 || PY_VERSION_HEX < 0x030600B1
1637static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1638#else
1639#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1640#endif
1641#define __Pyx_BUILD_ASSERT_EXPR(cond)\
1642 (sizeof(char [1 - 2*!(cond)]) - 1)
1643#ifndef Py_MEMBER_SIZE
1644#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1645#endif
1646#if CYTHON_FAST_PYCALL
1647 static size_t __pyx_pyframe_localsplus_offset = 0;
1648 #include "frameobject.h"
1649 #define __Pxy_PyFrame_Initialize_Offsets()\
1650 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1651 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1652 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1653 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1654#endif // CYTHON_FAST_PYCALL
1655#endif
1656
1657/* PyObjectCall2Args.proto */
1658static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1659
1660/* PyObjectCallMethO.proto */
1661#if CYTHON_COMPILING_IN_CPYTHON
1662static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1663#endif
1664
1665/* PyObjectCallOneArg.proto */
1666static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1667
1668/* GetItemInt.proto */
1669#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1670 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1671 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1672 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1673 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1674#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1675 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1676 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1677 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1678static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1679 int wraparound, int boundscheck);
1680#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1681 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1682 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1683 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1684static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1685 int wraparound, int boundscheck);
1686static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1687static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1688 int is_list, int wraparound, int boundscheck);
1689
1690/* ObjectGetItem.proto */
1691#if CYTHON_USE_TYPE_SLOTS
1692static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1693#else
1694#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1695#endif
1696
1697/* ListAppend.proto */
1698#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1699static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1700 PyListObject* L = (PyListObject*) list;
1701 Py_ssize_t len = Py_SIZE(list);
1702 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1703 Py_INCREF(x);
1704 PyList_SET_ITEM(list, len, x);
1705 __Pyx_SET_SIZE(list, len + 1);
1706 return 0;
1707 }
1708 return PyList_Append(list, x);
1709}
1710#else
1711#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1712#endif
1713
1714/* PyObjectGetMethod.proto */
1715static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1716
1717/* PyObjectCallMethod1.proto */
1718static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1719
1720/* append.proto */
1721static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1722
1723/* PyObjectCallNoArg.proto */
1724#if CYTHON_COMPILING_IN_CPYTHON
1725static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1726#else
1727#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1728#endif
1729
1730/* RaiseTooManyValuesToUnpack.proto */
1731static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1732
1733/* RaiseNeedMoreValuesToUnpack.proto */
1734static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1735
1736/* IterFinish.proto */
1737static CYTHON_INLINE int __Pyx_IterFinish(void);
1738
1739/* UnpackItemEndCheck.proto */
1740static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1741
1742/* None.proto */
1743static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1744
1745/* GetTopmostException.proto */
1746#if CYTHON_USE_EXC_INFO_STACK
1747static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1748#endif
1749
1750/* PyThreadStateGet.proto */
1751#if CYTHON_FAST_THREAD_STATE
1752#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1753#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1754#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1755#else
1756#define __Pyx_PyThreadState_declare
1757#define __Pyx_PyThreadState_assign
1758#define __Pyx_PyErr_Occurred() PyErr_Occurred()
1759#endif
1760
1761/* SaveResetException.proto */
1762#if CYTHON_FAST_THREAD_STATE
1763#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1764static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1765#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1766static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1767#else
1768#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1769#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1770#endif
1771
1772/* PyErrExceptionMatches.proto */
1773#if CYTHON_FAST_THREAD_STATE
1774#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1775static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1776#else
1777#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1778#endif
1779
1780/* GetException.proto */
1781#if CYTHON_FAST_THREAD_STATE
1782#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1783static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1784#else
1785static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1786#endif
1787
1788/* PyErrFetchRestore.proto */
1789#if CYTHON_FAST_THREAD_STATE
1790#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1791#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1792#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1793#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1794#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1795static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1796static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1797#if CYTHON_COMPILING_IN_CPYTHON
1798#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1799#else
1800#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1801#endif
1802#else
1803#define __Pyx_PyErr_Clear() PyErr_Clear()
1804#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1805#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1806#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1807#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1808#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1809#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1810#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1811#endif
1812
1813/* RaiseException.proto */
1814static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1815
1816/* ArgTypeTest.proto */
1817#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1818 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1819 __Pyx__ArgTypeTest(obj, type, name, exact))
1820static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1821
1822/* IncludeStringH.proto */
1823#include <string.h>
1824
1825/* BytesEquals.proto */
1826static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1827
1828/* UnicodeEquals.proto */
1829static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1830
1831/* StrEquals.proto */
1832#if PY_MAJOR_VERSION >= 3
1833#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1834#else
1835#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1836#endif
1837
1838/* UnaryNegOverflows.proto */
1839#define UNARY_NEG_WOULD_OVERFLOW(x)\
1840 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1841
1842static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1843static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1844/* GetAttr.proto */
1845static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1846
1847/* decode_c_string_utf16.proto */
1848static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1849 int byteorder = 0;
1850 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1851}
1852static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1853 int byteorder = -1;
1854 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1855}
1856static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1857 int byteorder = 1;
1858 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1859}
1860
1861/* decode_c_string.proto */
1862static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1863 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1864 const char* encoding, const char* errors,
1865 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1866
1867/* GetAttr3.proto */
1868static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1869
1870/* RaiseNoneIterError.proto */
1871static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1872
1873/* ExtTypeTest.proto */
1874static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1875
1876/* SwapException.proto */
1877#if CYTHON_FAST_THREAD_STATE
1878#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1879static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1880#else
1881static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1882#endif
1883
1884/* Import.proto */
1885static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1886
1887/* FastTypeChecks.proto */
1888#if CYTHON_COMPILING_IN_CPYTHON
1889#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1890static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1891static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1892static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1893#else
1894#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1895#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1896#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1897#endif
1898#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1899
1900static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1901/* ListCompAppend.proto */
1902#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1903static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1904 PyListObject* L = (PyListObject*) list;
1905 Py_ssize_t len = Py_SIZE(list);
1906 if (likely(L->allocated > len)) {
1907 Py_INCREF(x);
1908 PyList_SET_ITEM(list, len, x);
1909 __Pyx_SET_SIZE(list, len + 1);
1910 return 0;
1911 }
1912 return PyList_Append(list, x);
1913}
1914#else
1915#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1916#endif
1917
1918/* PyIntBinop.proto */
1919#if !CYTHON_COMPILING_IN_PYPY
1920static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1921#else
1922#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1923 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1924#endif
1925
1926/* ListExtend.proto */
1927static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1928#if CYTHON_COMPILING_IN_CPYTHON
1929 PyObject* none = _PyList_Extend((PyListObject*)L, v);
1930 if (unlikely(!none))
1931 return -1;
1932 Py_DECREF(none);
1933 return 0;
1934#else
1935 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1936#endif
1937}
1938
1939/* ImportFrom.proto */
1940static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1941
1942/* HasAttr.proto */
1943static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1944
1945/* PyObject_GenericGetAttrNoDict.proto */
1946#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1947static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1948#else
1949#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1950#endif
1951
1952/* PyObject_GenericGetAttr.proto */
1953#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1954static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1955#else
1956#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1957#endif
1958
1959/* SetVTable.proto */
1960static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1961
1962/* PyObjectGetAttrStrNoError.proto */
1963static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1964
1965/* SetupReduce.proto */
1966static int __Pyx_setup_reduce(PyObject* type_obj);
1967
1968/* TypeImport.proto */
1969#ifndef __PYX_HAVE_RT_ImportType_proto
1970#define __PYX_HAVE_RT_ImportType_proto
1971enum __Pyx_ImportType_CheckSize {
1972 __Pyx_ImportType_CheckSize_Error = 0,
1973 __Pyx_ImportType_CheckSize_Warn = 1,
1974 __Pyx_ImportType_CheckSize_Ignore = 2
1975};
1976static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1977#endif
1978
1979/* CLineInTraceback.proto */
1980#ifdef CYTHON_CLINE_IN_TRACEBACK
1981#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1982#else
1983static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1984#endif
1985
1986/* CodeObjectCache.proto */
1987typedef struct {
1988 PyCodeObject* code_object;
1989 int code_line;
1990} __Pyx_CodeObjectCacheEntry;
1991struct __Pyx_CodeObjectCache {
1992 int count;
1993 int max_count;
1994 __Pyx_CodeObjectCacheEntry* entries;
1995};
1996static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1997static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1998static PyCodeObject *__pyx_find_code_object(int code_line);
1999static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2000
2001/* AddTraceback.proto */
2002static void __Pyx_AddTraceback(const char *funcname, int c_line,
2003 int py_line, const char *filename);
2004
2005#if PY_MAJOR_VERSION < 3
2006 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
2007 static void __Pyx_ReleaseBuffer(Py_buffer *view);
2008#else
2009 #define __Pyx_GetBuffer PyObject_GetBuffer
2010 #define __Pyx_ReleaseBuffer PyBuffer_Release
2011#endif
2012
2013
2014/* BufferStructDeclare.proto */
2015typedef struct {
2016 Py_ssize_t shape, strides, suboffsets;
2017} __Pyx_Buf_DimInfo;
2018typedef struct {
2019 size_t refcount;
2020 Py_buffer pybuffer;
2021} __Pyx_Buffer;
2022typedef struct {
2023 __Pyx_Buffer *rcbuffer;
2024 char *data;
2025 __Pyx_Buf_DimInfo diminfo[8];
2026} __Pyx_LocalBuf_ND;
2027
2028/* MemviewSliceIsContig.proto */
2029static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2030
2031/* OverlappingSlices.proto */
2032static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2033 __Pyx_memviewslice *slice2,
2034 int ndim, size_t itemsize);
2035
2036/* Capsule.proto */
2037static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2038
2039/* IsLittleEndian.proto */
2040static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
2041
2042/* BufferFormatCheck.proto */
2043static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
2044static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2045 __Pyx_BufFmt_StackElem* stack,
2046 __Pyx_TypeInfo* type);
2047
2048/* TypeInfoCompare.proto */
2049static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2050
2051/* MemviewSliceValidateAndInit.proto */
2052static int __Pyx_ValidateAndInit_memviewslice(
2053 int *axes_specs,
2054 int c_or_f_flag,
2055 int buf_flags,
2056 int ndim,
2057 __Pyx_TypeInfo *dtype,
2058 __Pyx_BufFmt_StackElem stack[],
2059 __Pyx_memviewslice *memviewslice,
2060 PyObject *original_obj);
2061
2062/* ObjectToMemviewSlice.proto */
2063static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *, int writable_flag);
2064
2065/* ObjectToMemviewSlice.proto */
2066static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_long(PyObject *, int writable_flag);
2067
2068/* GCCDiagnostics.proto */
2069#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2070#define __Pyx_HAS_GCC_DIAGNOSTIC
2071#endif
2072
2073/* RealImag.proto */
2074#if CYTHON_CCOMPLEX
2075 #ifdef __cplusplus
2076 #define __Pyx_CREAL(z) ((z).real())
2077 #define __Pyx_CIMAG(z) ((z).imag())
2078 #else
2079 #define __Pyx_CREAL(z) (__real__(z))
2080 #define __Pyx_CIMAG(z) (__imag__(z))
2081 #endif
2082#else
2083 #define __Pyx_CREAL(z) ((z).real)
2084 #define __Pyx_CIMAG(z) ((z).imag)
2085#endif
2086#if defined(__cplusplus) && CYTHON_CCOMPLEX\
2087 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2088 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2089 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2090#else
2091 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2092 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2093#endif
2094
2095/* Arithmetic.proto */
2096#if CYTHON_CCOMPLEX
2097 #define __Pyx_c_eq_float(a, b) ((a)==(b))
2098 #define __Pyx_c_sum_float(a, b) ((a)+(b))
2099 #define __Pyx_c_diff_float(a, b) ((a)-(b))
2100 #define __Pyx_c_prod_float(a, b) ((a)*(b))
2101 #define __Pyx_c_quot_float(a, b) ((a)/(b))
2102 #define __Pyx_c_neg_float(a) (-(a))
2103 #ifdef __cplusplus
2104 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2105 #define __Pyx_c_conj_float(z) (::std::conj(z))
2106 #if 1
2107 #define __Pyx_c_abs_float(z) (::std::abs(z))
2108 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2109 #endif
2110 #else
2111 #define __Pyx_c_is_zero_float(z) ((z)==0)
2112 #define __Pyx_c_conj_float(z) (conjf(z))
2113 #if 1
2114 #define __Pyx_c_abs_float(z) (cabsf(z))
2115 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2116 #endif
2117 #endif
2118#else
2119 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2120 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2121 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2122 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2123 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2124 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2125 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2126 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2127 #if 1
2128 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2129 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2130 #endif
2131#endif
2132
2133/* Arithmetic.proto */
2134#if CYTHON_CCOMPLEX
2135 #define __Pyx_c_eq_double(a, b) ((a)==(b))
2136 #define __Pyx_c_sum_double(a, b) ((a)+(b))
2137 #define __Pyx_c_diff_double(a, b) ((a)-(b))
2138 #define __Pyx_c_prod_double(a, b) ((a)*(b))
2139 #define __Pyx_c_quot_double(a, b) ((a)/(b))
2140 #define __Pyx_c_neg_double(a) (-(a))
2141 #ifdef __cplusplus
2142 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2143 #define __Pyx_c_conj_double(z) (::std::conj(z))
2144 #if 1
2145 #define __Pyx_c_abs_double(z) (::std::abs(z))
2146 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2147 #endif
2148 #else
2149 #define __Pyx_c_is_zero_double(z) ((z)==0)
2150 #define __Pyx_c_conj_double(z) (conj(z))
2151 #if 1
2152 #define __Pyx_c_abs_double(z) (cabs(z))
2153 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2154 #endif
2155 #endif
2156#else
2157 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2158 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2159 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2160 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2161 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2162 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2163 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2164 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2165 #if 1
2166 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2167 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2168 #endif
2169#endif
2170
2171/* MemviewDtypeToObject.proto */
2172static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp);
2173static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *obj);
2174
2175/* ObjectToMemviewSlice.proto */
2176static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_long(PyObject *, int writable_flag);
2177
2178/* Print.proto */
2179static int __Pyx_Print(PyObject*, PyObject *, int);
2180#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
2181static PyObject* __pyx_print = 0;
2182static PyObject* __pyx_print_kwargs = 0;
2183#endif
2184
2185/* MemviewDtypeToObject.proto */
2186static CYTHON_INLINE PyObject *__pyx_memview_get_long(const char *itemp);
2187static CYTHON_INLINE int __pyx_memview_set_long(const char *itemp, PyObject *obj);
2188
2189/* ObjectToMemviewSlice.proto */
2190static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *, int writable_flag);
2191
2192/* MemviewSliceCopyTemplate.proto */
2193static __Pyx_memviewslice
2194__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2195 const char *mode, int ndim,
2196 size_t sizeof_dtype, int contig_flag,
2197 int dtype_is_object);
2198
2199/* CIntFromPy.proto */
2200static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2201
2202/* CIntToPy.proto */
2203static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2204
2205/* PrintOne.proto */
2206static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
2207
2208/* CIntFromPy.proto */
2209static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2210
2211/* CIntToPy.proto */
2212static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2213
2214/* CIntFromPy.proto */
2215static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2216
2217/* CheckBinaryVersion.proto */
2218static int __Pyx_check_binary_version(void);
2219
2220/* InitStrings.proto */
2221static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2222
2223static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2224static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2225static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2226static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2227static 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*/
2228static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2229static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2230static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2231static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2232static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2233
2234/* Module declarations from 'cython.view' */
2235
2236/* Module declarations from 'cython' */
2237
2238/* Module declarations from 'cpython.buffer' */
2239
2240/* Module declarations from 'libc.string' */
2241
2242/* Module declarations from 'libc.stdio' */
2243
2244/* Module declarations from '__builtin__' */
2245
2246/* Module declarations from 'cpython.type' */
2247static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2248
2249/* Module declarations from 'cpython' */
2250
2251/* Module declarations from 'cpython.object' */
2252
2253/* Module declarations from 'cpython.ref' */
2254
2255/* Module declarations from 'cpython.mem' */
2256
2257/* Module declarations from 'numpy' */
2258
2259/* Module declarations from 'numpy' */
2260static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2261static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2262static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2263static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2264static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2265static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2266static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2267static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2268static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2269static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2270static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2271static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2272static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2273static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2274static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2275
2276/* Module declarations from 'rank_cy' */
2277static PyTypeObject *__pyx_array_type = 0;
2278static PyTypeObject *__pyx_MemviewEnum_type = 0;
2279static PyTypeObject *__pyx_memoryview_type = 0;
2280static PyTypeObject *__pyx_memoryviewslice_type = 0;
2281static PyObject *generic = 0;
2282static PyObject *strided = 0;
2283static PyObject *indirect = 0;
2284static PyObject *contiguous = 0;
2285static PyObject *indirect_contiguous = 0;
2286static int __pyx_memoryview_thread_locks_used;
2287static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2288static PyObject *__pyx_f_7rank_cy_evaluate_cy(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7rank_cy_evaluate_cy *__pyx_optional_args); /*proto*/
2289static PyObject *__pyx_f_7rank_cy_eval_cuhk03_cy(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, long, int, int __pyx_skip_dispatch); /*proto*/
2290static PyObject *__pyx_f_7rank_cy_eval_market1501_cy(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, long, int, int __pyx_skip_dispatch); /*proto*/
2291static void __pyx_fuse_3__pyx_f_7rank_cy_function_cumsum(__Pyx_memviewslice, __Pyx_memviewslice, long); /*proto*/
2292static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2293static void *__pyx_align_pointer(void *, size_t); /*proto*/
2294static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2295static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2296static PyObject *_unellipsify(PyObject *, int); /*proto*/
2297static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2298static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2299static 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*/
2300static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2301static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2302static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2303static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2304static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2305static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2306static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2307static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2308static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2309static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2310static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2311static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2312static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2313static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2314static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2315static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2316static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2317static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2318static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2319static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2320static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2321static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2322static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2323static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2324static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2325static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
2326static __Pyx_TypeInfo __Pyx_TypeInfo_long = { "long", NULL, sizeof(long), { 0 }, 0, IS_UNSIGNED(long) ? 'U' : 'I', IS_UNSIGNED(long), 0 };
2327#define __Pyx_MODULE_NAME "rank_cy"
2328extern int __pyx_module_is_main_rank_cy;
2329int __pyx_module_is_main_rank_cy = 0;
2330
2331/* Implementation of 'rank_cy' */
2332static PyObject *__pyx_builtin_range;
2333static PyObject *__pyx_builtin_ImportError;
2334static PyObject *__pyx_builtin_ValueError;
2335static PyObject *__pyx_builtin_MemoryError;
2336static PyObject *__pyx_builtin_enumerate;
2337static PyObject *__pyx_builtin_TypeError;
2338static PyObject *__pyx_builtin_Ellipsis;
2339static PyObject *__pyx_builtin_id;
2340static PyObject *__pyx_builtin_IndexError;
2341static const char __pyx_k_O[] = "O";
2342static const char __pyx_k_c[] = "c";
2343static const char __pyx_k_k[] = "k";
2344static const char __pyx_k_id[] = "id";
2345static const char __pyx_k_np[] = "np";
2346static const char __pyx_k_add[] = "add";
2347static const char __pyx_k_end[] = "end";
2348static const char __pyx_k_new[] = "__new__";
2349static const char __pyx_k_obj[] = "obj";
2350static const char __pyx_k_axis[] = "axis";
2351static const char __pyx_k_base[] = "base";
2352static const char __pyx_k_dict[] = "__dict__";
2353static const char __pyx_k_file[] = "file";
2354static const char __pyx_k_main[] = "__main__";
2355static const char __pyx_k_mode[] = "mode";
2356static const char __pyx_k_name[] = "name";
2357static const char __pyx_k_ndim[] = "ndim";
2358static const char __pyx_k_pack[] = "pack";
2359static const char __pyx_k_size[] = "size";
2360static const char __pyx_k_step[] = "step";
2361static const char __pyx_k_stop[] = "stop";
2362static const char __pyx_k_test[] = "__test__";
2363static const char __pyx_k_ASCII[] = "ASCII";
2364static const char __pyx_k_class[] = "__class__";
2365static const char __pyx_k_dtype[] = "dtype";
2366static const char __pyx_k_error[] = "error";
2367static const char __pyx_k_faiss[] = "faiss";
2368static const char __pyx_k_flags[] = "flags";
2369static const char __pyx_k_int64[] = "int64";
2370static const char __pyx_k_items[] = "items";
2371static const char __pyx_k_numpy[] = "numpy";
2372static const char __pyx_k_print[] = "print";
2373static const char __pyx_k_range[] = "range";
2374static const char __pyx_k_shape[] = "shape";
2375static const char __pyx_k_start[] = "start";
2376static const char __pyx_k_zeros[] = "zeros";
2377static const char __pyx_k_append[] = "append";
2378static const char __pyx_k_astype[] = "astype";
2379static const char __pyx_k_choice[] = "choice";
2380static const char __pyx_k_encode[] = "encode";
2381static const char __pyx_k_format[] = "format";
2382static const char __pyx_k_g_pids[] = "g_pids";
2383static const char __pyx_k_import[] = "__import__";
2384static const char __pyx_k_name_2[] = "__name__";
2385static const char __pyx_k_pickle[] = "pickle";
2386static const char __pyx_k_q_pids[] = "q_pids";
2387static const char __pyx_k_random[] = "random";
2388static const char __pyx_k_reduce[] = "__reduce__";
2389static const char __pyx_k_search[] = "search";
2390static const char __pyx_k_struct[] = "struct";
2391static const char __pyx_k_unpack[] = "unpack";
2392static const char __pyx_k_update[] = "update";
2393static const char __pyx_k_argsort[] = "argsort";
2394static const char __pyx_k_asarray[] = "asarray";
2395static const char __pyx_k_distmat[] = "distmat";
2396static const char __pyx_k_float32[] = "float32";
2397static const char __pyx_k_fortran[] = "fortran";
2398static const char __pyx_k_g_feats[] = "g_feats";
2399static const char __pyx_k_memview[] = "memview";
2400static const char __pyx_k_newaxis[] = "newaxis";
2401static const char __pyx_k_q_feats[] = "q_feats";
2402static const char __pyx_k_Ellipsis[] = "Ellipsis";
2403static const char __pyx_k_g_camids[] = "g_camids";
2404static const char __pyx_k_getstate[] = "__getstate__";
2405static const char __pyx_k_itemsize[] = "itemsize";
2406static const char __pyx_k_max_rank[] = "max_rank";
2407static const char __pyx_k_pyx_type[] = "__pyx_type";
2408static const char __pyx_k_q_camids[] = "q_camids";
2409static const char __pyx_k_setstate[] = "__setstate__";
2410static const char __pyx_k_TypeError[] = "TypeError";
2411static const char __pyx_k_enumerate[] = "enumerate";
2412static const char __pyx_k_pyx_state[] = "__pyx_state";
2413static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2414static const char __pyx_k_IndexError[] = "IndexError";
2415static const char __pyx_k_ValueError[] = "ValueError";
2416static const char __pyx_k_pyx_result[] = "__pyx_result";
2417static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2418static const char __pyx_k_ImportError[] = "ImportError";
2419static const char __pyx_k_IndexFlatL2[] = "IndexFlatL2";
2420static const char __pyx_k_MemoryError[] = "MemoryError";
2421static const char __pyx_k_PickleError[] = "PickleError";
2422static const char __pyx_k_collections[] = "collections";
2423static const char __pyx_k_defaultdict[] = "defaultdict";
2424static const char __pyx_k_use_distmat[] = "use_distmat";
2425static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2426static const char __pyx_k_stringsource[] = "stringsource";
2427static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2428static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2429static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2430static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2431static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2432static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2433static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2434static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2435static const char __pyx_k_use_metric_cuhk03[] = "use_metric_cuhk03";
2436static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2437static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2438static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2439static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2440static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2441static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2442static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2443static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2444static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2445static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2446static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2447static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2448static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2449static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2450static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2451static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2452static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2453static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2454static const char __pyx_k_Error_all_query_identities_do_no[] = "Error: all query identities do not appear in gallery";
2455static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2456static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2457static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2458static const char __pyx_k_Note_number_of_gallery_samples_i[] = "Note: number of gallery samples is quite small, got {}";
2459static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2460static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2461static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2462static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2463static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2464static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2465static PyObject *__pyx_n_s_ASCII;
2466static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2467static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2468static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2469static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2470static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2471static PyObject *__pyx_n_s_Ellipsis;
2472static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2473static PyObject *__pyx_kp_s_Error_all_query_identities_do_no;
2474static PyObject *__pyx_n_s_ImportError;
2475static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2476static PyObject *__pyx_n_s_IndexError;
2477static PyObject *__pyx_n_s_IndexFlatL2;
2478static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2479static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2480static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2481static PyObject *__pyx_n_s_MemoryError;
2482static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2483static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2484static PyObject *__pyx_kp_s_Note_number_of_gallery_samples_i;
2485static PyObject *__pyx_n_b_O;
2486static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2487static PyObject *__pyx_n_s_PickleError;
2488static PyObject *__pyx_n_s_TypeError;
2489static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2490static PyObject *__pyx_n_s_ValueError;
2491static PyObject *__pyx_n_s_View_MemoryView;
2492static PyObject *__pyx_n_s_add;
2493static PyObject *__pyx_n_s_allocate_buffer;
2494static PyObject *__pyx_n_s_append;
2495static PyObject *__pyx_n_s_argsort;
2496static PyObject *__pyx_n_s_asarray;
2497static PyObject *__pyx_n_s_astype;
2498static PyObject *__pyx_n_s_axis;
2499static PyObject *__pyx_n_s_base;
2500static PyObject *__pyx_n_s_c;
2501static PyObject *__pyx_n_u_c;
2502static PyObject *__pyx_n_s_choice;
2503static PyObject *__pyx_n_s_class;
2504static PyObject *__pyx_n_s_cline_in_traceback;
2505static PyObject *__pyx_n_s_collections;
2506static PyObject *__pyx_kp_s_contiguous_and_direct;
2507static PyObject *__pyx_kp_s_contiguous_and_indirect;
2508static PyObject *__pyx_n_s_defaultdict;
2509static PyObject *__pyx_n_s_dict;
2510static PyObject *__pyx_n_s_distmat;
2511static PyObject *__pyx_n_s_dtype;
2512static PyObject *__pyx_n_s_dtype_is_object;
2513static PyObject *__pyx_n_s_encode;
2514static PyObject *__pyx_n_s_end;
2515static PyObject *__pyx_n_s_enumerate;
2516static PyObject *__pyx_n_s_error;
2517static PyObject *__pyx_n_s_faiss;
2518static PyObject *__pyx_n_s_file;
2519static PyObject *__pyx_n_s_flags;
2520static PyObject *__pyx_n_s_float32;
2521static PyObject *__pyx_n_s_format;
2522static PyObject *__pyx_n_s_fortran;
2523static PyObject *__pyx_n_u_fortran;
2524static PyObject *__pyx_n_s_g_camids;
2525static PyObject *__pyx_n_s_g_feats;
2526static PyObject *__pyx_n_s_g_pids;
2527static PyObject *__pyx_n_s_getstate;
2528static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2529static PyObject *__pyx_n_s_id;
2530static PyObject *__pyx_n_s_import;
2531static PyObject *__pyx_n_s_int64;
2532static PyObject *__pyx_n_s_items;
2533static PyObject *__pyx_n_s_itemsize;
2534static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2535static PyObject *__pyx_n_s_k;
2536static PyObject *__pyx_n_s_main;
2537static PyObject *__pyx_n_s_max_rank;
2538static PyObject *__pyx_n_s_memview;
2539static PyObject *__pyx_n_s_mode;
2540static PyObject *__pyx_n_s_name;
2541static PyObject *__pyx_n_s_name_2;
2542static PyObject *__pyx_n_s_ndim;
2543static PyObject *__pyx_n_s_new;
2544static PyObject *__pyx_n_s_newaxis;
2545static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2546static PyObject *__pyx_n_s_np;
2547static PyObject *__pyx_n_s_numpy;
2548static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2549static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2550static PyObject *__pyx_n_s_obj;
2551static PyObject *__pyx_n_s_pack;
2552static PyObject *__pyx_n_s_pickle;
2553static PyObject *__pyx_n_s_print;
2554static PyObject *__pyx_n_s_pyx_PickleError;
2555static PyObject *__pyx_n_s_pyx_checksum;
2556static PyObject *__pyx_n_s_pyx_getbuffer;
2557static PyObject *__pyx_n_s_pyx_result;
2558static PyObject *__pyx_n_s_pyx_state;
2559static PyObject *__pyx_n_s_pyx_type;
2560static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2561static PyObject *__pyx_n_s_pyx_vtable;
2562static PyObject *__pyx_n_s_q_camids;
2563static PyObject *__pyx_n_s_q_feats;
2564static PyObject *__pyx_n_s_q_pids;
2565static PyObject *__pyx_n_s_random;
2566static PyObject *__pyx_n_s_range;
2567static PyObject *__pyx_n_s_reduce;
2568static PyObject *__pyx_n_s_reduce_cython;
2569static PyObject *__pyx_n_s_reduce_ex;
2570static PyObject *__pyx_n_s_search;
2571static PyObject *__pyx_n_s_setstate;
2572static PyObject *__pyx_n_s_setstate_cython;
2573static PyObject *__pyx_n_s_shape;
2574static PyObject *__pyx_n_s_size;
2575static PyObject *__pyx_n_s_start;
2576static PyObject *__pyx_n_s_step;
2577static PyObject *__pyx_n_s_stop;
2578static PyObject *__pyx_kp_s_strided_and_direct;
2579static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2580static PyObject *__pyx_kp_s_strided_and_indirect;
2581static PyObject *__pyx_kp_s_stringsource;
2582static PyObject *__pyx_n_s_struct;
2583static PyObject *__pyx_n_s_test;
2584static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2585static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2586static PyObject *__pyx_n_s_unpack;
2587static PyObject *__pyx_n_s_update;
2588static PyObject *__pyx_n_s_use_distmat;
2589static PyObject *__pyx_n_s_use_metric_cuhk03;
2590static PyObject *__pyx_n_s_zeros;
2591static PyObject *__pyx_pf_7rank_cy_evaluate_cy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_distmat, PyObject *__pyx_v_q_feats, PyObject *__pyx_v_g_feats, PyObject *__pyx_v_q_pids, PyObject *__pyx_v_g_pids, PyObject *__pyx_v_q_camids, PyObject *__pyx_v_g_camids, PyObject *__pyx_v_max_rank, PyObject *__pyx_v_use_metric_cuhk03, PyObject *__pyx_v_use_distmat); /* proto */
2592static PyObject *__pyx_pf_7rank_cy_2eval_cuhk03_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, long __pyx_v_max_rank, int __pyx_v_use_distmat); /* proto */
2593static PyObject *__pyx_pf_7rank_cy_4eval_market1501_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, long __pyx_v_max_rank, int __pyx_v_use_distmat); /* proto */
2594static 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 */
2595static 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 */
2596static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2597static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2598static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2599static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2600static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2601static 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 */
2602static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2603static 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 */
2604static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2605static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2606static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2607static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2608static 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 */
2609static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2610static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2611static 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 */
2612static 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 */
2613static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2614static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2615static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2616static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2617static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2618static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2619static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2620static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2621static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2622static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2623static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2624static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2625static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2626static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2627static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2628static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2629static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2630static 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 */
2631static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2632static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2633static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2634static 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 */
2635static 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 */
2636static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2637static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2638static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2639static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2640static PyObject *__pyx_int_0;
2641static PyObject *__pyx_int_1;
2642static PyObject *__pyx_int_184977713;
2643static PyObject *__pyx_int_neg_1;
2644static PyObject *__pyx_slice_;
2645static PyObject *__pyx_tuple__2;
2646static PyObject *__pyx_tuple__3;
2647static PyObject *__pyx_tuple__4;
2648static PyObject *__pyx_tuple__5;
2649static PyObject *__pyx_tuple__6;
2650static PyObject *__pyx_tuple__7;
2651static PyObject *__pyx_tuple__8;
2652static PyObject *__pyx_tuple__9;
2653static PyObject *__pyx_tuple__10;
2654static PyObject *__pyx_tuple__11;
2655static PyObject *__pyx_tuple__12;
2656static PyObject *__pyx_tuple__13;
2657static PyObject *__pyx_tuple__14;
2658static PyObject *__pyx_tuple__15;
2659static PyObject *__pyx_tuple__16;
2660static PyObject *__pyx_tuple__17;
2661static PyObject *__pyx_tuple__18;
2662static PyObject *__pyx_tuple__19;
2663static PyObject *__pyx_tuple__20;
2664static PyObject *__pyx_tuple__21;
2665static PyObject *__pyx_tuple__22;
2666static PyObject *__pyx_tuple__23;
2667static PyObject *__pyx_tuple__24;
2668static PyObject *__pyx_tuple__25;
2669static PyObject *__pyx_tuple__26;
2670static PyObject *__pyx_codeobj__27;
2671/* Late includes */
2672
2673/* "rank_cy.pyx":21
2674 *
2675 * # Main interface
2676 * cpdef evaluate_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_metric_cuhk03=False, # <<<<<<<<<<<<<<
2677 * use_distmat=False):
2678 * distmat = np.asarray(distmat, dtype=np.float32)
2679 */
2680
2681static PyObject *__pyx_pw_7rank_cy_1evaluate_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2682static PyObject *__pyx_f_7rank_cy_evaluate_cy(PyObject *__pyx_v_distmat, PyObject *__pyx_v_q_feats, PyObject *__pyx_v_g_feats, PyObject *__pyx_v_q_pids, PyObject *__pyx_v_g_pids, PyObject *__pyx_v_q_camids, PyObject *__pyx_v_g_camids, PyObject *__pyx_v_max_rank, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_7rank_cy_evaluate_cy *__pyx_optional_args) {
2683 PyObject *__pyx_v_use_metric_cuhk03 = ((PyObject *)Py_False);
2684
2685 /* "rank_cy.pyx":22
2686 * # Main interface
2687 * cpdef evaluate_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_metric_cuhk03=False,
2688 * use_distmat=False): # <<<<<<<<<<<<<<
2689 * distmat = np.asarray(distmat, dtype=np.float32)
2690 * q_feats = np.asarray(q_feats, dtype=np.float32)
2691 */
2692 PyObject *__pyx_v_use_distmat = ((PyObject *)Py_False);
2693 PyObject *__pyx_r = NULL;
2694 __Pyx_RefNannyDeclarations
2695 PyObject *__pyx_t_1 = NULL;
2696 PyObject *__pyx_t_2 = NULL;
2697 PyObject *__pyx_t_3 = NULL;
2698 PyObject *__pyx_t_4 = NULL;
2699 PyObject *__pyx_t_5 = NULL;
2700 int __pyx_t_6;
2701 __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
2702 __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
2703 __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
2704 __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
2705 __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
2706 __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
2707 __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
2708 long __pyx_t_14;
2709 int __pyx_lineno = 0;
2710 const char *__pyx_filename = NULL;
2711 int __pyx_clineno = 0;
2712 __Pyx_RefNannySetupContext("evaluate_cy", 0);
2713 if (__pyx_optional_args) {
2714 if (__pyx_optional_args->__pyx_n > 0) {
2715 __pyx_v_use_metric_cuhk03 = __pyx_optional_args->use_metric_cuhk03;
2716 if (__pyx_optional_args->__pyx_n > 1) {
2717 __pyx_v_use_distmat = __pyx_optional_args->use_distmat;
2718 }
2719 }
2720 }
2721 __Pyx_INCREF(__pyx_v_distmat);
2722 __Pyx_INCREF(__pyx_v_q_feats);
2723 __Pyx_INCREF(__pyx_v_g_feats);
2724 __Pyx_INCREF(__pyx_v_q_pids);
2725 __Pyx_INCREF(__pyx_v_g_pids);
2726 __Pyx_INCREF(__pyx_v_q_camids);
2727 __Pyx_INCREF(__pyx_v_g_camids);
2728
2729 /* "rank_cy.pyx":23
2730 * cpdef evaluate_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_metric_cuhk03=False,
2731 * use_distmat=False):
2732 * distmat = np.asarray(distmat, dtype=np.float32) # <<<<<<<<<<<<<<
2733 * q_feats = np.asarray(q_feats, dtype=np.float32)
2734 * g_feats = np.asarray(g_feats, dtype=np.float32)
2735 */
2736 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
2737 __Pyx_GOTREF(__pyx_t_1);
2738 __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)
2739 __Pyx_GOTREF(__pyx_t_2);
2740 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2741 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
2742 __Pyx_GOTREF(__pyx_t_1);
2743 __Pyx_INCREF(__pyx_v_distmat);
2744 __Pyx_GIVEREF(__pyx_v_distmat);
2745 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_distmat);
2746 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
2747 __Pyx_GOTREF(__pyx_t_3);
2748 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error)
2749 __Pyx_GOTREF(__pyx_t_4);
2750 __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)
2751 __Pyx_GOTREF(__pyx_t_5);
2752 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2753 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
2754 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2755 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
2756 __Pyx_GOTREF(__pyx_t_5);
2757 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2758 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2759 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2760 __Pyx_DECREF_SET(__pyx_v_distmat, __pyx_t_5);
2761 __pyx_t_5 = 0;
2762
2763 /* "rank_cy.pyx":24
2764 * use_distmat=False):
2765 * distmat = np.asarray(distmat, dtype=np.float32)
2766 * q_feats = np.asarray(q_feats, dtype=np.float32) # <<<<<<<<<<<<<<
2767 * g_feats = np.asarray(g_feats, dtype=np.float32)
2768 * q_pids = np.asarray(q_pids, dtype=np.int64)
2769 */
2770 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
2771 __Pyx_GOTREF(__pyx_t_5);
2772 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
2773 __Pyx_GOTREF(__pyx_t_3);
2774 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2775 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error)
2776 __Pyx_GOTREF(__pyx_t_5);
2777 __Pyx_INCREF(__pyx_v_q_feats);
2778 __Pyx_GIVEREF(__pyx_v_q_feats);
2779 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_q_feats);
2780 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
2781 __Pyx_GOTREF(__pyx_t_1);
2782 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
2783 __Pyx_GOTREF(__pyx_t_2);
2784 __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)
2785 __Pyx_GOTREF(__pyx_t_4);
2786 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2787 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
2788 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2789 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error)
2790 __Pyx_GOTREF(__pyx_t_4);
2791 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2792 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2793 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2794 __Pyx_DECREF_SET(__pyx_v_q_feats, __pyx_t_4);
2795 __pyx_t_4 = 0;
2796
2797 /* "rank_cy.pyx":25
2798 * distmat = np.asarray(distmat, dtype=np.float32)
2799 * q_feats = np.asarray(q_feats, dtype=np.float32)
2800 * g_feats = np.asarray(g_feats, dtype=np.float32) # <<<<<<<<<<<<<<
2801 * q_pids = np.asarray(q_pids, dtype=np.int64)
2802 * g_pids = np.asarray(g_pids, dtype=np.int64)
2803 */
2804 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error)
2805 __Pyx_GOTREF(__pyx_t_4);
2806 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
2807 __Pyx_GOTREF(__pyx_t_1);
2808 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2809 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error)
2810 __Pyx_GOTREF(__pyx_t_4);
2811 __Pyx_INCREF(__pyx_v_g_feats);
2812 __Pyx_GIVEREF(__pyx_v_g_feats);
2813 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_g_feats);
2814 __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error)
2815 __Pyx_GOTREF(__pyx_t_5);
2816 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error)
2817 __Pyx_GOTREF(__pyx_t_3);
2818 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
2819 __Pyx_GOTREF(__pyx_t_2);
2820 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2821 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
2822 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2823 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
2824 __Pyx_GOTREF(__pyx_t_2);
2825 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2826 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2827 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2828 __Pyx_DECREF_SET(__pyx_v_g_feats, __pyx_t_2);
2829 __pyx_t_2 = 0;
2830
2831 /* "rank_cy.pyx":26
2832 * q_feats = np.asarray(q_feats, dtype=np.float32)
2833 * g_feats = np.asarray(g_feats, dtype=np.float32)
2834 * q_pids = np.asarray(q_pids, dtype=np.int64) # <<<<<<<<<<<<<<
2835 * g_pids = np.asarray(g_pids, dtype=np.int64)
2836 * q_camids = np.asarray(q_camids, dtype=np.int64)
2837 */
2838 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
2839 __Pyx_GOTREF(__pyx_t_2);
2840 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error)
2841 __Pyx_GOTREF(__pyx_t_5);
2842 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2843 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
2844 __Pyx_GOTREF(__pyx_t_2);
2845 __Pyx_INCREF(__pyx_v_q_pids);
2846 __Pyx_GIVEREF(__pyx_v_q_pids);
2847 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_q_pids);
2848 __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error)
2849 __Pyx_GOTREF(__pyx_t_4);
2850 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
2851 __Pyx_GOTREF(__pyx_t_1);
2852 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
2853 __Pyx_GOTREF(__pyx_t_3);
2854 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2855 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
2856 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2857 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)
2858 __Pyx_GOTREF(__pyx_t_3);
2859 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2860 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2861 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2862 __Pyx_DECREF_SET(__pyx_v_q_pids, __pyx_t_3);
2863 __pyx_t_3 = 0;
2864
2865 /* "rank_cy.pyx":27
2866 * g_feats = np.asarray(g_feats, dtype=np.float32)
2867 * q_pids = np.asarray(q_pids, dtype=np.int64)
2868 * g_pids = np.asarray(g_pids, dtype=np.int64) # <<<<<<<<<<<<<<
2869 * q_camids = np.asarray(q_camids, dtype=np.int64)
2870 * g_camids = np.asarray(g_camids, dtype=np.int64)
2871 */
2872 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
2873 __Pyx_GOTREF(__pyx_t_3);
2874 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)
2875 __Pyx_GOTREF(__pyx_t_4);
2876 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2877 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
2878 __Pyx_GOTREF(__pyx_t_3);
2879 __Pyx_INCREF(__pyx_v_g_pids);
2880 __Pyx_GIVEREF(__pyx_v_g_pids);
2881 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_g_pids);
2882 __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
2883 __Pyx_GOTREF(__pyx_t_2);
2884 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error)
2885 __Pyx_GOTREF(__pyx_t_5);
2886 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
2887 __Pyx_GOTREF(__pyx_t_1);
2888 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2889 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
2890 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2891 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
2892 __Pyx_GOTREF(__pyx_t_1);
2893 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2894 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2895 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2896 __Pyx_DECREF_SET(__pyx_v_g_pids, __pyx_t_1);
2897 __pyx_t_1 = 0;
2898
2899 /* "rank_cy.pyx":28
2900 * q_pids = np.asarray(q_pids, dtype=np.int64)
2901 * g_pids = np.asarray(g_pids, dtype=np.int64)
2902 * q_camids = np.asarray(q_camids, dtype=np.int64) # <<<<<<<<<<<<<<
2903 * g_camids = np.asarray(g_camids, dtype=np.int64)
2904 * if use_metric_cuhk03:
2905 */
2906 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
2907 __Pyx_GOTREF(__pyx_t_1);
2908 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
2909 __Pyx_GOTREF(__pyx_t_2);
2910 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2911 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
2912 __Pyx_GOTREF(__pyx_t_1);
2913 __Pyx_INCREF(__pyx_v_q_camids);
2914 __Pyx_GIVEREF(__pyx_v_q_camids);
2915 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_q_camids);
2916 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
2917 __Pyx_GOTREF(__pyx_t_3);
2918 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)
2919 __Pyx_GOTREF(__pyx_t_4);
2920 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error)
2921 __Pyx_GOTREF(__pyx_t_5);
2922 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2923 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
2924 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2925 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error)
2926 __Pyx_GOTREF(__pyx_t_5);
2927 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2928 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2929 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2930 __Pyx_DECREF_SET(__pyx_v_q_camids, __pyx_t_5);
2931 __pyx_t_5 = 0;
2932
2933 /* "rank_cy.pyx":29
2934 * g_pids = np.asarray(g_pids, dtype=np.int64)
2935 * q_camids = np.asarray(q_camids, dtype=np.int64)
2936 * g_camids = np.asarray(g_camids, dtype=np.int64) # <<<<<<<<<<<<<<
2937 * if use_metric_cuhk03:
2938 * return eval_cuhk03_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_distmat)
2939 */
2940 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L1_error)
2941 __Pyx_GOTREF(__pyx_t_5);
2942 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
2943 __Pyx_GOTREF(__pyx_t_3);
2944 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2945 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L1_error)
2946 __Pyx_GOTREF(__pyx_t_5);
2947 __Pyx_INCREF(__pyx_v_g_camids);
2948 __Pyx_GIVEREF(__pyx_v_g_camids);
2949 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_g_camids);
2950 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
2951 __Pyx_GOTREF(__pyx_t_1);
2952 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
2953 __Pyx_GOTREF(__pyx_t_2);
2954 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
2955 __Pyx_GOTREF(__pyx_t_4);
2956 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2957 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
2958 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2959 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
2960 __Pyx_GOTREF(__pyx_t_4);
2961 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2962 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2963 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2964 __Pyx_DECREF_SET(__pyx_v_g_camids, __pyx_t_4);
2965 __pyx_t_4 = 0;
2966
2967 /* "rank_cy.pyx":30
2968 * q_camids = np.asarray(q_camids, dtype=np.int64)
2969 * g_camids = np.asarray(g_camids, dtype=np.int64)
2970 * if use_metric_cuhk03: # <<<<<<<<<<<<<<
2971 * return eval_cuhk03_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_distmat)
2972 * return eval_market1501_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_distmat)
2973 */
2974 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_use_metric_cuhk03); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 30, __pyx_L1_error)
2975 if (__pyx_t_6) {
2976
2977 /* "rank_cy.pyx":31
2978 * g_camids = np.asarray(g_camids, dtype=np.int64)
2979 * if use_metric_cuhk03:
2980 * return eval_cuhk03_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_distmat) # <<<<<<<<<<<<<<
2981 * return eval_market1501_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_distmat)
2982 *
2983 */
2984 __Pyx_XDECREF(__pyx_r);
2985 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_distmat, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 31, __pyx_L1_error)
2986 __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_q_feats, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 31, __pyx_L1_error)
2987 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_g_feats, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 31, __pyx_L1_error)
2988 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_v_q_pids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 31, __pyx_L1_error)
2989 __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_v_g_pids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 31, __pyx_L1_error)
2990 __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_v_q_camids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 31, __pyx_L1_error)
2991 __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_v_g_camids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 31, __pyx_L1_error)
2992 __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_v_max_rank); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 31, __pyx_L1_error)
2993 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_use_distmat); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 31, __pyx_L1_error)
2994 __pyx_t_4 = __pyx_f_7rank_cy_eval_cuhk03_cy(__pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_6, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error)
2995 __Pyx_GOTREF(__pyx_t_4);
2996 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
2997 __pyx_t_7.memview = NULL;
2998 __pyx_t_7.data = NULL;
2999 __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
3000 __pyx_t_8.memview = NULL;
3001 __pyx_t_8.data = NULL;
3002 __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
3003 __pyx_t_9.memview = NULL;
3004 __pyx_t_9.data = NULL;
3005 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
3006 __pyx_t_10.memview = NULL;
3007 __pyx_t_10.data = NULL;
3008 __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
3009 __pyx_t_11.memview = NULL;
3010 __pyx_t_11.data = NULL;
3011 __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
3012 __pyx_t_12.memview = NULL;
3013 __pyx_t_12.data = NULL;
3014 __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
3015 __pyx_t_13.memview = NULL;
3016 __pyx_t_13.data = NULL;
3017 __pyx_r = __pyx_t_4;
3018 __pyx_t_4 = 0;
3019 goto __pyx_L0;
3020
3021 /* "rank_cy.pyx":30
3022 * q_camids = np.asarray(q_camids, dtype=np.int64)
3023 * g_camids = np.asarray(g_camids, dtype=np.int64)
3024 * if use_metric_cuhk03: # <<<<<<<<<<<<<<
3025 * return eval_cuhk03_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_distmat)
3026 * return eval_market1501_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_distmat)
3027 */
3028 }
3029
3030 /* "rank_cy.pyx":32
3031 * if use_metric_cuhk03:
3032 * return eval_cuhk03_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_distmat)
3033 * return eval_market1501_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_distmat) # <<<<<<<<<<<<<<
3034 *
3035 *
3036 */
3037 __Pyx_XDECREF(__pyx_r);
3038 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_distmat, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 32, __pyx_L1_error)
3039 __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_q_feats, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 32, __pyx_L1_error)
3040 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_g_feats, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 32, __pyx_L1_error)
3041 __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_v_q_pids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 32, __pyx_L1_error)
3042 __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_v_g_pids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 32, __pyx_L1_error)
3043 __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_v_q_camids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 32, __pyx_L1_error)
3044 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_v_g_camids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 32, __pyx_L1_error)
3045 __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_v_max_rank); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 32, __pyx_L1_error)
3046 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_use_distmat); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 32, __pyx_L1_error)
3047 __pyx_t_4 = __pyx_f_7rank_cy_eval_market1501_cy(__pyx_t_9, __pyx_t_8, __pyx_t_7, __pyx_t_13, __pyx_t_12, __pyx_t_11, __pyx_t_10, __pyx_t_14, __pyx_t_6, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error)
3048 __Pyx_GOTREF(__pyx_t_4);
3049 __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
3050 __pyx_t_9.memview = NULL;
3051 __pyx_t_9.data = NULL;
3052 __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
3053 __pyx_t_8.memview = NULL;
3054 __pyx_t_8.data = NULL;
3055 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
3056 __pyx_t_7.memview = NULL;
3057 __pyx_t_7.data = NULL;
3058 __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
3059 __pyx_t_13.memview = NULL;
3060 __pyx_t_13.data = NULL;
3061 __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
3062 __pyx_t_12.memview = NULL;
3063 __pyx_t_12.data = NULL;
3064 __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
3065 __pyx_t_11.memview = NULL;
3066 __pyx_t_11.data = NULL;
3067 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
3068 __pyx_t_10.memview = NULL;
3069 __pyx_t_10.data = NULL;
3070 __pyx_r = __pyx_t_4;
3071 __pyx_t_4 = 0;
3072 goto __pyx_L0;
3073
3074 /* "rank_cy.pyx":21
3075 *
3076 * # Main interface
3077 * cpdef evaluate_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_metric_cuhk03=False, # <<<<<<<<<<<<<<
3078 * use_distmat=False):
3079 * distmat = np.asarray(distmat, dtype=np.float32)
3080 */
3081
3082 /* function exit code */
3083 __pyx_L1_error:;
3084 __Pyx_XDECREF(__pyx_t_1);
3085 __Pyx_XDECREF(__pyx_t_2);
3086 __Pyx_XDECREF(__pyx_t_3);
3087 __Pyx_XDECREF(__pyx_t_4);
3088 __Pyx_XDECREF(__pyx_t_5);
3089 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
3090 __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
3091 __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
3092 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
3093 __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
3094 __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
3095 __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
3096 __Pyx_AddTraceback("rank_cy.evaluate_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
3097 __pyx_r = 0;
3098 __pyx_L0:;
3099 __Pyx_XDECREF(__pyx_v_distmat);
3100 __Pyx_XDECREF(__pyx_v_q_feats);
3101 __Pyx_XDECREF(__pyx_v_g_feats);
3102 __Pyx_XDECREF(__pyx_v_q_pids);
3103 __Pyx_XDECREF(__pyx_v_g_pids);
3104 __Pyx_XDECREF(__pyx_v_q_camids);
3105 __Pyx_XDECREF(__pyx_v_g_camids);
3106 __Pyx_XGIVEREF(__pyx_r);
3107 __Pyx_RefNannyFinishContext();
3108 return __pyx_r;
3109}
3110
3111/* Python wrapper */
3112static PyObject *__pyx_pw_7rank_cy_1evaluate_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3113static PyObject *__pyx_pw_7rank_cy_1evaluate_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3114 PyObject *__pyx_v_distmat = 0;
3115 PyObject *__pyx_v_q_feats = 0;
3116 PyObject *__pyx_v_g_feats = 0;
3117 PyObject *__pyx_v_q_pids = 0;
3118 PyObject *__pyx_v_g_pids = 0;
3119 PyObject *__pyx_v_q_camids = 0;
3120 PyObject *__pyx_v_g_camids = 0;
3121 PyObject *__pyx_v_max_rank = 0;
3122 PyObject *__pyx_v_use_metric_cuhk03 = 0;
3123 PyObject *__pyx_v_use_distmat = 0;
3124 int __pyx_lineno = 0;
3125 const char *__pyx_filename = NULL;
3126 int __pyx_clineno = 0;
3127 PyObject *__pyx_r = 0;
3128 __Pyx_RefNannyDeclarations
3129 __Pyx_RefNannySetupContext("evaluate_cy (wrapper)", 0);
3130 {
3131 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,&__pyx_n_s_max_rank,&__pyx_n_s_use_metric_cuhk03,&__pyx_n_s_use_distmat,0};
3132 PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
3133 values[8] = ((PyObject *)Py_False);
3134
3135 /* "rank_cy.pyx":22
3136 * # Main interface
3137 * cpdef evaluate_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_metric_cuhk03=False,
3138 * use_distmat=False): # <<<<<<<<<<<<<<
3139 * distmat = np.asarray(distmat, dtype=np.float32)
3140 * q_feats = np.asarray(q_feats, dtype=np.float32)
3141 */
3142 values[9] = ((PyObject *)Py_False);
3143 if (unlikely(__pyx_kwds)) {
3144 Py_ssize_t kw_args;
3145 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3146 switch (pos_args) {
3147 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3148 CYTHON_FALLTHROUGH;
3149 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3150 CYTHON_FALLTHROUGH;
3151 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3152 CYTHON_FALLTHROUGH;
3153 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3154 CYTHON_FALLTHROUGH;
3155 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3156 CYTHON_FALLTHROUGH;
3157 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3158 CYTHON_FALLTHROUGH;
3159 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3160 CYTHON_FALLTHROUGH;
3161 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3162 CYTHON_FALLTHROUGH;
3163 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3164 CYTHON_FALLTHROUGH;
3165 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3166 CYTHON_FALLTHROUGH;
3167 case 0: break;
3168 default: goto __pyx_L5_argtuple_error;
3169 }
3170 kw_args = PyDict_Size(__pyx_kwds);
3171 switch (pos_args) {
3172 case 0:
3173 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distmat)) != 0)) kw_args--;
3174 else goto __pyx_L5_argtuple_error;
3175 CYTHON_FALLTHROUGH;
3176 case 1:
3177 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_feats)) != 0)) kw_args--;
3178 else {
3179 __Pyx_RaiseArgtupleInvalid("evaluate_cy", 0, 8, 10, 1); __PYX_ERR(0, 21, __pyx_L3_error)
3180 }
3181 CYTHON_FALLTHROUGH;
3182 case 2:
3183 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_feats)) != 0)) kw_args--;
3184 else {
3185 __Pyx_RaiseArgtupleInvalid("evaluate_cy", 0, 8, 10, 2); __PYX_ERR(0, 21, __pyx_L3_error)
3186 }
3187 CYTHON_FALLTHROUGH;
3188 case 3:
3189 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_pids)) != 0)) kw_args--;
3190 else {
3191 __Pyx_RaiseArgtupleInvalid("evaluate_cy", 0, 8, 10, 3); __PYX_ERR(0, 21, __pyx_L3_error)
3192 }
3193 CYTHON_FALLTHROUGH;
3194 case 4:
3195 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_pids)) != 0)) kw_args--;
3196 else {
3197 __Pyx_RaiseArgtupleInvalid("evaluate_cy", 0, 8, 10, 4); __PYX_ERR(0, 21, __pyx_L3_error)
3198 }
3199 CYTHON_FALLTHROUGH;
3200 case 5:
3201 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_camids)) != 0)) kw_args--;
3202 else {
3203 __Pyx_RaiseArgtupleInvalid("evaluate_cy", 0, 8, 10, 5); __PYX_ERR(0, 21, __pyx_L3_error)
3204 }
3205 CYTHON_FALLTHROUGH;
3206 case 6:
3207 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_camids)) != 0)) kw_args--;
3208 else {
3209 __Pyx_RaiseArgtupleInvalid("evaluate_cy", 0, 8, 10, 6); __PYX_ERR(0, 21, __pyx_L3_error)
3210 }
3211 CYTHON_FALLTHROUGH;
3212 case 7:
3213 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_rank)) != 0)) kw_args--;
3214 else {
3215 __Pyx_RaiseArgtupleInvalid("evaluate_cy", 0, 8, 10, 7); __PYX_ERR(0, 21, __pyx_L3_error)
3216 }
3217 CYTHON_FALLTHROUGH;
3218 case 8:
3219 if (kw_args > 0) {
3220 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_metric_cuhk03);
3221 if (value) { values[8] = value; kw_args--; }
3222 }
3223 CYTHON_FALLTHROUGH;
3224 case 9:
3225 if (kw_args > 0) {
3226 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_distmat);
3227 if (value) { values[9] = value; kw_args--; }
3228 }
3229 }
3230 if (unlikely(kw_args > 0)) {
3231 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate_cy") < 0)) __PYX_ERR(0, 21, __pyx_L3_error)
3232 }
3233 } else {
3234 switch (PyTuple_GET_SIZE(__pyx_args)) {
3235 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3236 CYTHON_FALLTHROUGH;
3237 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3238 CYTHON_FALLTHROUGH;
3239 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3240 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3241 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3242 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3243 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3244 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3245 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3246 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3247 break;
3248 default: goto __pyx_L5_argtuple_error;
3249 }
3250 }
3251 __pyx_v_distmat = values[0];
3252 __pyx_v_q_feats = values[1];
3253 __pyx_v_g_feats = values[2];
3254 __pyx_v_q_pids = values[3];
3255 __pyx_v_g_pids = values[4];
3256 __pyx_v_q_camids = values[5];
3257 __pyx_v_g_camids = values[6];
3258 __pyx_v_max_rank = values[7];
3259 __pyx_v_use_metric_cuhk03 = values[8];
3260 __pyx_v_use_distmat = values[9];
3261 }
3262 goto __pyx_L4_argument_unpacking_done;
3263 __pyx_L5_argtuple_error:;
3264 __Pyx_RaiseArgtupleInvalid("evaluate_cy", 0, 8, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 21, __pyx_L3_error)
3265 __pyx_L3_error:;
3266 __Pyx_AddTraceback("rank_cy.evaluate_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
3267 __Pyx_RefNannyFinishContext();
3268 return NULL;
3269 __pyx_L4_argument_unpacking_done:;
3270 __pyx_r = __pyx_pf_7rank_cy_evaluate_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, __pyx_v_max_rank, __pyx_v_use_metric_cuhk03, __pyx_v_use_distmat);
3271
3272 /* "rank_cy.pyx":21
3273 *
3274 * # Main interface
3275 * cpdef evaluate_cy(distmat, q_feats, g_feats, q_pids, g_pids, q_camids, g_camids, max_rank, use_metric_cuhk03=False, # <<<<<<<<<<<<<<
3276 * use_distmat=False):
3277 * distmat = np.asarray(distmat, dtype=np.float32)
3278 */
3279
3280 /* function exit code */
3281 __Pyx_RefNannyFinishContext();
3282 return __pyx_r;
3283}
3284
3285static PyObject *__pyx_pf_7rank_cy_evaluate_cy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_distmat, PyObject *__pyx_v_q_feats, PyObject *__pyx_v_g_feats, PyObject *__pyx_v_q_pids, PyObject *__pyx_v_g_pids, PyObject *__pyx_v_q_camids, PyObject *__pyx_v_g_camids, PyObject *__pyx_v_max_rank, PyObject *__pyx_v_use_metric_cuhk03, PyObject *__pyx_v_use_distmat) {
3286 PyObject *__pyx_r = NULL;
3287 __Pyx_RefNannyDeclarations
3288 PyObject *__pyx_t_1 = NULL;
3289 struct __pyx_opt_args_7rank_cy_evaluate_cy __pyx_t_2;
3290 int __pyx_lineno = 0;
3291 const char *__pyx_filename = NULL;
3292 int __pyx_clineno = 0;
3293 __Pyx_RefNannySetupContext("evaluate_cy", 0);
3294 __Pyx_XDECREF(__pyx_r);
3295 __pyx_t_2.__pyx_n = 2;
3296 __pyx_t_2.use_metric_cuhk03 = __pyx_v_use_metric_cuhk03;
3297 __pyx_t_2.use_distmat = __pyx_v_use_distmat;
3298 __pyx_t_1 = __pyx_f_7rank_cy_evaluate_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, __pyx_v_max_rank, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
3299 __Pyx_GOTREF(__pyx_t_1);
3300 __pyx_r = __pyx_t_1;
3301 __pyx_t_1 = 0;
3302 goto __pyx_L0;
3303
3304 /* function exit code */
3305 __pyx_L1_error:;
3306 __Pyx_XDECREF(__pyx_t_1);
3307 __Pyx_AddTraceback("rank_cy.evaluate_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
3308 __pyx_r = NULL;
3309 __pyx_L0:;
3310 __Pyx_XGIVEREF(__pyx_r);
3311 __Pyx_RefNannyFinishContext();
3312 return __pyx_r;
3313}
3314
3315/* "rank_cy.pyx":35
3316 *
3317 *
3318 * cpdef eval_cuhk03_cy(float[:,:] distmat, float[:,:] q_feats, float[:,:] g_feats, long[:] q_pids, long[:]g_pids, # <<<<<<<<<<<<<<
3319 * long[:]q_camids, long[:]g_camids, long max_rank, bint use_distmat):
3320 *
3321 */
3322
3323static PyObject *__pyx_pw_7rank_cy_3eval_cuhk03_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3324static PyObject *__pyx_f_7rank_cy_eval_cuhk03_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, long __pyx_v_max_rank, int __pyx_v_use_distmat, CYTHON_UNUSED int __pyx_skip_dispatch) {
3325 long __pyx_v_num_q;
3326 long __pyx_v_num_g;
3327 long __pyx_v_dim;
3328 __Pyx_memviewslice __pyx_v_indices = { 0, 0, { 0 }, { 0 }, { 0 } };
3329 PyObject *__pyx_v_index = 0;
3330 long __pyx_v_num_repeats;
3331 __Pyx_memviewslice __pyx_v_matches = { 0, 0, { 0 }, { 0 }, { 0 } };
3332 __Pyx_memviewslice __pyx_v_all_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
3333 __Pyx_memviewslice __pyx_v_all_AP = { 0, 0, { 0 }, { 0 }, { 0 } };
3334 float __pyx_v_num_valid_q;
3335 long __pyx_v_q_idx;
3336 long __pyx_v_q_pid;
3337 long __pyx_v_q_camid;
3338 long __pyx_v_g_idx;
3339 __Pyx_memviewslice __pyx_v_order = { 0, 0, { 0 }, { 0 }, { 0 } };
3340 __Pyx_memviewslice __pyx_v_raw_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
3341 __Pyx_memviewslice __pyx_v_masked_raw_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
3342 __Pyx_memviewslice __pyx_v_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
3343 __Pyx_memviewslice __pyx_v_masked_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
3344 long __pyx_v_num_g_real;
3345 long __pyx_v_num_g_real_masked;
3346 long __pyx_v_rank_idx;
3347 long __pyx_v_rnd_idx;
3348 unsigned long __pyx_v_meet_condition;
3349 __Pyx_memviewslice __pyx_v_kept_g_pids = { 0, 0, { 0 }, { 0 }, { 0 } };
3350 __Pyx_memviewslice __pyx_v_mask = { 0, 0, { 0 }, { 0 }, { 0 } };
3351 float __pyx_v_num_rel;
3352 __Pyx_memviewslice __pyx_v_tmp_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
3353 float __pyx_v_tmp_cmc_sum;
3354 PyObject *__pyx_v_g_pids_dict = NULL;
3355 CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
3356 PyObject *__pyx_v_idxs = NULL;
3357 __Pyx_memviewslice __pyx_v_avg_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
3358 float __pyx_v_mAP;
3359 PyObject *__pyx_r = NULL;
3360 __Pyx_RefNannyDeclarations
3361 PyObject *__pyx_t_1 = NULL;
3362 PyObject *__pyx_t_2 = NULL;
3363 PyObject *__pyx_t_3 = NULL;
3364 PyObject *__pyx_t_4 = NULL;
3365 PyObject *__pyx_t_5 = NULL;
3366 PyObject *__pyx_t_6 = NULL;
3367 int __pyx_t_7;
3368 __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
3369 __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
3370 __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
3371 __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
3372 long __pyx_t_12;
3373 long __pyx_t_13;
3374 long __pyx_t_14;
3375 Py_ssize_t __pyx_t_15;
3376 long __pyx_t_16;
3377 long __pyx_t_17;
3378 long __pyx_t_18;
3379 Py_ssize_t __pyx_t_19;
3380 Py_ssize_t __pyx_t_20;
3381 int __pyx_t_21;
3382 long __pyx_t_22;
3383 int __pyx_t_23;
3384 Py_ssize_t __pyx_t_24;
3385 PyObject *(*__pyx_t_25)(PyObject *);
3386 Py_ssize_t __pyx_t_26;
3387 PyObject *(*__pyx_t_27)(PyObject *);
3388 PyObject *(*__pyx_t_28)(PyObject *);
3389 int __pyx_lineno = 0;
3390 const char *__pyx_filename = NULL;
3391 int __pyx_clineno = 0;
3392 __Pyx_RefNannySetupContext("eval_cuhk03_cy", 0);
3393
3394 /* "rank_cy.pyx":38
3395 * long[:]q_camids, long[:]g_camids, long max_rank, bint use_distmat):
3396 *
3397 * cdef long num_q = q_feats.shape[0] # <<<<<<<<<<<<<<
3398 * cdef long num_g = g_feats.shape[0]
3399 * cdef long dim = q_feats.shape[1]
3400 */
3401 __pyx_v_num_q = (__pyx_v_q_feats.shape[0]);
3402
3403 /* "rank_cy.pyx":39
3404 *
3405 * cdef long num_q = q_feats.shape[0]
3406 * cdef long num_g = g_feats.shape[0] # <<<<<<<<<<<<<<
3407 * cdef long dim = q_feats.shape[1]
3408 *
3409 */
3410 __pyx_v_num_g = (__pyx_v_g_feats.shape[0]);
3411
3412 /* "rank_cy.pyx":40
3413 * cdef long num_q = q_feats.shape[0]
3414 * cdef long num_g = g_feats.shape[0]
3415 * cdef long dim = q_feats.shape[1] # <<<<<<<<<<<<<<
3416 *
3417 * cdef long[:,:] indices
3418 */
3419 __pyx_v_dim = (__pyx_v_q_feats.shape[1]);
3420
3421 /* "rank_cy.pyx":43
3422 *
3423 * cdef long[:,:] indices
3424 * cdef index = faiss.IndexFlatL2(dim) # <<<<<<<<<<<<<<
3425 * index.add(np.asarray(g_feats))
3426 *
3427 */
3428 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_faiss); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
3429 __Pyx_GOTREF(__pyx_t_2);
3430 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_IndexFlatL2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
3431 __Pyx_GOTREF(__pyx_t_3);
3432 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3433 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
3434 __Pyx_GOTREF(__pyx_t_2);
3435 __pyx_t_4 = NULL;
3436 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3437 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
3438 if (likely(__pyx_t_4)) {
3439 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3440 __Pyx_INCREF(__pyx_t_4);
3441 __Pyx_INCREF(function);
3442 __Pyx_DECREF_SET(__pyx_t_3, function);
3443 }
3444 }
3445 __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
3446 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3447 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3448 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
3449 __Pyx_GOTREF(__pyx_t_1);
3450 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3451 __pyx_v_index = __pyx_t_1;
3452 __pyx_t_1 = 0;
3453
3454 /* "rank_cy.pyx":44
3455 * cdef long[:,:] indices
3456 * cdef index = faiss.IndexFlatL2(dim)
3457 * index.add(np.asarray(g_feats)) # <<<<<<<<<<<<<<
3458 *
3459 * if use_distmat:
3460 */
3461 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
3462 __Pyx_GOTREF(__pyx_t_3);
3463 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error)
3464 __Pyx_GOTREF(__pyx_t_4);
3465 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error)
3466 __Pyx_GOTREF(__pyx_t_5);
3467 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3468 __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, 44, __pyx_L1_error)
3469 __Pyx_GOTREF(__pyx_t_4);
3470 __pyx_t_6 = NULL;
3471 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3472 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
3473 if (likely(__pyx_t_6)) {
3474 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3475 __Pyx_INCREF(__pyx_t_6);
3476 __Pyx_INCREF(function);
3477 __Pyx_DECREF_SET(__pyx_t_5, function);
3478 }
3479 }
3480 __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
3481 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3482 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3483 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
3484 __Pyx_GOTREF(__pyx_t_2);
3485 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3486 __pyx_t_5 = NULL;
3487 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3488 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
3489 if (likely(__pyx_t_5)) {
3490 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3491 __Pyx_INCREF(__pyx_t_5);
3492 __Pyx_INCREF(function);
3493 __Pyx_DECREF_SET(__pyx_t_3, function);
3494 }
3495 }
3496 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
3497 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3498 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3499 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
3500 __Pyx_GOTREF(__pyx_t_1);
3501 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3502 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3503
3504 /* "rank_cy.pyx":46
3505 * index.add(np.asarray(g_feats))
3506 *
3507 * if use_distmat: # <<<<<<<<<<<<<<
3508 * indices = np.argsort(distmat, axis=1)
3509 * else:
3510 */
3511 __pyx_t_7 = (__pyx_v_use_distmat != 0);
3512 if (__pyx_t_7) {
3513
3514 /* "rank_cy.pyx":47
3515 *
3516 * if use_distmat:
3517 * indices = np.argsort(distmat, axis=1) # <<<<<<<<<<<<<<
3518 * else:
3519 * indices = index.search(np.asarray(q_feats), k=num_g)[1]
3520 */
3521 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
3522 __Pyx_GOTREF(__pyx_t_1);
3523 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_argsort); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error)
3524 __Pyx_GOTREF(__pyx_t_3);
3525 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3526 __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, 47, __pyx_L1_error)
3527 __Pyx_GOTREF(__pyx_t_1);
3528 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
3529 __Pyx_GOTREF(__pyx_t_2);
3530 __Pyx_GIVEREF(__pyx_t_1);
3531 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
3532 __pyx_t_1 = 0;
3533 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
3534 __Pyx_GOTREF(__pyx_t_1);
3535 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
3536 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L1_error)
3537 __Pyx_GOTREF(__pyx_t_5);
3538 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3539 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3540 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3541 __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_long(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 47, __pyx_L1_error)
3542 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3543 __pyx_v_indices = __pyx_t_8;
3544 __pyx_t_8.memview = NULL;
3545 __pyx_t_8.data = NULL;
3546
3547 /* "rank_cy.pyx":46
3548 * index.add(np.asarray(g_feats))
3549 *
3550 * if use_distmat: # <<<<<<<<<<<<<<
3551 * indices = np.argsort(distmat, axis=1)
3552 * else:
3553 */
3554 goto __pyx_L3;
3555 }
3556
3557 /* "rank_cy.pyx":49
3558 * indices = np.argsort(distmat, axis=1)
3559 * else:
3560 * indices = index.search(np.asarray(q_feats), k=num_g)[1] # <<<<<<<<<<<<<<
3561 *
3562 * if num_g < max_rank:
3563 */
3564 /*else*/ {
3565 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_search); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error)
3566 __Pyx_GOTREF(__pyx_t_5);
3567 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
3568 __Pyx_GOTREF(__pyx_t_2);
3569 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error)
3570 __Pyx_GOTREF(__pyx_t_3);
3571 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3572 __pyx_t_2 = __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_2)) __PYX_ERR(0, 49, __pyx_L1_error)
3573 __Pyx_GOTREF(__pyx_t_2);
3574 __pyx_t_4 = NULL;
3575 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3576 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
3577 if (likely(__pyx_t_4)) {
3578 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3579 __Pyx_INCREF(__pyx_t_4);
3580 __Pyx_INCREF(function);
3581 __Pyx_DECREF_SET(__pyx_t_3, function);
3582 }
3583 }
3584 __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
3585 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3586 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3587 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
3588 __Pyx_GOTREF(__pyx_t_1);
3589 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3590 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error)
3591 __Pyx_GOTREF(__pyx_t_3);
3592 __Pyx_GIVEREF(__pyx_t_1);
3593 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
3594 __pyx_t_1 = 0;
3595 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
3596 __Pyx_GOTREF(__pyx_t_1);
3597 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
3598 __Pyx_GOTREF(__pyx_t_2);
3599 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_k, __pyx_t_2) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
3600 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3601 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
3602 __Pyx_GOTREF(__pyx_t_2);
3603 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3604 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3605 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3606 __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
3607 __Pyx_GOTREF(__pyx_t_1);
3608 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3609 __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 49, __pyx_L1_error)
3610 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3611 __pyx_v_indices = __pyx_t_8;
3612 __pyx_t_8.memview = NULL;
3613 __pyx_t_8.data = NULL;
3614 }
3615 __pyx_L3:;
3616
3617 /* "rank_cy.pyx":51
3618 * indices = index.search(np.asarray(q_feats), k=num_g)[1]
3619 *
3620 * if num_g < max_rank: # <<<<<<<<<<<<<<
3621 * max_rank = num_g
3622 * print('Note: number of gallery samples is quite small, got {}'.format(num_g))
3623 */
3624 __pyx_t_7 = ((__pyx_v_num_g < __pyx_v_max_rank) != 0);
3625 if (__pyx_t_7) {
3626
3627 /* "rank_cy.pyx":52
3628 *
3629 * if num_g < max_rank:
3630 * max_rank = num_g # <<<<<<<<<<<<<<
3631 * print('Note: number of gallery samples is quite small, got {}'.format(num_g))
3632 *
3633 */
3634 __pyx_v_max_rank = __pyx_v_num_g;
3635
3636 /* "rank_cy.pyx":53
3637 * if num_g < max_rank:
3638 * max_rank = num_g
3639 * print('Note: number of gallery samples is quite small, got {}'.format(num_g)) # <<<<<<<<<<<<<<
3640 *
3641 * cdef:
3642 */
3643 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Note_number_of_gallery_samples_i, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
3644 __Pyx_GOTREF(__pyx_t_2);
3645 __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
3646 __Pyx_GOTREF(__pyx_t_3);
3647 __pyx_t_5 = NULL;
3648 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3649 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
3650 if (likely(__pyx_t_5)) {
3651 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3652 __Pyx_INCREF(__pyx_t_5);
3653 __Pyx_INCREF(function);
3654 __Pyx_DECREF_SET(__pyx_t_2, function);
3655 }
3656 }
3657 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
3658 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3659 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3660 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
3661 __Pyx_GOTREF(__pyx_t_1);
3662 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3663 if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 53, __pyx_L1_error)
3664 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3665
3666 /* "rank_cy.pyx":51
3667 * indices = index.search(np.asarray(q_feats), k=num_g)[1]
3668 *
3669 * if num_g < max_rank: # <<<<<<<<<<<<<<
3670 * max_rank = num_g
3671 * print('Note: number of gallery samples is quite small, got {}'.format(num_g))
3672 */
3673 }
3674
3675 /* "rank_cy.pyx":56
3676 *
3677 * cdef:
3678 * long num_repeats = 10 # <<<<<<<<<<<<<<
3679 * long[:,:] matches = (np.asarray(g_pids)[np.asarray(indices)] == np.asarray(q_pids)[:, np.newaxis]).astype(np.int64)
3680 *
3681 */
3682 __pyx_v_num_repeats = 10;
3683
3684 /* "rank_cy.pyx":57
3685 * cdef:
3686 * long num_repeats = 10
3687 * long[:,:] matches = (np.asarray(g_pids)[np.asarray(indices)] == np.asarray(q_pids)[:, np.newaxis]).astype(np.int64) # <<<<<<<<<<<<<<
3688 *
3689 * float[:,:] all_cmc = np.zeros((num_q, max_rank), dtype=np.float32)
3690 */
3691 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
3692 __Pyx_GOTREF(__pyx_t_3);
3693 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error)
3694 __Pyx_GOTREF(__pyx_t_5);
3695 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3696 __pyx_t_3 = __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_3)) __PYX_ERR(0, 57, __pyx_L1_error)
3697 __Pyx_GOTREF(__pyx_t_3);
3698 __pyx_t_4 = NULL;
3699 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3700 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
3701 if (likely(__pyx_t_4)) {
3702 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3703 __Pyx_INCREF(__pyx_t_4);
3704 __Pyx_INCREF(function);
3705 __Pyx_DECREF_SET(__pyx_t_5, function);
3706 }
3707 }
3708 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
3709 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3710 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3711 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
3712 __Pyx_GOTREF(__pyx_t_2);
3713 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3714 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
3715 __Pyx_GOTREF(__pyx_t_3);
3716 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error)
3717 __Pyx_GOTREF(__pyx_t_4);
3718 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3719 __pyx_t_3 = __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_3)) __PYX_ERR(0, 57, __pyx_L1_error)
3720 __Pyx_GOTREF(__pyx_t_3);
3721 __pyx_t_6 = NULL;
3722 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
3723 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
3724 if (likely(__pyx_t_6)) {
3725 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
3726 __Pyx_INCREF(__pyx_t_6);
3727 __Pyx_INCREF(function);
3728 __Pyx_DECREF_SET(__pyx_t_4, function);
3729 }
3730 }
3731 __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
3732 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3733 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3734 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error)
3735 __Pyx_GOTREF(__pyx_t_5);
3736 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3737 __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error)
3738 __Pyx_GOTREF(__pyx_t_4);
3739 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3740 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3741 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
3742 __Pyx_GOTREF(__pyx_t_2);
3743 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
3744 __Pyx_GOTREF(__pyx_t_3);
3745 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3746 __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, 57, __pyx_L1_error)
3747 __Pyx_GOTREF(__pyx_t_2);
3748 __pyx_t_6 = NULL;
3749 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3750 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
3751 if (likely(__pyx_t_6)) {
3752 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3753 __Pyx_INCREF(__pyx_t_6);
3754 __Pyx_INCREF(function);
3755 __Pyx_DECREF_SET(__pyx_t_3, function);
3756 }
3757 }
3758 __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
3759 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3760 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3761 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error)
3762 __Pyx_GOTREF(__pyx_t_5);
3763 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3764 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
3765 __Pyx_GOTREF(__pyx_t_3);
3766 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_newaxis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
3767 __Pyx_GOTREF(__pyx_t_2);
3768 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3769 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
3770 __Pyx_GOTREF(__pyx_t_3);
3771 __Pyx_INCREF(__pyx_slice_);
3772 __Pyx_GIVEREF(__pyx_slice_);
3773 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice_);
3774 __Pyx_GIVEREF(__pyx_t_2);
3775 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
3776 __pyx_t_2 = 0;
3777 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
3778 __Pyx_GOTREF(__pyx_t_2);
3779 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3780 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3781 __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
3782 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3783 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3784 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
3785 __Pyx_GOTREF(__pyx_t_2);
3786 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3787 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
3788 __Pyx_GOTREF(__pyx_t_3);
3789 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error)
3790 __Pyx_GOTREF(__pyx_t_4);
3791 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3792 __pyx_t_3 = NULL;
3793 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3794 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3795 if (likely(__pyx_t_3)) {
3796 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3797 __Pyx_INCREF(__pyx_t_3);
3798 __Pyx_INCREF(function);
3799 __Pyx_DECREF_SET(__pyx_t_2, function);
3800 }
3801 }
3802 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
3803 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3804 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3805 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error)
3806 __Pyx_GOTREF(__pyx_t_1);
3807 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3808 __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 57, __pyx_L1_error)
3809 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3810 __pyx_v_matches = __pyx_t_8;
3811 __pyx_t_8.memview = NULL;
3812 __pyx_t_8.data = NULL;
3813
3814 /* "rank_cy.pyx":59
3815 * long[:,:] matches = (np.asarray(g_pids)[np.asarray(indices)] == np.asarray(q_pids)[:, np.newaxis]).astype(np.int64)
3816 *
3817 * float[:,:] all_cmc = np.zeros((num_q, max_rank), dtype=np.float32) # <<<<<<<<<<<<<<
3818 * float[:] all_AP = np.zeros(num_q, dtype=np.float32)
3819 * float num_valid_q = 0. # number of valid query
3820 */
3821 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
3822 __Pyx_GOTREF(__pyx_t_1);
3823 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error)
3824 __Pyx_GOTREF(__pyx_t_2);
3825 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3826 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_num_q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
3827 __Pyx_GOTREF(__pyx_t_1);
3828 __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_max_rank); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error)
3829 __Pyx_GOTREF(__pyx_t_4);
3830 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
3831 __Pyx_GOTREF(__pyx_t_3);
3832 __Pyx_GIVEREF(__pyx_t_1);
3833 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
3834 __Pyx_GIVEREF(__pyx_t_4);
3835 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
3836 __pyx_t_1 = 0;
3837 __pyx_t_4 = 0;
3838 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error)
3839 __Pyx_GOTREF(__pyx_t_4);
3840 __Pyx_GIVEREF(__pyx_t_3);
3841 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
3842 __pyx_t_3 = 0;
3843 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
3844 __Pyx_GOTREF(__pyx_t_3);
3845 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
3846 __Pyx_GOTREF(__pyx_t_1);
3847 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error)
3848 __Pyx_GOTREF(__pyx_t_5);
3849 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3850 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
3851 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3852 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error)
3853 __Pyx_GOTREF(__pyx_t_5);
3854 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3855 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3856 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3857 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 59, __pyx_L1_error)
3858 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3859 __pyx_v_all_cmc = __pyx_t_9;
3860 __pyx_t_9.memview = NULL;
3861 __pyx_t_9.data = NULL;
3862
3863 /* "rank_cy.pyx":60
3864 *
3865 * float[:,:] all_cmc = np.zeros((num_q, max_rank), dtype=np.float32)
3866 * float[:] all_AP = np.zeros(num_q, dtype=np.float32) # <<<<<<<<<<<<<<
3867 * float num_valid_q = 0. # number of valid query
3868 *
3869 */
3870 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error)
3871 __Pyx_GOTREF(__pyx_t_5);
3872 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error)
3873 __Pyx_GOTREF(__pyx_t_3);
3874 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3875 __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_num_q); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error)
3876 __Pyx_GOTREF(__pyx_t_5);
3877 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error)
3878 __Pyx_GOTREF(__pyx_t_4);
3879 __Pyx_GIVEREF(__pyx_t_5);
3880 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
3881 __pyx_t_5 = 0;
3882 __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error)
3883 __Pyx_GOTREF(__pyx_t_5);
3884 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error)
3885 __Pyx_GOTREF(__pyx_t_2);
3886 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
3887 __Pyx_GOTREF(__pyx_t_1);
3888 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3889 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 60, __pyx_L1_error)
3890 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3891 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
3892 __Pyx_GOTREF(__pyx_t_1);
3893 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3894 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3895 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3896 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 60, __pyx_L1_error)
3897 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3898 __pyx_v_all_AP = __pyx_t_10;
3899 __pyx_t_10.memview = NULL;
3900 __pyx_t_10.data = NULL;
3901
3902 /* "rank_cy.pyx":61
3903 * float[:,:] all_cmc = np.zeros((num_q, max_rank), dtype=np.float32)
3904 * float[:] all_AP = np.zeros(num_q, dtype=np.float32)
3905 * float num_valid_q = 0. # number of valid query # <<<<<<<<<<<<<<
3906 *
3907 * long q_idx, q_pid, q_camid, g_idx
3908 */
3909 __pyx_v_num_valid_q = 0.;
3910
3911 /* "rank_cy.pyx":64
3912 *
3913 * long q_idx, q_pid, q_camid, g_idx
3914 * long[:] order = np.zeros(num_g, dtype=np.int64) # <<<<<<<<<<<<<<
3915 * long keep
3916 *
3917 */
3918 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
3919 __Pyx_GOTREF(__pyx_t_1);
3920 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error)
3921 __Pyx_GOTREF(__pyx_t_5);
3922 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3923 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
3924 __Pyx_GOTREF(__pyx_t_1);
3925 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error)
3926 __Pyx_GOTREF(__pyx_t_4);
3927 __Pyx_GIVEREF(__pyx_t_1);
3928 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
3929 __pyx_t_1 = 0;
3930 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
3931 __Pyx_GOTREF(__pyx_t_1);
3932 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error)
3933 __Pyx_GOTREF(__pyx_t_3);
3934 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
3935 __Pyx_GOTREF(__pyx_t_2);
3936 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3937 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
3938 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3939 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
3940 __Pyx_GOTREF(__pyx_t_2);
3941 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3942 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3943 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3944 __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 64, __pyx_L1_error)
3945 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3946 __pyx_v_order = __pyx_t_11;
3947 __pyx_t_11.memview = NULL;
3948 __pyx_t_11.data = NULL;
3949
3950 /* "rank_cy.pyx":67
3951 * long keep
3952 *
3953 * float[:] raw_cmc = np.zeros(num_g, dtype=np.float32) # binary vector, positions with value 1 are correct matches # <<<<<<<<<<<<<<
3954 * float[:] masked_raw_cmc = np.zeros(num_g, dtype=np.float32)
3955 * float[:] cmc, masked_cmc
3956 */
3957 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
3958 __Pyx_GOTREF(__pyx_t_2);
3959 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
3960 __Pyx_GOTREF(__pyx_t_1);
3961 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3962 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
3963 __Pyx_GOTREF(__pyx_t_2);
3964 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error)
3965 __Pyx_GOTREF(__pyx_t_4);
3966 __Pyx_GIVEREF(__pyx_t_2);
3967 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
3968 __pyx_t_2 = 0;
3969 __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
3970 __Pyx_GOTREF(__pyx_t_2);
3971 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error)
3972 __Pyx_GOTREF(__pyx_t_5);
3973 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error)
3974 __Pyx_GOTREF(__pyx_t_3);
3975 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3976 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
3977 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3978 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error)
3979 __Pyx_GOTREF(__pyx_t_3);
3980 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3981 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3982 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3983 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 67, __pyx_L1_error)
3984 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3985 __pyx_v_raw_cmc = __pyx_t_10;
3986 __pyx_t_10.memview = NULL;
3987 __pyx_t_10.data = NULL;
3988
3989 /* "rank_cy.pyx":68
3990 *
3991 * float[:] raw_cmc = np.zeros(num_g, dtype=np.float32) # binary vector, positions with value 1 are correct matches
3992 * float[:] masked_raw_cmc = np.zeros(num_g, dtype=np.float32) # <<<<<<<<<<<<<<
3993 * float[:] cmc, masked_cmc
3994 * long num_g_real, num_g_real_masked, rank_idx, rnd_idx
3995 */
3996 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
3997 __Pyx_GOTREF(__pyx_t_3);
3998 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
3999 __Pyx_GOTREF(__pyx_t_2);
4000 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4001 __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
4002 __Pyx_GOTREF(__pyx_t_3);
4003 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
4004 __Pyx_GOTREF(__pyx_t_4);
4005 __Pyx_GIVEREF(__pyx_t_3);
4006 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
4007 __pyx_t_3 = 0;
4008 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
4009 __Pyx_GOTREF(__pyx_t_3);
4010 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
4011 __Pyx_GOTREF(__pyx_t_1);
4012 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
4013 __Pyx_GOTREF(__pyx_t_5);
4014 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4015 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
4016 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4017 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
4018 __Pyx_GOTREF(__pyx_t_5);
4019 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4020 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4021 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4022 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 68, __pyx_L1_error)
4023 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4024 __pyx_v_masked_raw_cmc = __pyx_t_10;
4025 __pyx_t_10.memview = NULL;
4026 __pyx_t_10.data = NULL;
4027
4028 /* "rank_cy.pyx":76
4029 *
4030 * float num_rel
4031 * float[:] tmp_cmc = np.zeros(num_g, dtype=np.float32) # <<<<<<<<<<<<<<
4032 * float tmp_cmc_sum
4033 *
4034 */
4035 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
4036 __Pyx_GOTREF(__pyx_t_5);
4037 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
4038 __Pyx_GOTREF(__pyx_t_3);
4039 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4040 __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
4041 __Pyx_GOTREF(__pyx_t_5);
4042 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error)
4043 __Pyx_GOTREF(__pyx_t_4);
4044 __Pyx_GIVEREF(__pyx_t_5);
4045 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
4046 __pyx_t_5 = 0;
4047 __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
4048 __Pyx_GOTREF(__pyx_t_5);
4049 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
4050 __Pyx_GOTREF(__pyx_t_2);
4051 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
4052 __Pyx_GOTREF(__pyx_t_1);
4053 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4054 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 76, __pyx_L1_error)
4055 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4056 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
4057 __Pyx_GOTREF(__pyx_t_1);
4058 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4059 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4060 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4061 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 76, __pyx_L1_error)
4062 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4063 __pyx_v_tmp_cmc = __pyx_t_10;
4064 __pyx_t_10.memview = NULL;
4065 __pyx_t_10.data = NULL;
4066
4067 /* "rank_cy.pyx":79
4068 * float tmp_cmc_sum
4069 *
4070 * for q_idx in range(num_q): # <<<<<<<<<<<<<<
4071 * # get query pid and camid
4072 * q_pid = q_pids[q_idx]
4073 */
4074 __pyx_t_12 = __pyx_v_num_q;
4075 __pyx_t_13 = __pyx_t_12;
4076 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
4077 __pyx_v_q_idx = __pyx_t_14;
4078
4079 /* "rank_cy.pyx":81
4080 * for q_idx in range(num_q):
4081 * # get query pid and camid
4082 * q_pid = q_pids[q_idx] # <<<<<<<<<<<<<<
4083 * q_camid = q_camids[q_idx]
4084 *
4085 */
4086 __pyx_t_15 = __pyx_v_q_idx;
4087 __pyx_v_q_pid = (*((long *) ( /* dim=0 */ (__pyx_v_q_pids.data + __pyx_t_15 * __pyx_v_q_pids.strides[0]) )));
4088
4089 /* "rank_cy.pyx":82
4090 * # get query pid and camid
4091 * q_pid = q_pids[q_idx]
4092 * q_camid = q_camids[q_idx] # <<<<<<<<<<<<<<
4093 *
4094 * # remove gallery samples that have the same pid and camid with query
4095 */
4096 __pyx_t_15 = __pyx_v_q_idx;
4097 __pyx_v_q_camid = (*((long *) ( /* dim=0 */ (__pyx_v_q_camids.data + __pyx_t_15 * __pyx_v_q_camids.strides[0]) )));
4098
4099 /* "rank_cy.pyx":85
4100 *
4101 * # remove gallery samples that have the same pid and camid with query
4102 * for g_idx in range(num_g): # <<<<<<<<<<<<<<
4103 * order[g_idx] = indices[q_idx, g_idx]
4104 * num_g_real = 0
4105 */
4106 __pyx_t_16 = __pyx_v_num_g;
4107 __pyx_t_17 = __pyx_t_16;
4108 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4109 __pyx_v_g_idx = __pyx_t_18;
4110
4111 /* "rank_cy.pyx":86
4112 * # remove gallery samples that have the same pid and camid with query
4113 * for g_idx in range(num_g):
4114 * order[g_idx] = indices[q_idx, g_idx] # <<<<<<<<<<<<<<
4115 * num_g_real = 0
4116 * meet_condition = 0
4117 */
4118 __pyx_t_15 = __pyx_v_q_idx;
4119 __pyx_t_19 = __pyx_v_g_idx;
4120 __pyx_t_20 = __pyx_v_g_idx;
4121 *((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_20 * __pyx_v_order.strides[0]) )) = (*((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_15 * __pyx_v_indices.strides[0]) ) + __pyx_t_19 * __pyx_v_indices.strides[1]) )));
4122 }
4123
4124 /* "rank_cy.pyx":87
4125 * for g_idx in range(num_g):
4126 * order[g_idx] = indices[q_idx, g_idx]
4127 * num_g_real = 0 # <<<<<<<<<<<<<<
4128 * meet_condition = 0
4129 * kept_g_pids = np.zeros(num_g, dtype=np.int64)
4130 */
4131 __pyx_v_num_g_real = 0;
4132
4133 /* "rank_cy.pyx":88
4134 * order[g_idx] = indices[q_idx, g_idx]
4135 * num_g_real = 0
4136 * meet_condition = 0 # <<<<<<<<<<<<<<
4137 * kept_g_pids = np.zeros(num_g, dtype=np.int64)
4138 *
4139 */
4140 __pyx_v_meet_condition = 0;
4141
4142 /* "rank_cy.pyx":89
4143 * num_g_real = 0
4144 * meet_condition = 0
4145 * kept_g_pids = np.zeros(num_g, dtype=np.int64) # <<<<<<<<<<<<<<
4146 *
4147 * for g_idx in range(num_g):
4148 */
4149 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
4150 __Pyx_GOTREF(__pyx_t_1);
4151 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error)
4152 __Pyx_GOTREF(__pyx_t_5);
4153 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4154 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
4155 __Pyx_GOTREF(__pyx_t_1);
4156 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error)
4157 __Pyx_GOTREF(__pyx_t_4);
4158 __Pyx_GIVEREF(__pyx_t_1);
4159 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
4160 __pyx_t_1 = 0;
4161 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
4162 __Pyx_GOTREF(__pyx_t_1);
4163 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
4164 __Pyx_GOTREF(__pyx_t_3);
4165 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
4166 __Pyx_GOTREF(__pyx_t_2);
4167 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4168 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
4169 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4170 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
4171 __Pyx_GOTREF(__pyx_t_2);
4172 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4173 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4174 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4175 __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 89, __pyx_L1_error)
4176 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4177 __PYX_XDEC_MEMVIEW(&__pyx_v_kept_g_pids, 1);
4178 __pyx_v_kept_g_pids = __pyx_t_11;
4179 __pyx_t_11.memview = NULL;
4180 __pyx_t_11.data = NULL;
4181
4182 /* "rank_cy.pyx":91
4183 * kept_g_pids = np.zeros(num_g, dtype=np.int64)
4184 *
4185 * for g_idx in range(num_g): # <<<<<<<<<<<<<<
4186 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid):
4187 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
4188 */
4189 __pyx_t_16 = __pyx_v_num_g;
4190 __pyx_t_17 = __pyx_t_16;
4191 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4192 __pyx_v_g_idx = __pyx_t_18;
4193
4194 /* "rank_cy.pyx":92
4195 *
4196 * for g_idx in range(num_g):
4197 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid): # <<<<<<<<<<<<<<
4198 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
4199 * kept_g_pids[num_g_real] = g_pids[order[g_idx]]
4200 */
4201 __pyx_t_19 = __pyx_v_g_idx;
4202 __pyx_t_15 = (*((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_19 * __pyx_v_order.strides[0]) )));
4203 __pyx_t_21 = (((*((long *) ( /* dim=0 */ (__pyx_v_g_pids.data + __pyx_t_15 * __pyx_v_g_pids.strides[0]) ))) != __pyx_v_q_pid) != 0);
4204 if (!__pyx_t_21) {
4205 } else {
4206 __pyx_t_7 = __pyx_t_21;
4207 goto __pyx_L12_bool_binop_done;
4208 }
4209 __pyx_t_19 = __pyx_v_g_idx;
4210 __pyx_t_15 = (*((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_19 * __pyx_v_order.strides[0]) )));
4211 __pyx_t_21 = (((*((long *) ( /* dim=0 */ (__pyx_v_g_camids.data + __pyx_t_15 * __pyx_v_g_camids.strides[0]) ))) != __pyx_v_q_camid) != 0);
4212 __pyx_t_7 = __pyx_t_21;
4213 __pyx_L12_bool_binop_done:;
4214 if (__pyx_t_7) {
4215
4216 /* "rank_cy.pyx":93
4217 * for g_idx in range(num_g):
4218 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid):
4219 * raw_cmc[num_g_real] = matches[q_idx][g_idx] # <<<<<<<<<<<<<<
4220 * kept_g_pids[num_g_real] = g_pids[order[g_idx]]
4221 * num_g_real += 1
4222 */
4223 __pyx_t_19 = __pyx_v_q_idx;
4224 __pyx_t_15 = __pyx_v_g_idx;
4225 __pyx_t_20 = __pyx_v_num_g_real;
4226 *((float *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_20 * __pyx_v_raw_cmc.strides[0]) )) = (*((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_matches.data + __pyx_t_19 * __pyx_v_matches.strides[0]) ) + __pyx_t_15 * __pyx_v_matches.strides[1]) )));
4227
4228 /* "rank_cy.pyx":94
4229 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid):
4230 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
4231 * kept_g_pids[num_g_real] = g_pids[order[g_idx]] # <<<<<<<<<<<<<<
4232 * num_g_real += 1
4233 * if matches[q_idx][g_idx] > 1e-31:
4234 */
4235 __pyx_t_15 = __pyx_v_g_idx;
4236 __pyx_t_19 = (*((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_15 * __pyx_v_order.strides[0]) )));
4237 __pyx_t_20 = __pyx_v_num_g_real;
4238 *((long *) ( /* dim=0 */ (__pyx_v_kept_g_pids.data + __pyx_t_20 * __pyx_v_kept_g_pids.strides[0]) )) = (*((long *) ( /* dim=0 */ (__pyx_v_g_pids.data + __pyx_t_19 * __pyx_v_g_pids.strides[0]) )));
4239
4240 /* "rank_cy.pyx":95
4241 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
4242 * kept_g_pids[num_g_real] = g_pids[order[g_idx]]
4243 * num_g_real += 1 # <<<<<<<<<<<<<<
4244 * if matches[q_idx][g_idx] > 1e-31:
4245 * meet_condition = 1
4246 */
4247 __pyx_v_num_g_real = (__pyx_v_num_g_real + 1);
4248
4249 /* "rank_cy.pyx":96
4250 * kept_g_pids[num_g_real] = g_pids[order[g_idx]]
4251 * num_g_real += 1
4252 * if matches[q_idx][g_idx] > 1e-31: # <<<<<<<<<<<<<<
4253 * meet_condition = 1
4254 *
4255 */
4256 __pyx_t_15 = __pyx_v_q_idx;
4257 __pyx_t_19 = __pyx_v_g_idx;
4258 __pyx_t_7 = (((*((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_matches.data + __pyx_t_15 * __pyx_v_matches.strides[0]) ) + __pyx_t_19 * __pyx_v_matches.strides[1]) ))) > 1e-31) != 0);
4259 if (__pyx_t_7) {
4260
4261 /* "rank_cy.pyx":97
4262 * num_g_real += 1
4263 * if matches[q_idx][g_idx] > 1e-31:
4264 * meet_condition = 1 # <<<<<<<<<<<<<<
4265 *
4266 * if not meet_condition:
4267 */
4268 __pyx_v_meet_condition = 1;
4269
4270 /* "rank_cy.pyx":96
4271 * kept_g_pids[num_g_real] = g_pids[order[g_idx]]
4272 * num_g_real += 1
4273 * if matches[q_idx][g_idx] > 1e-31: # <<<<<<<<<<<<<<
4274 * meet_condition = 1
4275 *
4276 */
4277 }
4278
4279 /* "rank_cy.pyx":92
4280 *
4281 * for g_idx in range(num_g):
4282 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid): # <<<<<<<<<<<<<<
4283 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
4284 * kept_g_pids[num_g_real] = g_pids[order[g_idx]]
4285 */
4286 }
4287 }
4288
4289 /* "rank_cy.pyx":99
4290 * meet_condition = 1
4291 *
4292 * if not meet_condition: # <<<<<<<<<<<<<<
4293 * # this condition is true when query identity does not appear in gallery
4294 * continue
4295 */
4296 __pyx_t_7 = ((!(__pyx_v_meet_condition != 0)) != 0);
4297 if (__pyx_t_7) {
4298
4299 /* "rank_cy.pyx":101
4300 * if not meet_condition:
4301 * # this condition is true when query identity does not appear in gallery
4302 * continue # <<<<<<<<<<<<<<
4303 *
4304 * # cuhk03-specific setting
4305 */
4306 goto __pyx_L5_continue;
4307
4308 /* "rank_cy.pyx":99
4309 * meet_condition = 1
4310 *
4311 * if not meet_condition: # <<<<<<<<<<<<<<
4312 * # this condition is true when query identity does not appear in gallery
4313 * continue
4314 */
4315 }
4316
4317 /* "rank_cy.pyx":104
4318 *
4319 * # cuhk03-specific setting
4320 * g_pids_dict = defaultdict(list) # overhead! # <<<<<<<<<<<<<<
4321 * for g_idx in range(num_g_real):
4322 * g_pids_dict[kept_g_pids[g_idx]].append(g_idx)
4323 */
4324 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
4325 __Pyx_GOTREF(__pyx_t_1);
4326 __pyx_t_4 = NULL;
4327 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
4328 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
4329 if (likely(__pyx_t_4)) {
4330 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4331 __Pyx_INCREF(__pyx_t_4);
4332 __Pyx_INCREF(function);
4333 __Pyx_DECREF_SET(__pyx_t_1, function);
4334 }
4335 }
4336 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, ((PyObject *)(&PyList_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)(&PyList_Type)));
4337 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4338 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
4339 __Pyx_GOTREF(__pyx_t_2);
4340 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4341 __Pyx_XDECREF_SET(__pyx_v_g_pids_dict, __pyx_t_2);
4342 __pyx_t_2 = 0;
4343
4344 /* "rank_cy.pyx":105
4345 * # cuhk03-specific setting
4346 * g_pids_dict = defaultdict(list) # overhead!
4347 * for g_idx in range(num_g_real): # <<<<<<<<<<<<<<
4348 * g_pids_dict[kept_g_pids[g_idx]].append(g_idx)
4349 *
4350 */
4351 __pyx_t_16 = __pyx_v_num_g_real;
4352 __pyx_t_17 = __pyx_t_16;
4353 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4354 __pyx_v_g_idx = __pyx_t_18;
4355
4356 /* "rank_cy.pyx":106
4357 * g_pids_dict = defaultdict(list) # overhead!
4358 * for g_idx in range(num_g_real):
4359 * g_pids_dict[kept_g_pids[g_idx]].append(g_idx) # <<<<<<<<<<<<<<
4360 *
4361 * cmc = np.zeros(max_rank, dtype=np.float32)
4362 */
4363 __pyx_t_19 = __pyx_v_g_idx;
4364 __pyx_t_22 = (*((long *) ( /* dim=0 */ (__pyx_v_kept_g_pids.data + __pyx_t_19 * __pyx_v_kept_g_pids.strides[0]) )));
4365 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_g_pids_dict, __pyx_t_22, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error)
4366 __Pyx_GOTREF(__pyx_t_2);
4367 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_g_idx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
4368 __Pyx_GOTREF(__pyx_t_1);
4369 __pyx_t_23 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_23 == ((int)-1))) __PYX_ERR(0, 106, __pyx_L1_error)
4370 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4371 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4372 }
4373
4374 /* "rank_cy.pyx":108
4375 * g_pids_dict[kept_g_pids[g_idx]].append(g_idx)
4376 *
4377 * cmc = np.zeros(max_rank, dtype=np.float32) # <<<<<<<<<<<<<<
4378 * for _ in range(num_repeats):
4379 * mask = np.zeros(num_g_real, dtype=np.int64)
4380 */
4381 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
4382 __Pyx_GOTREF(__pyx_t_1);
4383 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
4384 __Pyx_GOTREF(__pyx_t_2);
4385 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4386 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_max_rank); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
4387 __Pyx_GOTREF(__pyx_t_1);
4388 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
4389 __Pyx_GOTREF(__pyx_t_4);
4390 __Pyx_GIVEREF(__pyx_t_1);
4391 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
4392 __pyx_t_1 = 0;
4393 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
4394 __Pyx_GOTREF(__pyx_t_1);
4395 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 108, __pyx_L1_error)
4396 __Pyx_GOTREF(__pyx_t_5);
4397 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
4398 __Pyx_GOTREF(__pyx_t_3);
4399 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4400 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
4401 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4402 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
4403 __Pyx_GOTREF(__pyx_t_3);
4404 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4405 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4406 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4407 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 108, __pyx_L1_error)
4408 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4409 __PYX_XDEC_MEMVIEW(&__pyx_v_cmc, 1);
4410 __pyx_v_cmc = __pyx_t_10;
4411 __pyx_t_10.memview = NULL;
4412 __pyx_t_10.data = NULL;
4413
4414 /* "rank_cy.pyx":109
4415 *
4416 * cmc = np.zeros(max_rank, dtype=np.float32)
4417 * for _ in range(num_repeats): # <<<<<<<<<<<<<<
4418 * mask = np.zeros(num_g_real, dtype=np.int64)
4419 *
4420 */
4421 __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_num_repeats); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error)
4422 __Pyx_GOTREF(__pyx_t_3);
4423 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
4424 __Pyx_GOTREF(__pyx_t_1);
4425 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4426 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
4427 __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_24 = 0;
4428 __pyx_t_25 = NULL;
4429 } else {
4430 __pyx_t_24 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error)
4431 __Pyx_GOTREF(__pyx_t_3);
4432 __pyx_t_25 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 109, __pyx_L1_error)
4433 }
4434 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4435 for (;;) {
4436 if (likely(!__pyx_t_25)) {
4437 if (likely(PyList_CheckExact(__pyx_t_3))) {
4438 if (__pyx_t_24 >= PyList_GET_SIZE(__pyx_t_3)) break;
4439 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4440 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_24); __Pyx_INCREF(__pyx_t_1); __pyx_t_24++; if (unlikely(0 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
4441 #else
4442 __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_24); __pyx_t_24++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
4443 __Pyx_GOTREF(__pyx_t_1);
4444 #endif
4445 } else {
4446 if (__pyx_t_24 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
4447 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4448 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_24); __Pyx_INCREF(__pyx_t_1); __pyx_t_24++; if (unlikely(0 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
4449 #else
4450 __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_24); __pyx_t_24++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
4451 __Pyx_GOTREF(__pyx_t_1);
4452 #endif
4453 }
4454 } else {
4455 __pyx_t_1 = __pyx_t_25(__pyx_t_3);
4456 if (unlikely(!__pyx_t_1)) {
4457 PyObject* exc_type = PyErr_Occurred();
4458 if (exc_type) {
4459 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4460 else __PYX_ERR(0, 109, __pyx_L1_error)
4461 }
4462 break;
4463 }
4464 __Pyx_GOTREF(__pyx_t_1);
4465 }
4466 __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_1);
4467 __pyx_t_1 = 0;
4468
4469 /* "rank_cy.pyx":110
4470 * cmc = np.zeros(max_rank, dtype=np.float32)
4471 * for _ in range(num_repeats):
4472 * mask = np.zeros(num_g_real, dtype=np.int64) # <<<<<<<<<<<<<<
4473 *
4474 * for _, idxs in g_pids_dict.items():
4475 */
4476 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
4477 __Pyx_GOTREF(__pyx_t_1);
4478 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
4479 __Pyx_GOTREF(__pyx_t_4);
4480 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4481 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_num_g_real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
4482 __Pyx_GOTREF(__pyx_t_1);
4483 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
4484 __Pyx_GOTREF(__pyx_t_2);
4485 __Pyx_GIVEREF(__pyx_t_1);
4486 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
4487 __pyx_t_1 = 0;
4488 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
4489 __Pyx_GOTREF(__pyx_t_1);
4490 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 110, __pyx_L1_error)
4491 __Pyx_GOTREF(__pyx_t_5);
4492 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error)
4493 __Pyx_GOTREF(__pyx_t_6);
4494 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4495 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 110, __pyx_L1_error)
4496 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4497 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error)
4498 __Pyx_GOTREF(__pyx_t_6);
4499 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4500 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4501 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4502 __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 110, __pyx_L1_error)
4503 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4504 __PYX_XDEC_MEMVIEW(&__pyx_v_mask, 1);
4505 __pyx_v_mask = __pyx_t_11;
4506 __pyx_t_11.memview = NULL;
4507 __pyx_t_11.data = NULL;
4508
4509 /* "rank_cy.pyx":112
4510 * mask = np.zeros(num_g_real, dtype=np.int64)
4511 *
4512 * for _, idxs in g_pids_dict.items(): # <<<<<<<<<<<<<<
4513 * # randomly sample one image for each gallery person
4514 * rnd_idx = np.random.choice(idxs)
4515 */
4516 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_g_pids_dict, __pyx_n_s_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
4517 __Pyx_GOTREF(__pyx_t_1);
4518 __pyx_t_2 = NULL;
4519 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
4520 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
4521 if (likely(__pyx_t_2)) {
4522 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4523 __Pyx_INCREF(__pyx_t_2);
4524 __Pyx_INCREF(function);
4525 __Pyx_DECREF_SET(__pyx_t_1, function);
4526 }
4527 }
4528 __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
4529 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4530 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error)
4531 __Pyx_GOTREF(__pyx_t_6);
4532 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4533 if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
4534 __pyx_t_1 = __pyx_t_6; __Pyx_INCREF(__pyx_t_1); __pyx_t_26 = 0;
4535 __pyx_t_27 = NULL;
4536 } else {
4537 __pyx_t_26 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
4538 __Pyx_GOTREF(__pyx_t_1);
4539 __pyx_t_27 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 112, __pyx_L1_error)
4540 }
4541 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4542 for (;;) {
4543 if (likely(!__pyx_t_27)) {
4544 if (likely(PyList_CheckExact(__pyx_t_1))) {
4545 if (__pyx_t_26 >= PyList_GET_SIZE(__pyx_t_1)) break;
4546 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4547 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_26); __Pyx_INCREF(__pyx_t_6); __pyx_t_26++; if (unlikely(0 < 0)) __PYX_ERR(0, 112, __pyx_L1_error)
4548 #else
4549 __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_26); __pyx_t_26++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error)
4550 __Pyx_GOTREF(__pyx_t_6);
4551 #endif
4552 } else {
4553 if (__pyx_t_26 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
4554 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4555 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_26); __Pyx_INCREF(__pyx_t_6); __pyx_t_26++; if (unlikely(0 < 0)) __PYX_ERR(0, 112, __pyx_L1_error)
4556 #else
4557 __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_26); __pyx_t_26++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error)
4558 __Pyx_GOTREF(__pyx_t_6);
4559 #endif
4560 }
4561 } else {
4562 __pyx_t_6 = __pyx_t_27(__pyx_t_1);
4563 if (unlikely(!__pyx_t_6)) {
4564 PyObject* exc_type = PyErr_Occurred();
4565 if (exc_type) {
4566 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4567 else __PYX_ERR(0, 112, __pyx_L1_error)
4568 }
4569 break;
4570 }
4571 __Pyx_GOTREF(__pyx_t_6);
4572 }
4573 if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
4574 PyObject* sequence = __pyx_t_6;
4575 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4576 if (unlikely(size != 2)) {
4577 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4578 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4579 __PYX_ERR(0, 112, __pyx_L1_error)
4580 }
4581 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4582 if (likely(PyTuple_CheckExact(sequence))) {
4583 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
4584 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
4585 } else {
4586 __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
4587 __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
4588 }
4589 __Pyx_INCREF(__pyx_t_2);
4590 __Pyx_INCREF(__pyx_t_4);
4591 #else
4592 __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
4593 __Pyx_GOTREF(__pyx_t_2);
4594 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
4595 __Pyx_GOTREF(__pyx_t_4);
4596 #endif
4597 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4598 } else {
4599 Py_ssize_t index = -1;
4600 __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error)
4601 __Pyx_GOTREF(__pyx_t_5);
4602 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4603 __pyx_t_28 = Py_TYPE(__pyx_t_5)->tp_iternext;
4604 index = 0; __pyx_t_2 = __pyx_t_28(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L22_unpacking_failed;
4605 __Pyx_GOTREF(__pyx_t_2);
4606 index = 1; __pyx_t_4 = __pyx_t_28(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L22_unpacking_failed;
4607 __Pyx_GOTREF(__pyx_t_4);
4608 if (__Pyx_IternextUnpackEndCheck(__pyx_t_28(__pyx_t_5), 2) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
4609 __pyx_t_28 = NULL;
4610 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4611 goto __pyx_L23_unpacking_done;
4612 __pyx_L22_unpacking_failed:;
4613 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4614 __pyx_t_28 = NULL;
4615 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4616 __PYX_ERR(0, 112, __pyx_L1_error)
4617 __pyx_L23_unpacking_done:;
4618 }
4619 __Pyx_DECREF_SET(__pyx_v__, __pyx_t_2);
4620 __pyx_t_2 = 0;
4621 __Pyx_XDECREF_SET(__pyx_v_idxs, __pyx_t_4);
4622 __pyx_t_4 = 0;
4623
4624 /* "rank_cy.pyx":114
4625 * for _, idxs in g_pids_dict.items():
4626 * # randomly sample one image for each gallery person
4627 * rnd_idx = np.random.choice(idxs) # <<<<<<<<<<<<<<
4628 * #rnd_idx = idxs[0] # use deterministic for debugging
4629 * mask[rnd_idx] = 1
4630 */
4631 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error)
4632 __Pyx_GOTREF(__pyx_t_4);
4633 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_random); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error)
4634 __Pyx_GOTREF(__pyx_t_2);
4635 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4636 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_choice); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error)
4637 __Pyx_GOTREF(__pyx_t_4);
4638 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4639 __pyx_t_2 = NULL;
4640 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4641 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
4642 if (likely(__pyx_t_2)) {
4643 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4644 __Pyx_INCREF(__pyx_t_2);
4645 __Pyx_INCREF(function);
4646 __Pyx_DECREF_SET(__pyx_t_4, function);
4647 }
4648 }
4649 __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_idxs) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_idxs);
4650 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4651 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error)
4652 __Pyx_GOTREF(__pyx_t_6);
4653 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4654 __pyx_t_16 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
4655 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4656 __pyx_v_rnd_idx = __pyx_t_16;
4657
4658 /* "rank_cy.pyx":116
4659 * rnd_idx = np.random.choice(idxs)
4660 * #rnd_idx = idxs[0] # use deterministic for debugging
4661 * mask[rnd_idx] = 1 # <<<<<<<<<<<<<<
4662 *
4663 * num_g_real_masked = 0
4664 */
4665 __pyx_t_19 = __pyx_v_rnd_idx;
4666 *((long *) ( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_19 * __pyx_v_mask.strides[0]) )) = 1;
4667
4668 /* "rank_cy.pyx":112
4669 * mask = np.zeros(num_g_real, dtype=np.int64)
4670 *
4671 * for _, idxs in g_pids_dict.items(): # <<<<<<<<<<<<<<
4672 * # randomly sample one image for each gallery person
4673 * rnd_idx = np.random.choice(idxs)
4674 */
4675 }
4676 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4677
4678 /* "rank_cy.pyx":118
4679 * mask[rnd_idx] = 1
4680 *
4681 * num_g_real_masked = 0 # <<<<<<<<<<<<<<
4682 * for g_idx in range(num_g_real):
4683 * if mask[g_idx] == 1:
4684 */
4685 __pyx_v_num_g_real_masked = 0;
4686
4687 /* "rank_cy.pyx":119
4688 *
4689 * num_g_real_masked = 0
4690 * for g_idx in range(num_g_real): # <<<<<<<<<<<<<<
4691 * if mask[g_idx] == 1:
4692 * masked_raw_cmc[num_g_real_masked] = raw_cmc[g_idx]
4693 */
4694 __pyx_t_16 = __pyx_v_num_g_real;
4695 __pyx_t_17 = __pyx_t_16;
4696 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4697 __pyx_v_g_idx = __pyx_t_18;
4698
4699 /* "rank_cy.pyx":120
4700 * num_g_real_masked = 0
4701 * for g_idx in range(num_g_real):
4702 * if mask[g_idx] == 1: # <<<<<<<<<<<<<<
4703 * masked_raw_cmc[num_g_real_masked] = raw_cmc[g_idx]
4704 * num_g_real_masked += 1
4705 */
4706 __pyx_t_19 = __pyx_v_g_idx;
4707 __pyx_t_7 = (((*((long *) ( /* dim=0 */ (__pyx_v_mask.data + __pyx_t_19 * __pyx_v_mask.strides[0]) ))) == 1) != 0);
4708 if (__pyx_t_7) {
4709
4710 /* "rank_cy.pyx":121
4711 * for g_idx in range(num_g_real):
4712 * if mask[g_idx] == 1:
4713 * masked_raw_cmc[num_g_real_masked] = raw_cmc[g_idx] # <<<<<<<<<<<<<<
4714 * num_g_real_masked += 1
4715 *
4716 */
4717 __pyx_t_19 = __pyx_v_g_idx;
4718 __pyx_t_15 = __pyx_v_num_g_real_masked;
4719 *((float *) ( /* dim=0 */ (__pyx_v_masked_raw_cmc.data + __pyx_t_15 * __pyx_v_masked_raw_cmc.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_19 * __pyx_v_raw_cmc.strides[0]) )));
4720
4721 /* "rank_cy.pyx":122
4722 * if mask[g_idx] == 1:
4723 * masked_raw_cmc[num_g_real_masked] = raw_cmc[g_idx]
4724 * num_g_real_masked += 1 # <<<<<<<<<<<<<<
4725 *
4726 * masked_cmc = np.zeros(num_g, dtype=np.float32)
4727 */
4728 __pyx_v_num_g_real_masked = (__pyx_v_num_g_real_masked + 1);
4729
4730 /* "rank_cy.pyx":120
4731 * num_g_real_masked = 0
4732 * for g_idx in range(num_g_real):
4733 * if mask[g_idx] == 1: # <<<<<<<<<<<<<<
4734 * masked_raw_cmc[num_g_real_masked] = raw_cmc[g_idx]
4735 * num_g_real_masked += 1
4736 */
4737 }
4738 }
4739
4740 /* "rank_cy.pyx":124
4741 * num_g_real_masked += 1
4742 *
4743 * masked_cmc = np.zeros(num_g, dtype=np.float32) # <<<<<<<<<<<<<<
4744 * function_cumsum(masked_raw_cmc, masked_cmc, num_g_real_masked)
4745 * for g_idx in range(num_g_real_masked):
4746 */
4747 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4748 __Pyx_GOTREF(__pyx_t_1);
4749 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
4750 __Pyx_GOTREF(__pyx_t_6);
4751 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4752 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4753 __Pyx_GOTREF(__pyx_t_1);
4754 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L1_error)
4755 __Pyx_GOTREF(__pyx_t_4);
4756 __Pyx_GIVEREF(__pyx_t_1);
4757 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
4758 __pyx_t_1 = 0;
4759 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4760 __Pyx_GOTREF(__pyx_t_1);
4761 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
4762 __Pyx_GOTREF(__pyx_t_2);
4763 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
4764 __Pyx_GOTREF(__pyx_t_5);
4765 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4766 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 124, __pyx_L1_error)
4767 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4768 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
4769 __Pyx_GOTREF(__pyx_t_5);
4770 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4771 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4772 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4773 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 124, __pyx_L1_error)
4774 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4775 __PYX_XDEC_MEMVIEW(&__pyx_v_masked_cmc, 1);
4776 __pyx_v_masked_cmc = __pyx_t_10;
4777 __pyx_t_10.memview = NULL;
4778 __pyx_t_10.data = NULL;
4779
4780 /* "rank_cy.pyx":125
4781 *
4782 * masked_cmc = np.zeros(num_g, dtype=np.float32)
4783 * function_cumsum(masked_raw_cmc, masked_cmc, num_g_real_masked) # <<<<<<<<<<<<<<
4784 * for g_idx in range(num_g_real_masked):
4785 * if masked_cmc[g_idx] > 1:
4786 */
4787 __pyx_fuse_3__pyx_f_7rank_cy_function_cumsum(__pyx_v_masked_raw_cmc, __pyx_v_masked_cmc, __pyx_v_num_g_real_masked);
4788
4789 /* "rank_cy.pyx":126
4790 * masked_cmc = np.zeros(num_g, dtype=np.float32)
4791 * function_cumsum(masked_raw_cmc, masked_cmc, num_g_real_masked)
4792 * for g_idx in range(num_g_real_masked): # <<<<<<<<<<<<<<
4793 * if masked_cmc[g_idx] > 1:
4794 * masked_cmc[g_idx] = 1
4795 */
4796 __pyx_t_16 = __pyx_v_num_g_real_masked;
4797 __pyx_t_17 = __pyx_t_16;
4798 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4799 __pyx_v_g_idx = __pyx_t_18;
4800
4801 /* "rank_cy.pyx":127
4802 * function_cumsum(masked_raw_cmc, masked_cmc, num_g_real_masked)
4803 * for g_idx in range(num_g_real_masked):
4804 * if masked_cmc[g_idx] > 1: # <<<<<<<<<<<<<<
4805 * masked_cmc[g_idx] = 1
4806 *
4807 */
4808 __pyx_t_19 = __pyx_v_g_idx;
4809 __pyx_t_7 = (((*((float *) ( /* dim=0 */ (__pyx_v_masked_cmc.data + __pyx_t_19 * __pyx_v_masked_cmc.strides[0]) ))) > 1.0) != 0);
4810 if (__pyx_t_7) {
4811
4812 /* "rank_cy.pyx":128
4813 * for g_idx in range(num_g_real_masked):
4814 * if masked_cmc[g_idx] > 1:
4815 * masked_cmc[g_idx] = 1 # <<<<<<<<<<<<<<
4816 *
4817 * for rank_idx in range(max_rank):
4818 */
4819 __pyx_t_19 = __pyx_v_g_idx;
4820 *((float *) ( /* dim=0 */ (__pyx_v_masked_cmc.data + __pyx_t_19 * __pyx_v_masked_cmc.strides[0]) )) = 1.0;
4821
4822 /* "rank_cy.pyx":127
4823 * function_cumsum(masked_raw_cmc, masked_cmc, num_g_real_masked)
4824 * for g_idx in range(num_g_real_masked):
4825 * if masked_cmc[g_idx] > 1: # <<<<<<<<<<<<<<
4826 * masked_cmc[g_idx] = 1
4827 *
4828 */
4829 }
4830 }
4831
4832 /* "rank_cy.pyx":130
4833 * masked_cmc[g_idx] = 1
4834 *
4835 * for rank_idx in range(max_rank): # <<<<<<<<<<<<<<
4836 * cmc[rank_idx] += masked_cmc[rank_idx] / num_repeats
4837 *
4838 */
4839 __pyx_t_16 = __pyx_v_max_rank;
4840 __pyx_t_17 = __pyx_t_16;
4841 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4842 __pyx_v_rank_idx = __pyx_t_18;
4843
4844 /* "rank_cy.pyx":131
4845 *
4846 * for rank_idx in range(max_rank):
4847 * cmc[rank_idx] += masked_cmc[rank_idx] / num_repeats # <<<<<<<<<<<<<<
4848 *
4849 * for rank_idx in range(max_rank):
4850 */
4851 __pyx_t_19 = __pyx_v_rank_idx;
4852 __pyx_t_15 = __pyx_v_rank_idx;
4853 *((float *) ( /* dim=0 */ (__pyx_v_cmc.data + __pyx_t_15 * __pyx_v_cmc.strides[0]) )) += ((*((float *) ( /* dim=0 */ (__pyx_v_masked_cmc.data + __pyx_t_19 * __pyx_v_masked_cmc.strides[0]) ))) / __pyx_v_num_repeats);
4854 }
4855
4856 /* "rank_cy.pyx":109
4857 *
4858 * cmc = np.zeros(max_rank, dtype=np.float32)
4859 * for _ in range(num_repeats): # <<<<<<<<<<<<<<
4860 * mask = np.zeros(num_g_real, dtype=np.int64)
4861 *
4862 */
4863 }
4864 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4865
4866 /* "rank_cy.pyx":133
4867 * cmc[rank_idx] += masked_cmc[rank_idx] / num_repeats
4868 *
4869 * for rank_idx in range(max_rank): # <<<<<<<<<<<<<<
4870 * all_cmc[q_idx, rank_idx] = cmc[rank_idx]
4871 * # compute average precision
4872 */
4873 __pyx_t_16 = __pyx_v_max_rank;
4874 __pyx_t_17 = __pyx_t_16;
4875 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4876 __pyx_v_rank_idx = __pyx_t_18;
4877
4878 /* "rank_cy.pyx":134
4879 *
4880 * for rank_idx in range(max_rank):
4881 * all_cmc[q_idx, rank_idx] = cmc[rank_idx] # <<<<<<<<<<<<<<
4882 * # compute average precision
4883 * # reference: https://en.wikipedia.org/wiki/Evaluation_measures_(information_retrieval)#Average_precision
4884 */
4885 __pyx_t_19 = __pyx_v_rank_idx;
4886 __pyx_t_15 = __pyx_v_q_idx;
4887 __pyx_t_20 = __pyx_v_rank_idx;
4888 *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_all_cmc.data + __pyx_t_15 * __pyx_v_all_cmc.strides[0]) ) + __pyx_t_20 * __pyx_v_all_cmc.strides[1]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_cmc.data + __pyx_t_19 * __pyx_v_cmc.strides[0]) )));
4889 }
4890
4891 /* "rank_cy.pyx":137
4892 * # compute average precision
4893 * # reference: https://en.wikipedia.org/wiki/Evaluation_measures_(information_retrieval)#Average_precision
4894 * function_cumsum(raw_cmc, tmp_cmc, num_g_real) # <<<<<<<<<<<<<<
4895 * num_rel = 0
4896 * tmp_cmc_sum = 0
4897 */
4898 __pyx_fuse_3__pyx_f_7rank_cy_function_cumsum(__pyx_v_raw_cmc, __pyx_v_tmp_cmc, __pyx_v_num_g_real);
4899
4900 /* "rank_cy.pyx":138
4901 * # reference: https://en.wikipedia.org/wiki/Evaluation_measures_(information_retrieval)#Average_precision
4902 * function_cumsum(raw_cmc, tmp_cmc, num_g_real)
4903 * num_rel = 0 # <<<<<<<<<<<<<<
4904 * tmp_cmc_sum = 0
4905 * for g_idx in range(num_g_real):
4906 */
4907 __pyx_v_num_rel = 0.0;
4908
4909 /* "rank_cy.pyx":139
4910 * function_cumsum(raw_cmc, tmp_cmc, num_g_real)
4911 * num_rel = 0
4912 * tmp_cmc_sum = 0 # <<<<<<<<<<<<<<
4913 * for g_idx in range(num_g_real):
4914 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx]
4915 */
4916 __pyx_v_tmp_cmc_sum = 0.0;
4917
4918 /* "rank_cy.pyx":140
4919 * num_rel = 0
4920 * tmp_cmc_sum = 0
4921 * for g_idx in range(num_g_real): # <<<<<<<<<<<<<<
4922 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx]
4923 * num_rel += raw_cmc[g_idx]
4924 */
4925 __pyx_t_16 = __pyx_v_num_g_real;
4926 __pyx_t_17 = __pyx_t_16;
4927 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
4928 __pyx_v_g_idx = __pyx_t_18;
4929
4930 /* "rank_cy.pyx":141
4931 * tmp_cmc_sum = 0
4932 * for g_idx in range(num_g_real):
4933 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx] # <<<<<<<<<<<<<<
4934 * num_rel += raw_cmc[g_idx]
4935 * all_AP[q_idx] = tmp_cmc_sum / num_rel
4936 */
4937 __pyx_t_19 = __pyx_v_g_idx;
4938 __pyx_t_20 = __pyx_v_g_idx;
4939 __pyx_v_tmp_cmc_sum = (__pyx_v_tmp_cmc_sum + (((*((float *) ( /* dim=0 */ (__pyx_v_tmp_cmc.data + __pyx_t_19 * __pyx_v_tmp_cmc.strides[0]) ))) / (__pyx_v_g_idx + 1.)) * (*((float *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_20 * __pyx_v_raw_cmc.strides[0]) )))));
4940
4941 /* "rank_cy.pyx":142
4942 * for g_idx in range(num_g_real):
4943 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx]
4944 * num_rel += raw_cmc[g_idx] # <<<<<<<<<<<<<<
4945 * all_AP[q_idx] = tmp_cmc_sum / num_rel
4946 * num_valid_q += 1.
4947 */
4948 __pyx_t_20 = __pyx_v_g_idx;
4949 __pyx_v_num_rel = (__pyx_v_num_rel + (*((float *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_20 * __pyx_v_raw_cmc.strides[0]) ))));
4950 }
4951
4952 /* "rank_cy.pyx":143
4953 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx]
4954 * num_rel += raw_cmc[g_idx]
4955 * all_AP[q_idx] = tmp_cmc_sum / num_rel # <<<<<<<<<<<<<<
4956 * num_valid_q += 1.
4957 *
4958 */
4959 __pyx_t_20 = __pyx_v_q_idx;
4960 *((float *) ( /* dim=0 */ (__pyx_v_all_AP.data + __pyx_t_20 * __pyx_v_all_AP.strides[0]) )) = (__pyx_v_tmp_cmc_sum / __pyx_v_num_rel);
4961
4962 /* "rank_cy.pyx":144
4963 * num_rel += raw_cmc[g_idx]
4964 * all_AP[q_idx] = tmp_cmc_sum / num_rel
4965 * num_valid_q += 1. # <<<<<<<<<<<<<<
4966 *
4967 * assert num_valid_q > 0, 'Error: all query identities do not appear in gallery'
4968 */
4969 __pyx_v_num_valid_q = (__pyx_v_num_valid_q + 1.);
4970 __pyx_L5_continue:;
4971 }
4972
4973 /* "rank_cy.pyx":146
4974 * num_valid_q += 1.
4975 *
4976 * assert num_valid_q > 0, 'Error: all query identities do not appear in gallery' # <<<<<<<<<<<<<<
4977 *
4978 * # compute averaged cmc
4979 */
4980 #ifndef CYTHON_WITHOUT_ASSERTIONS
4981 if (unlikely(!Py_OptimizeFlag)) {
4982 if (unlikely(!((__pyx_v_num_valid_q > 0.0) != 0))) {
4983 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Error_all_query_identities_do_no);
4984 __PYX_ERR(0, 146, __pyx_L1_error)
4985 }
4986 }
4987 #endif
4988
4989 /* "rank_cy.pyx":149
4990 *
4991 * # compute averaged cmc
4992 * cdef float[:] avg_cmc = np.zeros(max_rank, dtype=np.float32) # <<<<<<<<<<<<<<
4993 * for rank_idx in range(max_rank):
4994 * for q_idx in range(num_q):
4995 */
4996 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error)
4997 __Pyx_GOTREF(__pyx_t_3);
4998 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error)
4999 __Pyx_GOTREF(__pyx_t_5);
5000 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5001 __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_max_rank); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error)
5002 __Pyx_GOTREF(__pyx_t_3);
5003 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
5004 __Pyx_GOTREF(__pyx_t_1);
5005 __Pyx_GIVEREF(__pyx_t_3);
5006 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
5007 __pyx_t_3 = 0;
5008 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error)
5009 __Pyx_GOTREF(__pyx_t_3);
5010 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error)
5011 __Pyx_GOTREF(__pyx_t_4);
5012 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error)
5013 __Pyx_GOTREF(__pyx_t_6);
5014 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5015 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 149, __pyx_L1_error)
5016 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5017 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error)
5018 __Pyx_GOTREF(__pyx_t_6);
5019 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5020 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5021 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5022 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 149, __pyx_L1_error)
5023 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5024 __pyx_v_avg_cmc = __pyx_t_10;
5025 __pyx_t_10.memview = NULL;
5026 __pyx_t_10.data = NULL;
5027
5028 /* "rank_cy.pyx":150
5029 * # compute averaged cmc
5030 * cdef float[:] avg_cmc = np.zeros(max_rank, dtype=np.float32)
5031 * for rank_idx in range(max_rank): # <<<<<<<<<<<<<<
5032 * for q_idx in range(num_q):
5033 * avg_cmc[rank_idx] += all_cmc[q_idx, rank_idx]
5034 */
5035 __pyx_t_12 = __pyx_v_max_rank;
5036 __pyx_t_13 = __pyx_t_12;
5037 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5038 __pyx_v_rank_idx = __pyx_t_14;
5039
5040 /* "rank_cy.pyx":151
5041 * cdef float[:] avg_cmc = np.zeros(max_rank, dtype=np.float32)
5042 * for rank_idx in range(max_rank):
5043 * for q_idx in range(num_q): # <<<<<<<<<<<<<<
5044 * avg_cmc[rank_idx] += all_cmc[q_idx, rank_idx]
5045 * avg_cmc[rank_idx] /= num_valid_q
5046 */
5047 __pyx_t_16 = __pyx_v_num_q;
5048 __pyx_t_17 = __pyx_t_16;
5049 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
5050 __pyx_v_q_idx = __pyx_t_18;
5051
5052 /* "rank_cy.pyx":152
5053 * for rank_idx in range(max_rank):
5054 * for q_idx in range(num_q):
5055 * avg_cmc[rank_idx] += all_cmc[q_idx, rank_idx] # <<<<<<<<<<<<<<
5056 * avg_cmc[rank_idx] /= num_valid_q
5057 *
5058 */
5059 __pyx_t_20 = __pyx_v_q_idx;
5060 __pyx_t_19 = __pyx_v_rank_idx;
5061 __pyx_t_15 = __pyx_v_rank_idx;
5062 *((float *) ( /* dim=0 */ (__pyx_v_avg_cmc.data + __pyx_t_15 * __pyx_v_avg_cmc.strides[0]) )) += (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_all_cmc.data + __pyx_t_20 * __pyx_v_all_cmc.strides[0]) ) + __pyx_t_19 * __pyx_v_all_cmc.strides[1]) )));
5063 }
5064
5065 /* "rank_cy.pyx":153
5066 * for q_idx in range(num_q):
5067 * avg_cmc[rank_idx] += all_cmc[q_idx, rank_idx]
5068 * avg_cmc[rank_idx] /= num_valid_q # <<<<<<<<<<<<<<
5069 *
5070 * cdef float mAP = 0
5071 */
5072 __pyx_t_19 = __pyx_v_rank_idx;
5073 *((float *) ( /* dim=0 */ (__pyx_v_avg_cmc.data + __pyx_t_19 * __pyx_v_avg_cmc.strides[0]) )) /= __pyx_v_num_valid_q;
5074 }
5075
5076 /* "rank_cy.pyx":155
5077 * avg_cmc[rank_idx] /= num_valid_q
5078 *
5079 * cdef float mAP = 0 # <<<<<<<<<<<<<<
5080 * for q_idx in range(num_q):
5081 * mAP += all_AP[q_idx]
5082 */
5083 __pyx_v_mAP = 0.0;
5084
5085 /* "rank_cy.pyx":156
5086 *
5087 * cdef float mAP = 0
5088 * for q_idx in range(num_q): # <<<<<<<<<<<<<<
5089 * mAP += all_AP[q_idx]
5090 * mAP /= num_valid_q
5091 */
5092 __pyx_t_12 = __pyx_v_num_q;
5093 __pyx_t_13 = __pyx_t_12;
5094 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5095 __pyx_v_q_idx = __pyx_t_14;
5096
5097 /* "rank_cy.pyx":157
5098 * cdef float mAP = 0
5099 * for q_idx in range(num_q):
5100 * mAP += all_AP[q_idx] # <<<<<<<<<<<<<<
5101 * mAP /= num_valid_q
5102 *
5103 */
5104 __pyx_t_19 = __pyx_v_q_idx;
5105 __pyx_v_mAP = (__pyx_v_mAP + (*((float *) ( /* dim=0 */ (__pyx_v_all_AP.data + __pyx_t_19 * __pyx_v_all_AP.strides[0]) ))));
5106 }
5107
5108 /* "rank_cy.pyx":158
5109 * for q_idx in range(num_q):
5110 * mAP += all_AP[q_idx]
5111 * mAP /= num_valid_q # <<<<<<<<<<<<<<
5112 *
5113 * return np.asarray(avg_cmc).astype(np.float32), mAP
5114 */
5115 __pyx_v_mAP = (__pyx_v_mAP / __pyx_v_num_valid_q);
5116
5117 /* "rank_cy.pyx":160
5118 * mAP /= num_valid_q
5119 *
5120 * return np.asarray(avg_cmc).astype(np.float32), mAP # <<<<<<<<<<<<<<
5121 *
5122 *
5123 */
5124 __Pyx_XDECREF(__pyx_r);
5125 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
5126 __Pyx_GOTREF(__pyx_t_1);
5127 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error)
5128 __Pyx_GOTREF(__pyx_t_5);
5129 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5130 __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_avg_cmc, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
5131 __Pyx_GOTREF(__pyx_t_1);
5132 __pyx_t_4 = NULL;
5133 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5134 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
5135 if (likely(__pyx_t_4)) {
5136 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5137 __Pyx_INCREF(__pyx_t_4);
5138 __Pyx_INCREF(function);
5139 __Pyx_DECREF_SET(__pyx_t_5, function);
5140 }
5141 }
5142 __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);
5143 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5144 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5145 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error)
5146 __Pyx_GOTREF(__pyx_t_3);
5147 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5148 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error)
5149 __Pyx_GOTREF(__pyx_t_5);
5150 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5151 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error)
5152 __Pyx_GOTREF(__pyx_t_3);
5153 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
5154 __Pyx_GOTREF(__pyx_t_1);
5155 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5156 __pyx_t_3 = NULL;
5157 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5158 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
5159 if (likely(__pyx_t_3)) {
5160 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5161 __Pyx_INCREF(__pyx_t_3);
5162 __Pyx_INCREF(function);
5163 __Pyx_DECREF_SET(__pyx_t_5, function);
5164 }
5165 }
5166 __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
5167 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5168 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5169 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 160, __pyx_L1_error)
5170 __Pyx_GOTREF(__pyx_t_6);
5171 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5172 __pyx_t_5 = PyFloat_FromDouble(__pyx_v_mAP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error)
5173 __Pyx_GOTREF(__pyx_t_5);
5174 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
5175 __Pyx_GOTREF(__pyx_t_1);
5176 __Pyx_GIVEREF(__pyx_t_6);
5177 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
5178 __Pyx_GIVEREF(__pyx_t_5);
5179 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
5180 __pyx_t_6 = 0;
5181 __pyx_t_5 = 0;
5182 __pyx_r = __pyx_t_1;
5183 __pyx_t_1 = 0;
5184 goto __pyx_L0;
5185
5186 /* "rank_cy.pyx":35
5187 *
5188 *
5189 * cpdef eval_cuhk03_cy(float[:,:] distmat, float[:,:] q_feats, float[:,:] g_feats, long[:] q_pids, long[:]g_pids, # <<<<<<<<<<<<<<
5190 * long[:]q_camids, long[:]g_camids, long max_rank, bint use_distmat):
5191 *
5192 */
5193
5194 /* function exit code */
5195 __pyx_L1_error:;
5196 __Pyx_XDECREF(__pyx_t_1);
5197 __Pyx_XDECREF(__pyx_t_2);
5198 __Pyx_XDECREF(__pyx_t_3);
5199 __Pyx_XDECREF(__pyx_t_4);
5200 __Pyx_XDECREF(__pyx_t_5);
5201 __Pyx_XDECREF(__pyx_t_6);
5202 __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
5203 __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
5204 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
5205 __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
5206 __Pyx_AddTraceback("rank_cy.eval_cuhk03_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
5207 __pyx_r = 0;
5208 __pyx_L0:;
5209 __PYX_XDEC_MEMVIEW(&__pyx_v_indices, 1);
5210 __Pyx_XDECREF(__pyx_v_index);
5211 __PYX_XDEC_MEMVIEW(&__pyx_v_matches, 1);
5212 __PYX_XDEC_MEMVIEW(&__pyx_v_all_cmc, 1);
5213 __PYX_XDEC_MEMVIEW(&__pyx_v_all_AP, 1);
5214 __PYX_XDEC_MEMVIEW(&__pyx_v_order, 1);
5215 __PYX_XDEC_MEMVIEW(&__pyx_v_raw_cmc, 1);
5216 __PYX_XDEC_MEMVIEW(&__pyx_v_masked_raw_cmc, 1);
5217 __PYX_XDEC_MEMVIEW(&__pyx_v_cmc, 1);
5218 __PYX_XDEC_MEMVIEW(&__pyx_v_masked_cmc, 1);
5219 __PYX_XDEC_MEMVIEW(&__pyx_v_kept_g_pids, 1);
5220 __PYX_XDEC_MEMVIEW(&__pyx_v_mask, 1);
5221 __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_cmc, 1);
5222 __Pyx_XDECREF(__pyx_v_g_pids_dict);
5223 __Pyx_XDECREF(__pyx_v__);
5224 __Pyx_XDECREF(__pyx_v_idxs);
5225 __PYX_XDEC_MEMVIEW(&__pyx_v_avg_cmc, 1);
5226 __Pyx_XGIVEREF(__pyx_r);
5227 __Pyx_RefNannyFinishContext();
5228 return __pyx_r;
5229}
5230
5231/* Python wrapper */
5232static PyObject *__pyx_pw_7rank_cy_3eval_cuhk03_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5233static PyObject *__pyx_pw_7rank_cy_3eval_cuhk03_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5234 __Pyx_memviewslice __pyx_v_distmat = { 0, 0, { 0 }, { 0 }, { 0 } };
5235 __Pyx_memviewslice __pyx_v_q_feats = { 0, 0, { 0 }, { 0 }, { 0 } };
5236 __Pyx_memviewslice __pyx_v_g_feats = { 0, 0, { 0 }, { 0 }, { 0 } };
5237 __Pyx_memviewslice __pyx_v_q_pids = { 0, 0, { 0 }, { 0 }, { 0 } };
5238 __Pyx_memviewslice __pyx_v_g_pids = { 0, 0, { 0 }, { 0 }, { 0 } };
5239 __Pyx_memviewslice __pyx_v_q_camids = { 0, 0, { 0 }, { 0 }, { 0 } };
5240 __Pyx_memviewslice __pyx_v_g_camids = { 0, 0, { 0 }, { 0 }, { 0 } };
5241 long __pyx_v_max_rank;
5242 int __pyx_v_use_distmat;
5243 int __pyx_lineno = 0;
5244 const char *__pyx_filename = NULL;
5245 int __pyx_clineno = 0;
5246 PyObject *__pyx_r = 0;
5247 __Pyx_RefNannyDeclarations
5248 __Pyx_RefNannySetupContext("eval_cuhk03_cy (wrapper)", 0);
5249 {
5250 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,&__pyx_n_s_max_rank,&__pyx_n_s_use_distmat,0};
5251 PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
5252 if (unlikely(__pyx_kwds)) {
5253 Py_ssize_t kw_args;
5254 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5255 switch (pos_args) {
5256 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5257 CYTHON_FALLTHROUGH;
5258 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5259 CYTHON_FALLTHROUGH;
5260 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5261 CYTHON_FALLTHROUGH;
5262 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5263 CYTHON_FALLTHROUGH;
5264 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5265 CYTHON_FALLTHROUGH;
5266 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5267 CYTHON_FALLTHROUGH;
5268 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5269 CYTHON_FALLTHROUGH;
5270 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5271 CYTHON_FALLTHROUGH;
5272 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5273 CYTHON_FALLTHROUGH;
5274 case 0: break;
5275 default: goto __pyx_L5_argtuple_error;
5276 }
5277 kw_args = PyDict_Size(__pyx_kwds);
5278 switch (pos_args) {
5279 case 0:
5280 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distmat)) != 0)) kw_args--;
5281 else goto __pyx_L5_argtuple_error;
5282 CYTHON_FALLTHROUGH;
5283 case 1:
5284 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_feats)) != 0)) kw_args--;
5285 else {
5286 __Pyx_RaiseArgtupleInvalid("eval_cuhk03_cy", 1, 9, 9, 1); __PYX_ERR(0, 35, __pyx_L3_error)
5287 }
5288 CYTHON_FALLTHROUGH;
5289 case 2:
5290 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_feats)) != 0)) kw_args--;
5291 else {
5292 __Pyx_RaiseArgtupleInvalid("eval_cuhk03_cy", 1, 9, 9, 2); __PYX_ERR(0, 35, __pyx_L3_error)
5293 }
5294 CYTHON_FALLTHROUGH;
5295 case 3:
5296 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_pids)) != 0)) kw_args--;
5297 else {
5298 __Pyx_RaiseArgtupleInvalid("eval_cuhk03_cy", 1, 9, 9, 3); __PYX_ERR(0, 35, __pyx_L3_error)
5299 }
5300 CYTHON_FALLTHROUGH;
5301 case 4:
5302 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_pids)) != 0)) kw_args--;
5303 else {
5304 __Pyx_RaiseArgtupleInvalid("eval_cuhk03_cy", 1, 9, 9, 4); __PYX_ERR(0, 35, __pyx_L3_error)
5305 }
5306 CYTHON_FALLTHROUGH;
5307 case 5:
5308 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_camids)) != 0)) kw_args--;
5309 else {
5310 __Pyx_RaiseArgtupleInvalid("eval_cuhk03_cy", 1, 9, 9, 5); __PYX_ERR(0, 35, __pyx_L3_error)
5311 }
5312 CYTHON_FALLTHROUGH;
5313 case 6:
5314 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_camids)) != 0)) kw_args--;
5315 else {
5316 __Pyx_RaiseArgtupleInvalid("eval_cuhk03_cy", 1, 9, 9, 6); __PYX_ERR(0, 35, __pyx_L3_error)
5317 }
5318 CYTHON_FALLTHROUGH;
5319 case 7:
5320 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_rank)) != 0)) kw_args--;
5321 else {
5322 __Pyx_RaiseArgtupleInvalid("eval_cuhk03_cy", 1, 9, 9, 7); __PYX_ERR(0, 35, __pyx_L3_error)
5323 }
5324 CYTHON_FALLTHROUGH;
5325 case 8:
5326 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_distmat)) != 0)) kw_args--;
5327 else {
5328 __Pyx_RaiseArgtupleInvalid("eval_cuhk03_cy", 1, 9, 9, 8); __PYX_ERR(0, 35, __pyx_L3_error)
5329 }
5330 }
5331 if (unlikely(kw_args > 0)) {
5332 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "eval_cuhk03_cy") < 0)) __PYX_ERR(0, 35, __pyx_L3_error)
5333 }
5334 } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
5335 goto __pyx_L5_argtuple_error;
5336 } else {
5337 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5338 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5339 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5340 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5341 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5342 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5343 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5344 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5345 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5346 }
5347 __pyx_v_distmat = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distmat.memview)) __PYX_ERR(0, 35, __pyx_L3_error)
5348 __pyx_v_q_feats = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_q_feats.memview)) __PYX_ERR(0, 35, __pyx_L3_error)
5349 __pyx_v_g_feats = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_g_feats.memview)) __PYX_ERR(0, 35, __pyx_L3_error)
5350 __pyx_v_q_pids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_q_pids.memview)) __PYX_ERR(0, 35, __pyx_L3_error)
5351 __pyx_v_g_pids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_g_pids.memview)) __PYX_ERR(0, 35, __pyx_L3_error)
5352 __pyx_v_q_camids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_q_camids.memview)) __PYX_ERR(0, 36, __pyx_L3_error)
5353 __pyx_v_g_camids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_g_camids.memview)) __PYX_ERR(0, 36, __pyx_L3_error)
5354 __pyx_v_max_rank = __Pyx_PyInt_As_long(values[7]); if (unlikely((__pyx_v_max_rank == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
5355 __pyx_v_use_distmat = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_use_distmat == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
5356 }
5357 goto __pyx_L4_argument_unpacking_done;
5358 __pyx_L5_argtuple_error:;
5359 __Pyx_RaiseArgtupleInvalid("eval_cuhk03_cy", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error)
5360 __pyx_L3_error:;
5361 __Pyx_AddTraceback("rank_cy.eval_cuhk03_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
5362 __Pyx_RefNannyFinishContext();
5363 return NULL;
5364 __pyx_L4_argument_unpacking_done:;
5365 __pyx_r = __pyx_pf_7rank_cy_2eval_cuhk03_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, __pyx_v_max_rank, __pyx_v_use_distmat);
5366
5367 /* function exit code */
5368 __Pyx_RefNannyFinishContext();
5369 return __pyx_r;
5370}
5371
5372static PyObject *__pyx_pf_7rank_cy_2eval_cuhk03_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, long __pyx_v_max_rank, int __pyx_v_use_distmat) {
5373 PyObject *__pyx_r = NULL;
5374 __Pyx_RefNannyDeclarations
5375 PyObject *__pyx_t_1 = NULL;
5376 int __pyx_lineno = 0;
5377 const char *__pyx_filename = NULL;
5378 int __pyx_clineno = 0;
5379 __Pyx_RefNannySetupContext("eval_cuhk03_cy", 0);
5380 __Pyx_XDECREF(__pyx_r);
5381 if (unlikely(!__pyx_v_distmat.memview)) { __Pyx_RaiseUnboundLocalError("distmat"); __PYX_ERR(0, 35, __pyx_L1_error) }
5382 if (unlikely(!__pyx_v_q_feats.memview)) { __Pyx_RaiseUnboundLocalError("q_feats"); __PYX_ERR(0, 35, __pyx_L1_error) }
5383 if (unlikely(!__pyx_v_g_feats.memview)) { __Pyx_RaiseUnboundLocalError("g_feats"); __PYX_ERR(0, 35, __pyx_L1_error) }
5384 if (unlikely(!__pyx_v_q_pids.memview)) { __Pyx_RaiseUnboundLocalError("q_pids"); __PYX_ERR(0, 35, __pyx_L1_error) }
5385 if (unlikely(!__pyx_v_g_pids.memview)) { __Pyx_RaiseUnboundLocalError("g_pids"); __PYX_ERR(0, 35, __pyx_L1_error) }
5386 if (unlikely(!__pyx_v_q_camids.memview)) { __Pyx_RaiseUnboundLocalError("q_camids"); __PYX_ERR(0, 35, __pyx_L1_error) }
5387 if (unlikely(!__pyx_v_g_camids.memview)) { __Pyx_RaiseUnboundLocalError("g_camids"); __PYX_ERR(0, 35, __pyx_L1_error) }
5388 __pyx_t_1 = __pyx_f_7rank_cy_eval_cuhk03_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, __pyx_v_max_rank, __pyx_v_use_distmat, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
5389 __Pyx_GOTREF(__pyx_t_1);
5390 __pyx_r = __pyx_t_1;
5391 __pyx_t_1 = 0;
5392 goto __pyx_L0;
5393
5394 /* function exit code */
5395 __pyx_L1_error:;
5396 __Pyx_XDECREF(__pyx_t_1);
5397 __Pyx_AddTraceback("rank_cy.eval_cuhk03_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
5398 __pyx_r = NULL;
5399 __pyx_L0:;
5400 __PYX_XDEC_MEMVIEW(&__pyx_v_distmat, 1);
5401 __PYX_XDEC_MEMVIEW(&__pyx_v_q_feats, 1);
5402 __PYX_XDEC_MEMVIEW(&__pyx_v_g_feats, 1);
5403 __PYX_XDEC_MEMVIEW(&__pyx_v_q_pids, 1);
5404 __PYX_XDEC_MEMVIEW(&__pyx_v_g_pids, 1);
5405 __PYX_XDEC_MEMVIEW(&__pyx_v_q_camids, 1);
5406 __PYX_XDEC_MEMVIEW(&__pyx_v_g_camids, 1);
5407 __Pyx_XGIVEREF(__pyx_r);
5408 __Pyx_RefNannyFinishContext();
5409 return __pyx_r;
5410}
5411
5412/* "rank_cy.pyx":163
5413 *
5414 *
5415 * cpdef eval_market1501_cy(float[:,:] distmat, float[:,:] q_feats, float[:,:] g_feats, long[:] q_pids, long[:]g_pids, # <<<<<<<<<<<<<<
5416 * long[:]q_camids, long[:]g_camids, long max_rank, bint use_distmat):
5417 *
5418 */
5419
5420static PyObject *__pyx_pw_7rank_cy_5eval_market1501_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5421static PyObject *__pyx_f_7rank_cy_eval_market1501_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, long __pyx_v_max_rank, int __pyx_v_use_distmat, CYTHON_UNUSED int __pyx_skip_dispatch) {
5422 long __pyx_v_num_q;
5423 long __pyx_v_num_g;
5424 long __pyx_v_dim;
5425 __Pyx_memviewslice __pyx_v_indices = { 0, 0, { 0 }, { 0 }, { 0 } };
5426 PyObject *__pyx_v_index = 0;
5427 __Pyx_memviewslice __pyx_v_matches = { 0, 0, { 0 }, { 0 }, { 0 } };
5428 __Pyx_memviewslice __pyx_v_all_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
5429 __Pyx_memviewslice __pyx_v_all_AP = { 0, 0, { 0 }, { 0 }, { 0 } };
5430 __Pyx_memviewslice __pyx_v_all_INP = { 0, 0, { 0 }, { 0 }, { 0 } };
5431 float __pyx_v_num_valid_q;
5432 long __pyx_v_valid_index;
5433 long __pyx_v_q_idx;
5434 long __pyx_v_q_pid;
5435 long __pyx_v_q_camid;
5436 long __pyx_v_g_idx;
5437 __Pyx_memviewslice __pyx_v_order = { 0, 0, { 0 }, { 0 }, { 0 } };
5438 __Pyx_memviewslice __pyx_v_raw_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
5439 __Pyx_memviewslice __pyx_v_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
5440 long __pyx_v_max_pos_idx;
5441 float __pyx_v_inp;
5442 long __pyx_v_num_g_real;
5443 long __pyx_v_rank_idx;
5444 unsigned long __pyx_v_meet_condition;
5445 float __pyx_v_num_rel;
5446 __Pyx_memviewslice __pyx_v_tmp_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
5447 float __pyx_v_tmp_cmc_sum;
5448 __Pyx_memviewslice __pyx_v_avg_cmc = { 0, 0, { 0 }, { 0 }, { 0 } };
5449 PyObject *__pyx_r = NULL;
5450 __Pyx_RefNannyDeclarations
5451 PyObject *__pyx_t_1 = NULL;
5452 PyObject *__pyx_t_2 = NULL;
5453 PyObject *__pyx_t_3 = NULL;
5454 PyObject *__pyx_t_4 = NULL;
5455 PyObject *__pyx_t_5 = NULL;
5456 PyObject *__pyx_t_6 = NULL;
5457 int __pyx_t_7;
5458 __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
5459 __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
5460 __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
5461 __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
5462 long __pyx_t_12;
5463 long __pyx_t_13;
5464 long __pyx_t_14;
5465 Py_ssize_t __pyx_t_15;
5466 long __pyx_t_16;
5467 long __pyx_t_17;
5468 long __pyx_t_18;
5469 Py_ssize_t __pyx_t_19;
5470 Py_ssize_t __pyx_t_20;
5471 int __pyx_t_21;
5472 int __pyx_t_22;
5473 int __pyx_lineno = 0;
5474 const char *__pyx_filename = NULL;
5475 int __pyx_clineno = 0;
5476 __Pyx_RefNannySetupContext("eval_market1501_cy", 0);
5477
5478 /* "rank_cy.pyx":166
5479 * long[:]q_camids, long[:]g_camids, long max_rank, bint use_distmat):
5480 *
5481 * cdef long num_q = q_feats.shape[0] # <<<<<<<<<<<<<<
5482 * cdef long num_g = g_feats.shape[0]
5483 * cdef long dim = q_feats.shape[1]
5484 */
5485 __pyx_v_num_q = (__pyx_v_q_feats.shape[0]);
5486
5487 /* "rank_cy.pyx":167
5488 *
5489 * cdef long num_q = q_feats.shape[0]
5490 * cdef long num_g = g_feats.shape[0] # <<<<<<<<<<<<<<
5491 * cdef long dim = q_feats.shape[1]
5492 *
5493 */
5494 __pyx_v_num_g = (__pyx_v_g_feats.shape[0]);
5495
5496 /* "rank_cy.pyx":168
5497 * cdef long num_q = q_feats.shape[0]
5498 * cdef long num_g = g_feats.shape[0]
5499 * cdef long dim = q_feats.shape[1] # <<<<<<<<<<<<<<
5500 *
5501 * cdef long[:,:] indices
5502 */
5503 __pyx_v_dim = (__pyx_v_q_feats.shape[1]);
5504
5505 /* "rank_cy.pyx":171
5506 *
5507 * cdef long[:,:] indices
5508 * cdef index = faiss.IndexFlatL2(dim) # <<<<<<<<<<<<<<
5509 * index.add(np.asarray(g_feats))
5510 *
5511 */
5512 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_faiss); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
5513 __Pyx_GOTREF(__pyx_t_2);
5514 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_IndexFlatL2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
5515 __Pyx_GOTREF(__pyx_t_3);
5516 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5517 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
5518 __Pyx_GOTREF(__pyx_t_2);
5519 __pyx_t_4 = NULL;
5520 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5521 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
5522 if (likely(__pyx_t_4)) {
5523 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5524 __Pyx_INCREF(__pyx_t_4);
5525 __Pyx_INCREF(function);
5526 __Pyx_DECREF_SET(__pyx_t_3, function);
5527 }
5528 }
5529 __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
5530 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5531 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5532 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
5533 __Pyx_GOTREF(__pyx_t_1);
5534 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5535 __pyx_v_index = __pyx_t_1;
5536 __pyx_t_1 = 0;
5537
5538 /* "rank_cy.pyx":172
5539 * cdef long[:,:] indices
5540 * cdef index = faiss.IndexFlatL2(dim)
5541 * index.add(np.asarray(g_feats)) # <<<<<<<<<<<<<<
5542 *
5543 * if use_distmat:
5544 */
5545 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error)
5546 __Pyx_GOTREF(__pyx_t_3);
5547 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L1_error)
5548 __Pyx_GOTREF(__pyx_t_4);
5549 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __pyx_L1_error)
5550 __Pyx_GOTREF(__pyx_t_5);
5551 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5552 __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, 172, __pyx_L1_error)
5553 __Pyx_GOTREF(__pyx_t_4);
5554 __pyx_t_6 = NULL;
5555 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5556 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
5557 if (likely(__pyx_t_6)) {
5558 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5559 __Pyx_INCREF(__pyx_t_6);
5560 __Pyx_INCREF(function);
5561 __Pyx_DECREF_SET(__pyx_t_5, function);
5562 }
5563 }
5564 __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
5565 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5566 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5567 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
5568 __Pyx_GOTREF(__pyx_t_2);
5569 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5570 __pyx_t_5 = NULL;
5571 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
5572 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
5573 if (likely(__pyx_t_5)) {
5574 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5575 __Pyx_INCREF(__pyx_t_5);
5576 __Pyx_INCREF(function);
5577 __Pyx_DECREF_SET(__pyx_t_3, function);
5578 }
5579 }
5580 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
5581 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5582 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5583 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
5584 __Pyx_GOTREF(__pyx_t_1);
5585 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5586 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5587
5588 /* "rank_cy.pyx":174
5589 * index.add(np.asarray(g_feats))
5590 *
5591 * if use_distmat: # <<<<<<<<<<<<<<
5592 * indices = np.argsort(distmat, axis=1)
5593 * else:
5594 */
5595 __pyx_t_7 = (__pyx_v_use_distmat != 0);
5596 if (__pyx_t_7) {
5597
5598 /* "rank_cy.pyx":175
5599 *
5600 * if use_distmat:
5601 * indices = np.argsort(distmat, axis=1) # <<<<<<<<<<<<<<
5602 * else:
5603 * indices = index.search(np.asarray(q_feats), k=num_g)[1]
5604 */
5605 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
5606 __Pyx_GOTREF(__pyx_t_1);
5607 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_argsort); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error)
5608 __Pyx_GOTREF(__pyx_t_3);
5609 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5610 __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, 175, __pyx_L1_error)
5611 __Pyx_GOTREF(__pyx_t_1);
5612 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
5613 __Pyx_GOTREF(__pyx_t_2);
5614 __Pyx_GIVEREF(__pyx_t_1);
5615 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5616 __pyx_t_1 = 0;
5617 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
5618 __Pyx_GOTREF(__pyx_t_1);
5619 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 175, __pyx_L1_error)
5620 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error)
5621 __Pyx_GOTREF(__pyx_t_5);
5622 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5623 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5624 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5625 __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_long(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 175, __pyx_L1_error)
5626 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5627 __pyx_v_indices = __pyx_t_8;
5628 __pyx_t_8.memview = NULL;
5629 __pyx_t_8.data = NULL;
5630
5631 /* "rank_cy.pyx":174
5632 * index.add(np.asarray(g_feats))
5633 *
5634 * if use_distmat: # <<<<<<<<<<<<<<
5635 * indices = np.argsort(distmat, axis=1)
5636 * else:
5637 */
5638 goto __pyx_L3;
5639 }
5640
5641 /* "rank_cy.pyx":177
5642 * indices = np.argsort(distmat, axis=1)
5643 * else:
5644 * indices = index.search(np.asarray(q_feats), k=num_g)[1] # <<<<<<<<<<<<<<
5645 *
5646 * if num_g < max_rank:
5647 */
5648 /*else*/ {
5649 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_search); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error)
5650 __Pyx_GOTREF(__pyx_t_5);
5651 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
5652 __Pyx_GOTREF(__pyx_t_2);
5653 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error)
5654 __Pyx_GOTREF(__pyx_t_3);
5655 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5656 __pyx_t_2 = __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_2)) __PYX_ERR(0, 177, __pyx_L1_error)
5657 __Pyx_GOTREF(__pyx_t_2);
5658 __pyx_t_4 = NULL;
5659 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5660 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
5661 if (likely(__pyx_t_4)) {
5662 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5663 __Pyx_INCREF(__pyx_t_4);
5664 __Pyx_INCREF(function);
5665 __Pyx_DECREF_SET(__pyx_t_3, function);
5666 }
5667 }
5668 __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
5669 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5670 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5671 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
5672 __Pyx_GOTREF(__pyx_t_1);
5673 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5674 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error)
5675 __Pyx_GOTREF(__pyx_t_3);
5676 __Pyx_GIVEREF(__pyx_t_1);
5677 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
5678 __pyx_t_1 = 0;
5679 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
5680 __Pyx_GOTREF(__pyx_t_1);
5681 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
5682 __Pyx_GOTREF(__pyx_t_2);
5683 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_k, __pyx_t_2) < 0) __PYX_ERR(0, 177, __pyx_L1_error)
5684 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5685 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
5686 __Pyx_GOTREF(__pyx_t_2);
5687 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5688 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5689 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5690 __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
5691 __Pyx_GOTREF(__pyx_t_1);
5692 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5693 __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 177, __pyx_L1_error)
5694 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5695 __pyx_v_indices = __pyx_t_8;
5696 __pyx_t_8.memview = NULL;
5697 __pyx_t_8.data = NULL;
5698 }
5699 __pyx_L3:;
5700
5701 /* "rank_cy.pyx":179
5702 * indices = index.search(np.asarray(q_feats), k=num_g)[1]
5703 *
5704 * if num_g < max_rank: # <<<<<<<<<<<<<<
5705 * max_rank = num_g
5706 * print('Note: number of gallery samples is quite small, got {}'.format(num_g))
5707 */
5708 __pyx_t_7 = ((__pyx_v_num_g < __pyx_v_max_rank) != 0);
5709 if (__pyx_t_7) {
5710
5711 /* "rank_cy.pyx":180
5712 *
5713 * if num_g < max_rank:
5714 * max_rank = num_g # <<<<<<<<<<<<<<
5715 * print('Note: number of gallery samples is quite small, got {}'.format(num_g))
5716 *
5717 */
5718 __pyx_v_max_rank = __pyx_v_num_g;
5719
5720 /* "rank_cy.pyx":181
5721 * if num_g < max_rank:
5722 * max_rank = num_g
5723 * print('Note: number of gallery samples is quite small, got {}'.format(num_g)) # <<<<<<<<<<<<<<
5724 *
5725 * cdef:
5726 */
5727 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Note_number_of_gallery_samples_i, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
5728 __Pyx_GOTREF(__pyx_t_2);
5729 __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
5730 __Pyx_GOTREF(__pyx_t_3);
5731 __pyx_t_5 = NULL;
5732 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5733 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
5734 if (likely(__pyx_t_5)) {
5735 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5736 __Pyx_INCREF(__pyx_t_5);
5737 __Pyx_INCREF(function);
5738 __Pyx_DECREF_SET(__pyx_t_2, function);
5739 }
5740 }
5741 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
5742 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5743 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5744 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
5745 __Pyx_GOTREF(__pyx_t_1);
5746 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5747 if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
5748 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5749
5750 /* "rank_cy.pyx":179
5751 * indices = index.search(np.asarray(q_feats), k=num_g)[1]
5752 *
5753 * if num_g < max_rank: # <<<<<<<<<<<<<<
5754 * max_rank = num_g
5755 * print('Note: number of gallery samples is quite small, got {}'.format(num_g))
5756 */
5757 }
5758
5759 /* "rank_cy.pyx":184
5760 *
5761 * cdef:
5762 * long[:,:] matches = (np.asarray(g_pids)[np.asarray(indices)] == np.asarray(q_pids)[:, np.newaxis]).astype(np.int64) # <<<<<<<<<<<<<<
5763 *
5764 * float[:,:] all_cmc = np.zeros((num_q, max_rank), dtype=np.float32)
5765 */
5766 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5767 __Pyx_GOTREF(__pyx_t_3);
5768 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error)
5769 __Pyx_GOTREF(__pyx_t_5);
5770 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5771 __pyx_t_3 = __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_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5772 __Pyx_GOTREF(__pyx_t_3);
5773 __pyx_t_4 = NULL;
5774 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5775 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
5776 if (likely(__pyx_t_4)) {
5777 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5778 __Pyx_INCREF(__pyx_t_4);
5779 __Pyx_INCREF(function);
5780 __Pyx_DECREF_SET(__pyx_t_5, function);
5781 }
5782 }
5783 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
5784 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5785 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5786 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
5787 __Pyx_GOTREF(__pyx_t_2);
5788 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5789 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5790 __Pyx_GOTREF(__pyx_t_3);
5791 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
5792 __Pyx_GOTREF(__pyx_t_4);
5793 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5794 __pyx_t_3 = __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_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5795 __Pyx_GOTREF(__pyx_t_3);
5796 __pyx_t_6 = NULL;
5797 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
5798 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
5799 if (likely(__pyx_t_6)) {
5800 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5801 __Pyx_INCREF(__pyx_t_6);
5802 __Pyx_INCREF(function);
5803 __Pyx_DECREF_SET(__pyx_t_4, function);
5804 }
5805 }
5806 __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
5807 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5808 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5809 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error)
5810 __Pyx_GOTREF(__pyx_t_5);
5811 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5812 __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
5813 __Pyx_GOTREF(__pyx_t_4);
5814 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5815 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5816 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
5817 __Pyx_GOTREF(__pyx_t_2);
5818 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5819 __Pyx_GOTREF(__pyx_t_3);
5820 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5821 __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, 184, __pyx_L1_error)
5822 __Pyx_GOTREF(__pyx_t_2);
5823 __pyx_t_6 = NULL;
5824 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5825 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
5826 if (likely(__pyx_t_6)) {
5827 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5828 __Pyx_INCREF(__pyx_t_6);
5829 __Pyx_INCREF(function);
5830 __Pyx_DECREF_SET(__pyx_t_3, function);
5831 }
5832 }
5833 __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
5834 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5835 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5836 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error)
5837 __Pyx_GOTREF(__pyx_t_5);
5838 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5839 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5840 __Pyx_GOTREF(__pyx_t_3);
5841 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_newaxis); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
5842 __Pyx_GOTREF(__pyx_t_2);
5843 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5844 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5845 __Pyx_GOTREF(__pyx_t_3);
5846 __Pyx_INCREF(__pyx_slice_);
5847 __Pyx_GIVEREF(__pyx_slice_);
5848 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice_);
5849 __Pyx_GIVEREF(__pyx_t_2);
5850 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
5851 __pyx_t_2 = 0;
5852 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
5853 __Pyx_GOTREF(__pyx_t_2);
5854 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5855 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5856 __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5857 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5858 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5859 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
5860 __Pyx_GOTREF(__pyx_t_2);
5861 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5862 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
5863 __Pyx_GOTREF(__pyx_t_3);
5864 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
5865 __Pyx_GOTREF(__pyx_t_4);
5866 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5867 __pyx_t_3 = NULL;
5868 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5869 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5870 if (likely(__pyx_t_3)) {
5871 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5872 __Pyx_INCREF(__pyx_t_3);
5873 __Pyx_INCREF(function);
5874 __Pyx_DECREF_SET(__pyx_t_2, function);
5875 }
5876 }
5877 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
5878 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5879 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5880 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error)
5881 __Pyx_GOTREF(__pyx_t_1);
5882 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5883 __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_long(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 184, __pyx_L1_error)
5884 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5885 __pyx_v_matches = __pyx_t_8;
5886 __pyx_t_8.memview = NULL;
5887 __pyx_t_8.data = NULL;
5888
5889 /* "rank_cy.pyx":186
5890 * long[:,:] matches = (np.asarray(g_pids)[np.asarray(indices)] == np.asarray(q_pids)[:, np.newaxis]).astype(np.int64)
5891 *
5892 * float[:,:] all_cmc = np.zeros((num_q, max_rank), dtype=np.float32) # <<<<<<<<<<<<<<
5893 * float[:] all_AP = np.zeros(num_q, dtype=np.float32)
5894 * float[:] all_INP = np.zeros(num_q, dtype=np.float32)
5895 */
5896 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
5897 __Pyx_GOTREF(__pyx_t_1);
5898 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
5899 __Pyx_GOTREF(__pyx_t_2);
5900 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5901 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_num_q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
5902 __Pyx_GOTREF(__pyx_t_1);
5903 __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_max_rank); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error)
5904 __Pyx_GOTREF(__pyx_t_4);
5905 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
5906 __Pyx_GOTREF(__pyx_t_3);
5907 __Pyx_GIVEREF(__pyx_t_1);
5908 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
5909 __Pyx_GIVEREF(__pyx_t_4);
5910 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
5911 __pyx_t_1 = 0;
5912 __pyx_t_4 = 0;
5913 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error)
5914 __Pyx_GOTREF(__pyx_t_4);
5915 __Pyx_GIVEREF(__pyx_t_3);
5916 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
5917 __pyx_t_3 = 0;
5918 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)
5919 __Pyx_GOTREF(__pyx_t_3);
5920 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
5921 __Pyx_GOTREF(__pyx_t_1);
5922 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 186, __pyx_L1_error)
5923 __Pyx_GOTREF(__pyx_t_5);
5924 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5925 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
5926 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5927 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 186, __pyx_L1_error)
5928 __Pyx_GOTREF(__pyx_t_5);
5929 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5930 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5931 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5932 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 186, __pyx_L1_error)
5933 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5934 __pyx_v_all_cmc = __pyx_t_9;
5935 __pyx_t_9.memview = NULL;
5936 __pyx_t_9.data = NULL;
5937
5938 /* "rank_cy.pyx":187
5939 *
5940 * float[:,:] all_cmc = np.zeros((num_q, max_rank), dtype=np.float32)
5941 * float[:] all_AP = np.zeros(num_q, dtype=np.float32) # <<<<<<<<<<<<<<
5942 * float[:] all_INP = np.zeros(num_q, dtype=np.float32)
5943 * float num_valid_q = 0. # number of valid query
5944 */
5945 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
5946 __Pyx_GOTREF(__pyx_t_5);
5947 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error)
5948 __Pyx_GOTREF(__pyx_t_3);
5949 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5950 __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_num_q); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
5951 __Pyx_GOTREF(__pyx_t_5);
5952 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error)
5953 __Pyx_GOTREF(__pyx_t_4);
5954 __Pyx_GIVEREF(__pyx_t_5);
5955 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
5956 __pyx_t_5 = 0;
5957 __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
5958 __Pyx_GOTREF(__pyx_t_5);
5959 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error)
5960 __Pyx_GOTREF(__pyx_t_2);
5961 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error)
5962 __Pyx_GOTREF(__pyx_t_1);
5963 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5964 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 187, __pyx_L1_error)
5965 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5966 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error)
5967 __Pyx_GOTREF(__pyx_t_1);
5968 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5969 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5970 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5971 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 187, __pyx_L1_error)
5972 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5973 __pyx_v_all_AP = __pyx_t_10;
5974 __pyx_t_10.memview = NULL;
5975 __pyx_t_10.data = NULL;
5976
5977 /* "rank_cy.pyx":188
5978 * float[:,:] all_cmc = np.zeros((num_q, max_rank), dtype=np.float32)
5979 * float[:] all_AP = np.zeros(num_q, dtype=np.float32)
5980 * float[:] all_INP = np.zeros(num_q, dtype=np.float32) # <<<<<<<<<<<<<<
5981 * float num_valid_q = 0. # number of valid query
5982 * long valid_index = 0
5983 */
5984 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
5985 __Pyx_GOTREF(__pyx_t_1);
5986 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 188, __pyx_L1_error)
5987 __Pyx_GOTREF(__pyx_t_5);
5988 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5989 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_num_q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
5990 __Pyx_GOTREF(__pyx_t_1);
5991 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 188, __pyx_L1_error)
5992 __Pyx_GOTREF(__pyx_t_4);
5993 __Pyx_GIVEREF(__pyx_t_1);
5994 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
5995 __pyx_t_1 = 0;
5996 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
5997 __Pyx_GOTREF(__pyx_t_1);
5998 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 188, __pyx_L1_error)
5999 __Pyx_GOTREF(__pyx_t_3);
6000 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error)
6001 __Pyx_GOTREF(__pyx_t_2);
6002 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6003 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 188, __pyx_L1_error)
6004 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6005 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error)
6006 __Pyx_GOTREF(__pyx_t_2);
6007 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6008 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6009 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6010 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 188, __pyx_L1_error)
6011 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6012 __pyx_v_all_INP = __pyx_t_10;
6013 __pyx_t_10.memview = NULL;
6014 __pyx_t_10.data = NULL;
6015
6016 /* "rank_cy.pyx":189
6017 * float[:] all_AP = np.zeros(num_q, dtype=np.float32)
6018 * float[:] all_INP = np.zeros(num_q, dtype=np.float32)
6019 * float num_valid_q = 0. # number of valid query # <<<<<<<<<<<<<<
6020 * long valid_index = 0
6021 *
6022 */
6023 __pyx_v_num_valid_q = 0.;
6024
6025 /* "rank_cy.pyx":190
6026 * float[:] all_INP = np.zeros(num_q, dtype=np.float32)
6027 * float num_valid_q = 0. # number of valid query
6028 * long valid_index = 0 # <<<<<<<<<<<<<<
6029 *
6030 * long q_idx, q_pid, q_camid, g_idx
6031 */
6032 __pyx_v_valid_index = 0;
6033
6034 /* "rank_cy.pyx":193
6035 *
6036 * long q_idx, q_pid, q_camid, g_idx
6037 * long[:] order = np.zeros(num_g, dtype=np.int64) # <<<<<<<<<<<<<<
6038 * long keep
6039 *
6040 */
6041 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
6042 __Pyx_GOTREF(__pyx_t_2);
6043 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error)
6044 __Pyx_GOTREF(__pyx_t_1);
6045 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6046 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
6047 __Pyx_GOTREF(__pyx_t_2);
6048 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error)
6049 __Pyx_GOTREF(__pyx_t_4);
6050 __Pyx_GIVEREF(__pyx_t_2);
6051 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
6052 __pyx_t_2 = 0;
6053 __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
6054 __Pyx_GOTREF(__pyx_t_2);
6055 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error)
6056 __Pyx_GOTREF(__pyx_t_5);
6057 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error)
6058 __Pyx_GOTREF(__pyx_t_3);
6059 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6060 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 193, __pyx_L1_error)
6061 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6062 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error)
6063 __Pyx_GOTREF(__pyx_t_3);
6064 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6065 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6066 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6067 __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_long(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 193, __pyx_L1_error)
6068 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6069 __pyx_v_order = __pyx_t_11;
6070 __pyx_t_11.memview = NULL;
6071 __pyx_t_11.data = NULL;
6072
6073 /* "rank_cy.pyx":196
6074 * long keep
6075 *
6076 * float[:] raw_cmc = np.zeros(num_g, dtype=np.float32) # binary vector, positions with value 1 are correct matches # <<<<<<<<<<<<<<
6077 * float[:] cmc = np.zeros(num_g, dtype=np.float32)
6078 * long max_pos_idx = 0
6079 */
6080 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error)
6081 __Pyx_GOTREF(__pyx_t_3);
6082 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
6083 __Pyx_GOTREF(__pyx_t_2);
6084 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6085 __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error)
6086 __Pyx_GOTREF(__pyx_t_3);
6087 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
6088 __Pyx_GOTREF(__pyx_t_4);
6089 __Pyx_GIVEREF(__pyx_t_3);
6090 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
6091 __pyx_t_3 = 0;
6092 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error)
6093 __Pyx_GOTREF(__pyx_t_3);
6094 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error)
6095 __Pyx_GOTREF(__pyx_t_1);
6096 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error)
6097 __Pyx_GOTREF(__pyx_t_5);
6098 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6099 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 196, __pyx_L1_error)
6100 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6101 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error)
6102 __Pyx_GOTREF(__pyx_t_5);
6103 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6104 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6105 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6106 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 196, __pyx_L1_error)
6107 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6108 __pyx_v_raw_cmc = __pyx_t_10;
6109 __pyx_t_10.memview = NULL;
6110 __pyx_t_10.data = NULL;
6111
6112 /* "rank_cy.pyx":197
6113 *
6114 * float[:] raw_cmc = np.zeros(num_g, dtype=np.float32) # binary vector, positions with value 1 are correct matches
6115 * float[:] cmc = np.zeros(num_g, dtype=np.float32) # <<<<<<<<<<<<<<
6116 * long max_pos_idx = 0
6117 * float inp
6118 */
6119 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error)
6120 __Pyx_GOTREF(__pyx_t_5);
6121 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error)
6122 __Pyx_GOTREF(__pyx_t_3);
6123 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6124 __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error)
6125 __Pyx_GOTREF(__pyx_t_5);
6126 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error)
6127 __Pyx_GOTREF(__pyx_t_4);
6128 __Pyx_GIVEREF(__pyx_t_5);
6129 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
6130 __pyx_t_5 = 0;
6131 __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 197, __pyx_L1_error)
6132 __Pyx_GOTREF(__pyx_t_5);
6133 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error)
6134 __Pyx_GOTREF(__pyx_t_2);
6135 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
6136 __Pyx_GOTREF(__pyx_t_1);
6137 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6138 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 197, __pyx_L1_error)
6139 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6140 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
6141 __Pyx_GOTREF(__pyx_t_1);
6142 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6143 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6144 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6145 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 197, __pyx_L1_error)
6146 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6147 __pyx_v_cmc = __pyx_t_10;
6148 __pyx_t_10.memview = NULL;
6149 __pyx_t_10.data = NULL;
6150
6151 /* "rank_cy.pyx":198
6152 * float[:] raw_cmc = np.zeros(num_g, dtype=np.float32) # binary vector, positions with value 1 are correct matches
6153 * float[:] cmc = np.zeros(num_g, dtype=np.float32)
6154 * long max_pos_idx = 0 # <<<<<<<<<<<<<<
6155 * float inp
6156 * long num_g_real, rank_idx
6157 */
6158 __pyx_v_max_pos_idx = 0;
6159
6160 /* "rank_cy.pyx":204
6161 *
6162 * float num_rel
6163 * float[:] tmp_cmc = np.zeros(num_g, dtype=np.float32) # <<<<<<<<<<<<<<
6164 * float tmp_cmc_sum
6165 *
6166 */
6167 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
6168 __Pyx_GOTREF(__pyx_t_1);
6169 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error)
6170 __Pyx_GOTREF(__pyx_t_5);
6171 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6172 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_num_g); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
6173 __Pyx_GOTREF(__pyx_t_1);
6174 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error)
6175 __Pyx_GOTREF(__pyx_t_4);
6176 __Pyx_GIVEREF(__pyx_t_1);
6177 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
6178 __pyx_t_1 = 0;
6179 __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
6180 __Pyx_GOTREF(__pyx_t_1);
6181 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error)
6182 __Pyx_GOTREF(__pyx_t_3);
6183 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
6184 __Pyx_GOTREF(__pyx_t_2);
6185 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6186 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 204, __pyx_L1_error)
6187 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6188 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
6189 __Pyx_GOTREF(__pyx_t_2);
6190 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6191 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6192 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6193 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 204, __pyx_L1_error)
6194 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6195 __pyx_v_tmp_cmc = __pyx_t_10;
6196 __pyx_t_10.memview = NULL;
6197 __pyx_t_10.data = NULL;
6198
6199 /* "rank_cy.pyx":208
6200 *
6201 *
6202 * for q_idx in range(num_q): # <<<<<<<<<<<<<<
6203 * # get query pid and camid
6204 * q_pid = q_pids[q_idx]
6205 */
6206 __pyx_t_12 = __pyx_v_num_q;
6207 __pyx_t_13 = __pyx_t_12;
6208 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
6209 __pyx_v_q_idx = __pyx_t_14;
6210
6211 /* "rank_cy.pyx":210
6212 * for q_idx in range(num_q):
6213 * # get query pid and camid
6214 * q_pid = q_pids[q_idx] # <<<<<<<<<<<<<<
6215 * q_camid = q_camids[q_idx]
6216 *
6217 */
6218 __pyx_t_15 = __pyx_v_q_idx;
6219 __pyx_v_q_pid = (*((long *) ( /* dim=0 */ (__pyx_v_q_pids.data + __pyx_t_15 * __pyx_v_q_pids.strides[0]) )));
6220
6221 /* "rank_cy.pyx":211
6222 * # get query pid and camid
6223 * q_pid = q_pids[q_idx]
6224 * q_camid = q_camids[q_idx] # <<<<<<<<<<<<<<
6225 *
6226 * for g_idx in range(num_g):
6227 */
6228 __pyx_t_15 = __pyx_v_q_idx;
6229 __pyx_v_q_camid = (*((long *) ( /* dim=0 */ (__pyx_v_q_camids.data + __pyx_t_15 * __pyx_v_q_camids.strides[0]) )));
6230
6231 /* "rank_cy.pyx":213
6232 * q_camid = q_camids[q_idx]
6233 *
6234 * for g_idx in range(num_g): # <<<<<<<<<<<<<<
6235 * order[g_idx] = indices[q_idx, g_idx]
6236 * num_g_real = 0
6237 */
6238 __pyx_t_16 = __pyx_v_num_g;
6239 __pyx_t_17 = __pyx_t_16;
6240 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
6241 __pyx_v_g_idx = __pyx_t_18;
6242
6243 /* "rank_cy.pyx":214
6244 *
6245 * for g_idx in range(num_g):
6246 * order[g_idx] = indices[q_idx, g_idx] # <<<<<<<<<<<<<<
6247 * num_g_real = 0
6248 * meet_condition = 0
6249 */
6250 __pyx_t_15 = __pyx_v_q_idx;
6251 __pyx_t_19 = __pyx_v_g_idx;
6252 __pyx_t_20 = __pyx_v_g_idx;
6253 *((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_20 * __pyx_v_order.strides[0]) )) = (*((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_15 * __pyx_v_indices.strides[0]) ) + __pyx_t_19 * __pyx_v_indices.strides[1]) )));
6254 }
6255
6256 /* "rank_cy.pyx":215
6257 * for g_idx in range(num_g):
6258 * order[g_idx] = indices[q_idx, g_idx]
6259 * num_g_real = 0 # <<<<<<<<<<<<<<
6260 * meet_condition = 0
6261 *
6262 */
6263 __pyx_v_num_g_real = 0;
6264
6265 /* "rank_cy.pyx":216
6266 * order[g_idx] = indices[q_idx, g_idx]
6267 * num_g_real = 0
6268 * meet_condition = 0 # <<<<<<<<<<<<<<
6269 *
6270 * # remove gallery samples that have the same pid and camid with query
6271 */
6272 __pyx_v_meet_condition = 0;
6273
6274 /* "rank_cy.pyx":219
6275 *
6276 * # remove gallery samples that have the same pid and camid with query
6277 * for g_idx in range(num_g): # <<<<<<<<<<<<<<
6278 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid):
6279 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
6280 */
6281 __pyx_t_16 = __pyx_v_num_g;
6282 __pyx_t_17 = __pyx_t_16;
6283 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
6284 __pyx_v_g_idx = __pyx_t_18;
6285
6286 /* "rank_cy.pyx":220
6287 * # remove gallery samples that have the same pid and camid with query
6288 * for g_idx in range(num_g):
6289 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid): # <<<<<<<<<<<<<<
6290 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
6291 * num_g_real += 1
6292 */
6293 __pyx_t_19 = __pyx_v_g_idx;
6294 __pyx_t_15 = (*((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_19 * __pyx_v_order.strides[0]) )));
6295 __pyx_t_21 = (((*((long *) ( /* dim=0 */ (__pyx_v_g_pids.data + __pyx_t_15 * __pyx_v_g_pids.strides[0]) ))) != __pyx_v_q_pid) != 0);
6296 if (!__pyx_t_21) {
6297 } else {
6298 __pyx_t_7 = __pyx_t_21;
6299 goto __pyx_L12_bool_binop_done;
6300 }
6301 __pyx_t_19 = __pyx_v_g_idx;
6302 __pyx_t_15 = (*((long *) ( /* dim=0 */ (__pyx_v_order.data + __pyx_t_19 * __pyx_v_order.strides[0]) )));
6303 __pyx_t_21 = (((*((long *) ( /* dim=0 */ (__pyx_v_g_camids.data + __pyx_t_15 * __pyx_v_g_camids.strides[0]) ))) != __pyx_v_q_camid) != 0);
6304 __pyx_t_7 = __pyx_t_21;
6305 __pyx_L12_bool_binop_done:;
6306 if (__pyx_t_7) {
6307
6308 /* "rank_cy.pyx":221
6309 * for g_idx in range(num_g):
6310 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid):
6311 * raw_cmc[num_g_real] = matches[q_idx][g_idx] # <<<<<<<<<<<<<<
6312 * num_g_real += 1
6313 * # this condition is true if query appear in gallery
6314 */
6315 __pyx_t_19 = __pyx_v_q_idx;
6316 __pyx_t_15 = __pyx_v_g_idx;
6317 __pyx_t_20 = __pyx_v_num_g_real;
6318 *((float *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_20 * __pyx_v_raw_cmc.strides[0]) )) = (*((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_matches.data + __pyx_t_19 * __pyx_v_matches.strides[0]) ) + __pyx_t_15 * __pyx_v_matches.strides[1]) )));
6319
6320 /* "rank_cy.pyx":222
6321 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid):
6322 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
6323 * num_g_real += 1 # <<<<<<<<<<<<<<
6324 * # this condition is true if query appear in gallery
6325 * if matches[q_idx][g_idx] > 1e-31:
6326 */
6327 __pyx_v_num_g_real = (__pyx_v_num_g_real + 1);
6328
6329 /* "rank_cy.pyx":224
6330 * num_g_real += 1
6331 * # this condition is true if query appear in gallery
6332 * if matches[q_idx][g_idx] > 1e-31: # <<<<<<<<<<<<<<
6333 * meet_condition = 1
6334 *
6335 */
6336 __pyx_t_15 = __pyx_v_q_idx;
6337 __pyx_t_19 = __pyx_v_g_idx;
6338 __pyx_t_7 = (((*((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_matches.data + __pyx_t_15 * __pyx_v_matches.strides[0]) ) + __pyx_t_19 * __pyx_v_matches.strides[1]) ))) > 1e-31) != 0);
6339 if (__pyx_t_7) {
6340
6341 /* "rank_cy.pyx":225
6342 * # this condition is true if query appear in gallery
6343 * if matches[q_idx][g_idx] > 1e-31:
6344 * meet_condition = 1 # <<<<<<<<<<<<<<
6345 *
6346 * if not meet_condition:
6347 */
6348 __pyx_v_meet_condition = 1;
6349
6350 /* "rank_cy.pyx":224
6351 * num_g_real += 1
6352 * # this condition is true if query appear in gallery
6353 * if matches[q_idx][g_idx] > 1e-31: # <<<<<<<<<<<<<<
6354 * meet_condition = 1
6355 *
6356 */
6357 }
6358
6359 /* "rank_cy.pyx":220
6360 * # remove gallery samples that have the same pid and camid with query
6361 * for g_idx in range(num_g):
6362 * if (g_pids[order[g_idx]] != q_pid) or (g_camids[order[g_idx]] != q_camid): # <<<<<<<<<<<<<<
6363 * raw_cmc[num_g_real] = matches[q_idx][g_idx]
6364 * num_g_real += 1
6365 */
6366 }
6367 }
6368
6369 /* "rank_cy.pyx":227
6370 * meet_condition = 1
6371 *
6372 * if not meet_condition: # <<<<<<<<<<<<<<
6373 * # this condition is true when query identity does not appear in gallery
6374 * continue
6375 */
6376 __pyx_t_7 = ((!(__pyx_v_meet_condition != 0)) != 0);
6377 if (__pyx_t_7) {
6378
6379 /* "rank_cy.pyx":229
6380 * if not meet_condition:
6381 * # this condition is true when query identity does not appear in gallery
6382 * continue # <<<<<<<<<<<<<<
6383 *
6384 * # compute cmc
6385 */
6386 goto __pyx_L5_continue;
6387
6388 /* "rank_cy.pyx":227
6389 * meet_condition = 1
6390 *
6391 * if not meet_condition: # <<<<<<<<<<<<<<
6392 * # this condition is true when query identity does not appear in gallery
6393 * continue
6394 */
6395 }
6396
6397 /* "rank_cy.pyx":232
6398 *
6399 * # compute cmc
6400 * function_cumsum(raw_cmc, cmc, num_g_real) # <<<<<<<<<<<<<<
6401 * # compute mean inverse negative penalty
6402 * # reference : https://github.com/mangye16/ReID-Survey/blob/master/utils/reid_metric.py
6403 */
6404 __pyx_fuse_3__pyx_f_7rank_cy_function_cumsum(__pyx_v_raw_cmc, __pyx_v_cmc, __pyx_v_num_g_real);
6405
6406 /* "rank_cy.pyx":235
6407 * # compute mean inverse negative penalty
6408 * # reference : https://github.com/mangye16/ReID-Survey/blob/master/utils/reid_metric.py
6409 * max_pos_idx = 0 # <<<<<<<<<<<<<<
6410 * for g_idx in range(num_g_real):
6411 * if (raw_cmc[g_idx] == 1) and (g_idx > max_pos_idx):
6412 */
6413 __pyx_v_max_pos_idx = 0;
6414
6415 /* "rank_cy.pyx":236
6416 * # reference : https://github.com/mangye16/ReID-Survey/blob/master/utils/reid_metric.py
6417 * max_pos_idx = 0
6418 * for g_idx in range(num_g_real): # <<<<<<<<<<<<<<
6419 * if (raw_cmc[g_idx] == 1) and (g_idx > max_pos_idx):
6420 * max_pos_idx = g_idx
6421 */
6422 __pyx_t_16 = __pyx_v_num_g_real;
6423 __pyx_t_17 = __pyx_t_16;
6424 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
6425 __pyx_v_g_idx = __pyx_t_18;
6426
6427 /* "rank_cy.pyx":237
6428 * max_pos_idx = 0
6429 * for g_idx in range(num_g_real):
6430 * if (raw_cmc[g_idx] == 1) and (g_idx > max_pos_idx): # <<<<<<<<<<<<<<
6431 * max_pos_idx = g_idx
6432 * inp = cmc[max_pos_idx] / (max_pos_idx + 1.0)
6433 */
6434 __pyx_t_19 = __pyx_v_g_idx;
6435 __pyx_t_21 = (((*((float *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_19 * __pyx_v_raw_cmc.strides[0]) ))) == 1.0) != 0);
6436 if (__pyx_t_21) {
6437 } else {
6438 __pyx_t_7 = __pyx_t_21;
6439 goto __pyx_L19_bool_binop_done;
6440 }
6441 __pyx_t_21 = ((__pyx_v_g_idx > __pyx_v_max_pos_idx) != 0);
6442 __pyx_t_7 = __pyx_t_21;
6443 __pyx_L19_bool_binop_done:;
6444 if (__pyx_t_7) {
6445
6446 /* "rank_cy.pyx":238
6447 * for g_idx in range(num_g_real):
6448 * if (raw_cmc[g_idx] == 1) and (g_idx > max_pos_idx):
6449 * max_pos_idx = g_idx # <<<<<<<<<<<<<<
6450 * inp = cmc[max_pos_idx] / (max_pos_idx + 1.0)
6451 * all_INP[valid_index] = inp
6452 */
6453 __pyx_v_max_pos_idx = __pyx_v_g_idx;
6454
6455 /* "rank_cy.pyx":237
6456 * max_pos_idx = 0
6457 * for g_idx in range(num_g_real):
6458 * if (raw_cmc[g_idx] == 1) and (g_idx > max_pos_idx): # <<<<<<<<<<<<<<
6459 * max_pos_idx = g_idx
6460 * inp = cmc[max_pos_idx] / (max_pos_idx + 1.0)
6461 */
6462 }
6463 }
6464
6465 /* "rank_cy.pyx":239
6466 * if (raw_cmc[g_idx] == 1) and (g_idx > max_pos_idx):
6467 * max_pos_idx = g_idx
6468 * inp = cmc[max_pos_idx] / (max_pos_idx + 1.0) # <<<<<<<<<<<<<<
6469 * all_INP[valid_index] = inp
6470 *
6471 */
6472 __pyx_t_19 = __pyx_v_max_pos_idx;
6473 __pyx_v_inp = ((*((float *) ( /* dim=0 */ (__pyx_v_cmc.data + __pyx_t_19 * __pyx_v_cmc.strides[0]) ))) / (__pyx_v_max_pos_idx + 1.0));
6474
6475 /* "rank_cy.pyx":240
6476 * max_pos_idx = g_idx
6477 * inp = cmc[max_pos_idx] / (max_pos_idx + 1.0)
6478 * all_INP[valid_index] = inp # <<<<<<<<<<<<<<
6479 *
6480 * for g_idx in range(num_g_real):
6481 */
6482 __pyx_t_19 = __pyx_v_valid_index;
6483 *((float *) ( /* dim=0 */ (__pyx_v_all_INP.data + __pyx_t_19 * __pyx_v_all_INP.strides[0]) )) = __pyx_v_inp;
6484
6485 /* "rank_cy.pyx":242
6486 * all_INP[valid_index] = inp
6487 *
6488 * for g_idx in range(num_g_real): # <<<<<<<<<<<<<<
6489 * if cmc[g_idx] > 1:
6490 * cmc[g_idx] = 1
6491 */
6492 __pyx_t_16 = __pyx_v_num_g_real;
6493 __pyx_t_17 = __pyx_t_16;
6494 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
6495 __pyx_v_g_idx = __pyx_t_18;
6496
6497 /* "rank_cy.pyx":243
6498 *
6499 * for g_idx in range(num_g_real):
6500 * if cmc[g_idx] > 1: # <<<<<<<<<<<<<<
6501 * cmc[g_idx] = 1
6502 *
6503 */
6504 __pyx_t_19 = __pyx_v_g_idx;
6505 __pyx_t_7 = (((*((float *) ( /* dim=0 */ (__pyx_v_cmc.data + __pyx_t_19 * __pyx_v_cmc.strides[0]) ))) > 1.0) != 0);
6506 if (__pyx_t_7) {
6507
6508 /* "rank_cy.pyx":244
6509 * for g_idx in range(num_g_real):
6510 * if cmc[g_idx] > 1:
6511 * cmc[g_idx] = 1 # <<<<<<<<<<<<<<
6512 *
6513 * for rank_idx in range(max_rank):
6514 */
6515 __pyx_t_19 = __pyx_v_g_idx;
6516 *((float *) ( /* dim=0 */ (__pyx_v_cmc.data + __pyx_t_19 * __pyx_v_cmc.strides[0]) )) = 1.0;
6517
6518 /* "rank_cy.pyx":243
6519 *
6520 * for g_idx in range(num_g_real):
6521 * if cmc[g_idx] > 1: # <<<<<<<<<<<<<<
6522 * cmc[g_idx] = 1
6523 *
6524 */
6525 }
6526 }
6527
6528 /* "rank_cy.pyx":246
6529 * cmc[g_idx] = 1
6530 *
6531 * for rank_idx in range(max_rank): # <<<<<<<<<<<<<<
6532 * all_cmc[q_idx, rank_idx] = cmc[rank_idx]
6533 * num_valid_q += 1.
6534 */
6535 __pyx_t_16 = __pyx_v_max_rank;
6536 __pyx_t_17 = __pyx_t_16;
6537 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
6538 __pyx_v_rank_idx = __pyx_t_18;
6539
6540 /* "rank_cy.pyx":247
6541 *
6542 * for rank_idx in range(max_rank):
6543 * all_cmc[q_idx, rank_idx] = cmc[rank_idx] # <<<<<<<<<<<<<<
6544 * num_valid_q += 1.
6545 *
6546 */
6547 __pyx_t_19 = __pyx_v_rank_idx;
6548 __pyx_t_15 = __pyx_v_q_idx;
6549 __pyx_t_20 = __pyx_v_rank_idx;
6550 *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_all_cmc.data + __pyx_t_15 * __pyx_v_all_cmc.strides[0]) ) + __pyx_t_20 * __pyx_v_all_cmc.strides[1]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_cmc.data + __pyx_t_19 * __pyx_v_cmc.strides[0]) )));
6551 }
6552
6553 /* "rank_cy.pyx":248
6554 * for rank_idx in range(max_rank):
6555 * all_cmc[q_idx, rank_idx] = cmc[rank_idx]
6556 * num_valid_q += 1. # <<<<<<<<<<<<<<
6557 *
6558 * # compute average precision
6559 */
6560 __pyx_v_num_valid_q = (__pyx_v_num_valid_q + 1.);
6561
6562 /* "rank_cy.pyx":252
6563 * # compute average precision
6564 * # reference: https://en.wikipedia.org/wiki/Evaluation_measures_(information_retrieval)#Average_precision
6565 * function_cumsum(raw_cmc, tmp_cmc, num_g_real) # <<<<<<<<<<<<<<
6566 * num_rel = 0
6567 * tmp_cmc_sum = 0
6568 */
6569 __pyx_fuse_3__pyx_f_7rank_cy_function_cumsum(__pyx_v_raw_cmc, __pyx_v_tmp_cmc, __pyx_v_num_g_real);
6570
6571 /* "rank_cy.pyx":253
6572 * # reference: https://en.wikipedia.org/wiki/Evaluation_measures_(information_retrieval)#Average_precision
6573 * function_cumsum(raw_cmc, tmp_cmc, num_g_real)
6574 * num_rel = 0 # <<<<<<<<<<<<<<
6575 * tmp_cmc_sum = 0
6576 * for g_idx in range(num_g_real):
6577 */
6578 __pyx_v_num_rel = 0.0;
6579
6580 /* "rank_cy.pyx":254
6581 * function_cumsum(raw_cmc, tmp_cmc, num_g_real)
6582 * num_rel = 0
6583 * tmp_cmc_sum = 0 # <<<<<<<<<<<<<<
6584 * for g_idx in range(num_g_real):
6585 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx]
6586 */
6587 __pyx_v_tmp_cmc_sum = 0.0;
6588
6589 /* "rank_cy.pyx":255
6590 * num_rel = 0
6591 * tmp_cmc_sum = 0
6592 * for g_idx in range(num_g_real): # <<<<<<<<<<<<<<
6593 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx]
6594 * num_rel += raw_cmc[g_idx]
6595 */
6596 __pyx_t_16 = __pyx_v_num_g_real;
6597 __pyx_t_17 = __pyx_t_16;
6598 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
6599 __pyx_v_g_idx = __pyx_t_18;
6600
6601 /* "rank_cy.pyx":256
6602 * tmp_cmc_sum = 0
6603 * for g_idx in range(num_g_real):
6604 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx] # <<<<<<<<<<<<<<
6605 * num_rel += raw_cmc[g_idx]
6606 * all_AP[valid_index] = tmp_cmc_sum / num_rel
6607 */
6608 __pyx_t_19 = __pyx_v_g_idx;
6609 __pyx_t_20 = __pyx_v_g_idx;
6610 __pyx_v_tmp_cmc_sum = (__pyx_v_tmp_cmc_sum + (((*((float *) ( /* dim=0 */ (__pyx_v_tmp_cmc.data + __pyx_t_19 * __pyx_v_tmp_cmc.strides[0]) ))) / (__pyx_v_g_idx + 1.)) * (*((float *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_20 * __pyx_v_raw_cmc.strides[0]) )))));
6611
6612 /* "rank_cy.pyx":257
6613 * for g_idx in range(num_g_real):
6614 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx]
6615 * num_rel += raw_cmc[g_idx] # <<<<<<<<<<<<<<
6616 * all_AP[valid_index] = tmp_cmc_sum / num_rel
6617 * valid_index += 1
6618 */
6619 __pyx_t_20 = __pyx_v_g_idx;
6620 __pyx_v_num_rel = (__pyx_v_num_rel + (*((float *) ( /* dim=0 */ (__pyx_v_raw_cmc.data + __pyx_t_20 * __pyx_v_raw_cmc.strides[0]) ))));
6621 }
6622
6623 /* "rank_cy.pyx":258
6624 * tmp_cmc_sum += (tmp_cmc[g_idx] / (g_idx + 1.)) * raw_cmc[g_idx]
6625 * num_rel += raw_cmc[g_idx]
6626 * all_AP[valid_index] = tmp_cmc_sum / num_rel # <<<<<<<<<<<<<<
6627 * valid_index += 1
6628 *
6629 */
6630 __pyx_t_20 = __pyx_v_valid_index;
6631 *((float *) ( /* dim=0 */ (__pyx_v_all_AP.data + __pyx_t_20 * __pyx_v_all_AP.strides[0]) )) = (__pyx_v_tmp_cmc_sum / __pyx_v_num_rel);
6632
6633 /* "rank_cy.pyx":259
6634 * num_rel += raw_cmc[g_idx]
6635 * all_AP[valid_index] = tmp_cmc_sum / num_rel
6636 * valid_index += 1 # <<<<<<<<<<<<<<
6637 *
6638 * assert num_valid_q > 0, 'Error: all query identities do not appear in gallery'
6639 */
6640 __pyx_v_valid_index = (__pyx_v_valid_index + 1);
6641 __pyx_L5_continue:;
6642 }
6643
6644 /* "rank_cy.pyx":261
6645 * valid_index += 1
6646 *
6647 * assert num_valid_q > 0, 'Error: all query identities do not appear in gallery' # <<<<<<<<<<<<<<
6648 *
6649 * # compute averaged cmc
6650 */
6651 #ifndef CYTHON_WITHOUT_ASSERTIONS
6652 if (unlikely(!Py_OptimizeFlag)) {
6653 if (unlikely(!((__pyx_v_num_valid_q > 0.0) != 0))) {
6654 PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Error_all_query_identities_do_no);
6655 __PYX_ERR(0, 261, __pyx_L1_error)
6656 }
6657 }
6658 #endif
6659
6660 /* "rank_cy.pyx":264
6661 *
6662 * # compute averaged cmc
6663 * cdef float[:] avg_cmc = np.zeros(max_rank, dtype=np.float32) # <<<<<<<<<<<<<<
6664 * for rank_idx in range(max_rank):
6665 * for q_idx in range(num_q):
6666 */
6667 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
6668 __Pyx_GOTREF(__pyx_t_2);
6669 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
6670 __Pyx_GOTREF(__pyx_t_1);
6671 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6672 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_max_rank); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
6673 __Pyx_GOTREF(__pyx_t_2);
6674 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
6675 __Pyx_GOTREF(__pyx_t_4);
6676 __Pyx_GIVEREF(__pyx_t_2);
6677 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
6678 __pyx_t_2 = 0;
6679 __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
6680 __Pyx_GOTREF(__pyx_t_2);
6681 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error)
6682 __Pyx_GOTREF(__pyx_t_5);
6683 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
6684 __Pyx_GOTREF(__pyx_t_3);
6685 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6686 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 264, __pyx_L1_error)
6687 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6688 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
6689 __Pyx_GOTREF(__pyx_t_3);
6690 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6691 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6692 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6693 __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 264, __pyx_L1_error)
6694 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6695 __pyx_v_avg_cmc = __pyx_t_10;
6696 __pyx_t_10.memview = NULL;
6697 __pyx_t_10.data = NULL;
6698
6699 /* "rank_cy.pyx":265
6700 * # compute averaged cmc
6701 * cdef float[:] avg_cmc = np.zeros(max_rank, dtype=np.float32)
6702 * for rank_idx in range(max_rank): # <<<<<<<<<<<<<<
6703 * for q_idx in range(num_q):
6704 * avg_cmc[rank_idx] += all_cmc[q_idx, rank_idx]
6705 */
6706 __pyx_t_12 = __pyx_v_max_rank;
6707 __pyx_t_13 = __pyx_t_12;
6708 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
6709 __pyx_v_rank_idx = __pyx_t_14;
6710
6711 /* "rank_cy.pyx":266
6712 * cdef float[:] avg_cmc = np.zeros(max_rank, dtype=np.float32)
6713 * for rank_idx in range(max_rank):
6714 * for q_idx in range(num_q): # <<<<<<<<<<<<<<
6715 * avg_cmc[rank_idx] += all_cmc[q_idx, rank_idx]
6716 * avg_cmc[rank_idx] /= num_valid_q
6717 */
6718 __pyx_t_16 = __pyx_v_num_q;
6719 __pyx_t_17 = __pyx_t_16;
6720 for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
6721 __pyx_v_q_idx = __pyx_t_18;
6722
6723 /* "rank_cy.pyx":267
6724 * for rank_idx in range(max_rank):
6725 * for q_idx in range(num_q):
6726 * avg_cmc[rank_idx] += all_cmc[q_idx, rank_idx] # <<<<<<<<<<<<<<
6727 * avg_cmc[rank_idx] /= num_valid_q
6728 *
6729 */
6730 __pyx_t_20 = __pyx_v_q_idx;
6731 __pyx_t_19 = __pyx_v_rank_idx;
6732 __pyx_t_15 = __pyx_v_rank_idx;
6733 *((float *) ( /* dim=0 */ (__pyx_v_avg_cmc.data + __pyx_t_15 * __pyx_v_avg_cmc.strides[0]) )) += (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_all_cmc.data + __pyx_t_20 * __pyx_v_all_cmc.strides[0]) ) + __pyx_t_19 * __pyx_v_all_cmc.strides[1]) )));
6734 }
6735
6736 /* "rank_cy.pyx":268
6737 * for q_idx in range(num_q):
6738 * avg_cmc[rank_idx] += all_cmc[q_idx, rank_idx]
6739 * avg_cmc[rank_idx] /= num_valid_q # <<<<<<<<<<<<<<
6740 *
6741 * return np.asarray(avg_cmc).astype(np.float32), np.asarray(all_AP[:valid_index]), np.asarray(all_INP[:valid_index])
6742 */
6743 __pyx_t_19 = __pyx_v_rank_idx;
6744 *((float *) ( /* dim=0 */ (__pyx_v_avg_cmc.data + __pyx_t_19 * __pyx_v_avg_cmc.strides[0]) )) /= __pyx_v_num_valid_q;
6745 }
6746
6747 /* "rank_cy.pyx":270
6748 * avg_cmc[rank_idx] /= num_valid_q
6749 *
6750 * return np.asarray(avg_cmc).astype(np.float32), np.asarray(all_AP[:valid_index]), np.asarray(all_INP[:valid_index]) # <<<<<<<<<<<<<<
6751 *
6752 *
6753 */
6754 __Pyx_XDECREF(__pyx_r);
6755 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error)
6756 __Pyx_GOTREF(__pyx_t_4);
6757 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
6758 __Pyx_GOTREF(__pyx_t_1);
6759 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6760 __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_avg_cmc, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error)
6761 __Pyx_GOTREF(__pyx_t_4);
6762 __pyx_t_5 = NULL;
6763 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
6764 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
6765 if (likely(__pyx_t_5)) {
6766 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6767 __Pyx_INCREF(__pyx_t_5);
6768 __Pyx_INCREF(function);
6769 __Pyx_DECREF_SET(__pyx_t_1, function);
6770 }
6771 }
6772 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
6773 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6774 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6775 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
6776 __Pyx_GOTREF(__pyx_t_2);
6777 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6778 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
6779 __Pyx_GOTREF(__pyx_t_1);
6780 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6781 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
6782 __Pyx_GOTREF(__pyx_t_2);
6783 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error)
6784 __Pyx_GOTREF(__pyx_t_4);
6785 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6786 __pyx_t_2 = NULL;
6787 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6788 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6789 if (likely(__pyx_t_2)) {
6790 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6791 __Pyx_INCREF(__pyx_t_2);
6792 __Pyx_INCREF(function);
6793 __Pyx_DECREF_SET(__pyx_t_1, function);
6794 }
6795 }
6796 __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
6797 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6798 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6799 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
6800 __Pyx_GOTREF(__pyx_t_3);
6801 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6802 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error)
6803 __Pyx_GOTREF(__pyx_t_4);
6804 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
6805 __Pyx_GOTREF(__pyx_t_2);
6806 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6807 __pyx_t_10.data = __pyx_v_all_AP.data;
6808 __pyx_t_10.memview = __pyx_v_all_AP.memview;
6809 __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
6810 __pyx_t_22 = -1;
6811 if (unlikely(__pyx_memoryview_slice_memviewslice(
6812 &__pyx_t_10,
6813 __pyx_v_all_AP.shape[0], __pyx_v_all_AP.strides[0], __pyx_v_all_AP.suboffsets[0],
6814 0,
6815 0,
6816 &__pyx_t_22,
6817 0,
6818 __pyx_v_valid_index,
6819 0,
6820 0,
6821 1,
6822 0,
6823 1) < 0))
6824{
6825 __PYX_ERR(0, 270, __pyx_L1_error)
6826}
6827
6828__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, 270, __pyx_L1_error)
6829 __Pyx_GOTREF(__pyx_t_4);
6830 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
6831 __pyx_t_10.memview = NULL;
6832 __pyx_t_10.data = NULL;
6833 __pyx_t_5 = NULL;
6834 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6835 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
6836 if (likely(__pyx_t_5)) {
6837 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6838 __Pyx_INCREF(__pyx_t_5);
6839 __Pyx_INCREF(function);
6840 __Pyx_DECREF_SET(__pyx_t_2, function);
6841 }
6842 }
6843 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
6844 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6845 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6846 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
6847 __Pyx_GOTREF(__pyx_t_1);
6848 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6849 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error)
6850 __Pyx_GOTREF(__pyx_t_4);
6851 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error)
6852 __Pyx_GOTREF(__pyx_t_5);
6853 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6854 __pyx_t_10.data = __pyx_v_all_INP.data;
6855 __pyx_t_10.memview = __pyx_v_all_INP.memview;
6856 __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
6857 __pyx_t_22 = -1;
6858 if (unlikely(__pyx_memoryview_slice_memviewslice(
6859 &__pyx_t_10,
6860 __pyx_v_all_INP.shape[0], __pyx_v_all_INP.strides[0], __pyx_v_all_INP.suboffsets[0],
6861 0,
6862 0,
6863 &__pyx_t_22,
6864 0,
6865 __pyx_v_valid_index,
6866 0,
6867 0,
6868 1,
6869 0,
6870 1) < 0))
6871{
6872 __PYX_ERR(0, 270, __pyx_L1_error)
6873}
6874
6875__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, 270, __pyx_L1_error)
6876 __Pyx_GOTREF(__pyx_t_4);
6877 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
6878 __pyx_t_10.memview = NULL;
6879 __pyx_t_10.data = NULL;
6880 __pyx_t_6 = NULL;
6881 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
6882 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6883 if (likely(__pyx_t_6)) {
6884 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6885 __Pyx_INCREF(__pyx_t_6);
6886 __Pyx_INCREF(function);
6887 __Pyx_DECREF_SET(__pyx_t_5, function);
6888 }
6889 }
6890 __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
6891 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6892 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6893 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
6894 __Pyx_GOTREF(__pyx_t_2);
6895 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6896 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error)
6897 __Pyx_GOTREF(__pyx_t_5);
6898 __Pyx_GIVEREF(__pyx_t_3);
6899 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
6900 __Pyx_GIVEREF(__pyx_t_1);
6901 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
6902 __Pyx_GIVEREF(__pyx_t_2);
6903 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
6904 __pyx_t_3 = 0;
6905 __pyx_t_1 = 0;
6906 __pyx_t_2 = 0;
6907 __pyx_r = __pyx_t_5;
6908 __pyx_t_5 = 0;
6909 goto __pyx_L0;
6910
6911 /* "rank_cy.pyx":163
6912 *
6913 *
6914 * cpdef eval_market1501_cy(float[:,:] distmat, float[:,:] q_feats, float[:,:] g_feats, long[:] q_pids, long[:]g_pids, # <<<<<<<<<<<<<<
6915 * long[:]q_camids, long[:]g_camids, long max_rank, bint use_distmat):
6916 *
6917 */
6918
6919 /* function exit code */
6920 __pyx_L1_error:;
6921 __Pyx_XDECREF(__pyx_t_1);
6922 __Pyx_XDECREF(__pyx_t_2);
6923 __Pyx_XDECREF(__pyx_t_3);
6924 __Pyx_XDECREF(__pyx_t_4);
6925 __Pyx_XDECREF(__pyx_t_5);
6926 __Pyx_XDECREF(__pyx_t_6);
6927 __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
6928 __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
6929 __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
6930 __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
6931 __Pyx_AddTraceback("rank_cy.eval_market1501_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
6932 __pyx_r = 0;
6933 __pyx_L0:;
6934 __PYX_XDEC_MEMVIEW(&__pyx_v_indices, 1);
6935 __Pyx_XDECREF(__pyx_v_index);
6936 __PYX_XDEC_MEMVIEW(&__pyx_v_matches, 1);
6937 __PYX_XDEC_MEMVIEW(&__pyx_v_all_cmc, 1);
6938 __PYX_XDEC_MEMVIEW(&__pyx_v_all_AP, 1);
6939 __PYX_XDEC_MEMVIEW(&__pyx_v_all_INP, 1);
6940 __PYX_XDEC_MEMVIEW(&__pyx_v_order, 1);
6941 __PYX_XDEC_MEMVIEW(&__pyx_v_raw_cmc, 1);
6942 __PYX_XDEC_MEMVIEW(&__pyx_v_cmc, 1);
6943 __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_cmc, 1);
6944 __PYX_XDEC_MEMVIEW(&__pyx_v_avg_cmc, 1);
6945 __Pyx_XGIVEREF(__pyx_r);
6946 __Pyx_RefNannyFinishContext();
6947 return __pyx_r;
6948}
6949
6950/* Python wrapper */
6951static PyObject *__pyx_pw_7rank_cy_5eval_market1501_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6952static PyObject *__pyx_pw_7rank_cy_5eval_market1501_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6953 __Pyx_memviewslice __pyx_v_distmat = { 0, 0, { 0 }, { 0 }, { 0 } };
6954 __Pyx_memviewslice __pyx_v_q_feats = { 0, 0, { 0 }, { 0 }, { 0 } };
6955 __Pyx_memviewslice __pyx_v_g_feats = { 0, 0, { 0 }, { 0 }, { 0 } };
6956 __Pyx_memviewslice __pyx_v_q_pids = { 0, 0, { 0 }, { 0 }, { 0 } };
6957 __Pyx_memviewslice __pyx_v_g_pids = { 0, 0, { 0 }, { 0 }, { 0 } };
6958 __Pyx_memviewslice __pyx_v_q_camids = { 0, 0, { 0 }, { 0 }, { 0 } };
6959 __Pyx_memviewslice __pyx_v_g_camids = { 0, 0, { 0 }, { 0 }, { 0 } };
6960 long __pyx_v_max_rank;
6961 int __pyx_v_use_distmat;
6962 int __pyx_lineno = 0;
6963 const char *__pyx_filename = NULL;
6964 int __pyx_clineno = 0;
6965 PyObject *__pyx_r = 0;
6966 __Pyx_RefNannyDeclarations
6967 __Pyx_RefNannySetupContext("eval_market1501_cy (wrapper)", 0);
6968 {
6969 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,&__pyx_n_s_max_rank,&__pyx_n_s_use_distmat,0};
6970 PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
6971 if (unlikely(__pyx_kwds)) {
6972 Py_ssize_t kw_args;
6973 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6974 switch (pos_args) {
6975 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
6976 CYTHON_FALLTHROUGH;
6977 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6978 CYTHON_FALLTHROUGH;
6979 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6980 CYTHON_FALLTHROUGH;
6981 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6982 CYTHON_FALLTHROUGH;
6983 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6984 CYTHON_FALLTHROUGH;
6985 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6986 CYTHON_FALLTHROUGH;
6987 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6988 CYTHON_FALLTHROUGH;
6989 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6990 CYTHON_FALLTHROUGH;
6991 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6992 CYTHON_FALLTHROUGH;
6993 case 0: break;
6994 default: goto __pyx_L5_argtuple_error;
6995 }
6996 kw_args = PyDict_Size(__pyx_kwds);
6997 switch (pos_args) {
6998 case 0:
6999 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distmat)) != 0)) kw_args--;
7000 else goto __pyx_L5_argtuple_error;
7001 CYTHON_FALLTHROUGH;
7002 case 1:
7003 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_feats)) != 0)) kw_args--;
7004 else {
7005 __Pyx_RaiseArgtupleInvalid("eval_market1501_cy", 1, 9, 9, 1); __PYX_ERR(0, 163, __pyx_L3_error)
7006 }
7007 CYTHON_FALLTHROUGH;
7008 case 2:
7009 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_feats)) != 0)) kw_args--;
7010 else {
7011 __Pyx_RaiseArgtupleInvalid("eval_market1501_cy", 1, 9, 9, 2); __PYX_ERR(0, 163, __pyx_L3_error)
7012 }
7013 CYTHON_FALLTHROUGH;
7014 case 3:
7015 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_pids)) != 0)) kw_args--;
7016 else {
7017 __Pyx_RaiseArgtupleInvalid("eval_market1501_cy", 1, 9, 9, 3); __PYX_ERR(0, 163, __pyx_L3_error)
7018 }
7019 CYTHON_FALLTHROUGH;
7020 case 4:
7021 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_pids)) != 0)) kw_args--;
7022 else {
7023 __Pyx_RaiseArgtupleInvalid("eval_market1501_cy", 1, 9, 9, 4); __PYX_ERR(0, 163, __pyx_L3_error)
7024 }
7025 CYTHON_FALLTHROUGH;
7026 case 5:
7027 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_camids)) != 0)) kw_args--;
7028 else {
7029 __Pyx_RaiseArgtupleInvalid("eval_market1501_cy", 1, 9, 9, 5); __PYX_ERR(0, 163, __pyx_L3_error)
7030 }
7031 CYTHON_FALLTHROUGH;
7032 case 6:
7033 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g_camids)) != 0)) kw_args--;
7034 else {
7035 __Pyx_RaiseArgtupleInvalid("eval_market1501_cy", 1, 9, 9, 6); __PYX_ERR(0, 163, __pyx_L3_error)
7036 }
7037 CYTHON_FALLTHROUGH;
7038 case 7:
7039 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_rank)) != 0)) kw_args--;
7040 else {
7041 __Pyx_RaiseArgtupleInvalid("eval_market1501_cy", 1, 9, 9, 7); __PYX_ERR(0, 163, __pyx_L3_error)
7042 }
7043 CYTHON_FALLTHROUGH;
7044 case 8:
7045 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_distmat)) != 0)) kw_args--;
7046 else {
7047 __Pyx_RaiseArgtupleInvalid("eval_market1501_cy", 1, 9, 9, 8); __PYX_ERR(0, 163, __pyx_L3_error)
7048 }
7049 }
7050 if (unlikely(kw_args > 0)) {
7051 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "eval_market1501_cy") < 0)) __PYX_ERR(0, 163, __pyx_L3_error)
7052 }
7053 } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
7054 goto __pyx_L5_argtuple_error;
7055 } else {
7056 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7057 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7058 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7059 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7060 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7061 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7062 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7063 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
7064 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
7065 }
7066 __pyx_v_distmat = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distmat.memview)) __PYX_ERR(0, 163, __pyx_L3_error)
7067 __pyx_v_q_feats = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_q_feats.memview)) __PYX_ERR(0, 163, __pyx_L3_error)
7068 __pyx_v_g_feats = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_g_feats.memview)) __PYX_ERR(0, 163, __pyx_L3_error)
7069 __pyx_v_q_pids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_q_pids.memview)) __PYX_ERR(0, 163, __pyx_L3_error)
7070 __pyx_v_g_pids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_g_pids.memview)) __PYX_ERR(0, 163, __pyx_L3_error)
7071 __pyx_v_q_camids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_q_camids.memview)) __PYX_ERR(0, 164, __pyx_L3_error)
7072 __pyx_v_g_camids = __Pyx_PyObject_to_MemoryviewSlice_ds_long(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_g_camids.memview)) __PYX_ERR(0, 164, __pyx_L3_error)
7073 __pyx_v_max_rank = __Pyx_PyInt_As_long(values[7]); if (unlikely((__pyx_v_max_rank == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L3_error)
7074 __pyx_v_use_distmat = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_use_distmat == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L3_error)
7075 }
7076 goto __pyx_L4_argument_unpacking_done;
7077 __pyx_L5_argtuple_error:;
7078 __Pyx_RaiseArgtupleInvalid("eval_market1501_cy", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 163, __pyx_L3_error)
7079 __pyx_L3_error:;
7080 __Pyx_AddTraceback("rank_cy.eval_market1501_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
7081 __Pyx_RefNannyFinishContext();
7082 return NULL;
7083 __pyx_L4_argument_unpacking_done:;
7084 __pyx_r = __pyx_pf_7rank_cy_4eval_market1501_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, __pyx_v_max_rank, __pyx_v_use_distmat);
7085
7086 /* function exit code */
7087 __Pyx_RefNannyFinishContext();
7088 return __pyx_r;
7089}
7090
7091static PyObject *__pyx_pf_7rank_cy_4eval_market1501_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, long __pyx_v_max_rank, int __pyx_v_use_distmat) {
7092 PyObject *__pyx_r = NULL;
7093 __Pyx_RefNannyDeclarations
7094 PyObject *__pyx_t_1 = NULL;
7095 int __pyx_lineno = 0;
7096 const char *__pyx_filename = NULL;
7097 int __pyx_clineno = 0;
7098 __Pyx_RefNannySetupContext("eval_market1501_cy", 0);
7099 __Pyx_XDECREF(__pyx_r);
7100 if (unlikely(!__pyx_v_distmat.memview)) { __Pyx_RaiseUnboundLocalError("distmat"); __PYX_ERR(0, 163, __pyx_L1_error) }
7101 if (unlikely(!__pyx_v_q_feats.memview)) { __Pyx_RaiseUnboundLocalError("q_feats"); __PYX_ERR(0, 163, __pyx_L1_error) }
7102 if (unlikely(!__pyx_v_g_feats.memview)) { __Pyx_RaiseUnboundLocalError("g_feats"); __PYX_ERR(0, 163, __pyx_L1_error) }
7103 if (unlikely(!__pyx_v_q_pids.memview)) { __Pyx_RaiseUnboundLocalError("q_pids"); __PYX_ERR(0, 163, __pyx_L1_error) }
7104 if (unlikely(!__pyx_v_g_pids.memview)) { __Pyx_RaiseUnboundLocalError("g_pids"); __PYX_ERR(0, 163, __pyx_L1_error) }
7105 if (unlikely(!__pyx_v_q_camids.memview)) { __Pyx_RaiseUnboundLocalError("q_camids"); __PYX_ERR(0, 163, __pyx_L1_error) }
7106 if (unlikely(!__pyx_v_g_camids.memview)) { __Pyx_RaiseUnboundLocalError("g_camids"); __PYX_ERR(0, 163, __pyx_L1_error) }
7107 __pyx_t_1 = __pyx_f_7rank_cy_eval_market1501_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, __pyx_v_max_rank, __pyx_v_use_distmat, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
7108 __Pyx_GOTREF(__pyx_t_1);
7109 __pyx_r = __pyx_t_1;
7110 __pyx_t_1 = 0;
7111 goto __pyx_L0;
7112
7113 /* function exit code */
7114 __pyx_L1_error:;
7115 __Pyx_XDECREF(__pyx_t_1);
7116 __Pyx_AddTraceback("rank_cy.eval_market1501_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
7117 __pyx_r = NULL;
7118 __pyx_L0:;
7119 __PYX_XDEC_MEMVIEW(&__pyx_v_distmat, 1);
7120 __PYX_XDEC_MEMVIEW(&__pyx_v_q_feats, 1);
7121 __PYX_XDEC_MEMVIEW(&__pyx_v_g_feats, 1);
7122 __PYX_XDEC_MEMVIEW(&__pyx_v_q_pids, 1);
7123 __PYX_XDEC_MEMVIEW(&__pyx_v_g_pids, 1);
7124 __PYX_XDEC_MEMVIEW(&__pyx_v_q_camids, 1);
7125 __PYX_XDEC_MEMVIEW(&__pyx_v_g_camids, 1);
7126 __Pyx_XGIVEREF(__pyx_r);
7127 __Pyx_RefNannyFinishContext();
7128 return __pyx_r;
7129}
7130
7131/* "rank_cy.pyx":274
7132 *
7133 * # Compute the cumulative sum
7134 * cdef void function_cumsum(cython.numeric[:] src, cython.numeric[:] dst, long n): # <<<<<<<<<<<<<<
7135 * cdef long i
7136 * dst[0] = src[0]
7137 */
7138
7139static void __pyx_fuse_3__pyx_f_7rank_cy_function_cumsum(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, long __pyx_v_n) {
7140 long __pyx_v_i;
7141 __Pyx_RefNannyDeclarations
7142 Py_ssize_t __pyx_t_1;
7143 Py_ssize_t __pyx_t_2;
7144 long __pyx_t_3;
7145 long __pyx_t_4;
7146 long __pyx_t_5;
7147 Py_ssize_t __pyx_t_6;
7148 __Pyx_RefNannySetupContext("__pyx_fuse_3function_cumsum", 0);
7149
7150 /* "rank_cy.pyx":276
7151 * cdef void function_cumsum(cython.numeric[:] src, cython.numeric[:] dst, long n):
7152 * cdef long i
7153 * dst[0] = src[0] # <<<<<<<<<<<<<<
7154 * for i in range(1, n):
7155 * dst[i] = src[i] + dst[i - 1]
7156 */
7157 __pyx_t_1 = 0;
7158 __pyx_t_2 = 0;
7159 *((float *) ( /* dim=0 */ (__pyx_v_dst.data + __pyx_t_2 * __pyx_v_dst.strides[0]) )) = (*((float *) ( /* dim=0 */ (__pyx_v_src.data + __pyx_t_1 * __pyx_v_src.strides[0]) )));
7160
7161 /* "rank_cy.pyx":277
7162 * cdef long i
7163 * dst[0] = src[0]
7164 * for i in range(1, n): # <<<<<<<<<<<<<<
7165 * dst[i] = src[i] + dst[i - 1]
7166 */
7167 __pyx_t_3 = __pyx_v_n;
7168 __pyx_t_4 = __pyx_t_3;
7169 for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
7170 __pyx_v_i = __pyx_t_5;
7171
7172 /* "rank_cy.pyx":278
7173 * dst[0] = src[0]
7174 * for i in range(1, n):
7175 * dst[i] = src[i] + dst[i - 1] # <<<<<<<<<<<<<<
7176 */
7177 __pyx_t_1 = __pyx_v_i;
7178 __pyx_t_2 = (__pyx_v_i - 1);
7179 __pyx_t_6 = __pyx_v_i;
7180 *((float *) ( /* dim=0 */ (__pyx_v_dst.data + __pyx_t_6 * __pyx_v_dst.strides[0]) )) = ((*((float *) ( /* dim=0 */ (__pyx_v_src.data + __pyx_t_1 * __pyx_v_src.strides[0]) ))) + (*((float *) ( /* dim=0 */ (__pyx_v_dst.data + __pyx_t_2 * __pyx_v_dst.strides[0]) ))));
7181 }
7182
7183 /* "rank_cy.pyx":274
7184 *
7185 * # Compute the cumulative sum
7186 * cdef void function_cumsum(cython.numeric[:] src, cython.numeric[:] dst, long n): # <<<<<<<<<<<<<<
7187 * cdef long i
7188 * dst[0] = src[0]
7189 */
7190
7191 /* function exit code */
7192 __Pyx_RefNannyFinishContext();
7193}
7194
7195/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":735
7196 * ctypedef npy_cdouble complex_t
7197 *
7198 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
7199 * return PyArray_MultiIterNew(1, <void*>a)
7200 *
7201 */
7202
7203static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
7204 PyObject *__pyx_r = NULL;
7205 __Pyx_RefNannyDeclarations
7206 PyObject *__pyx_t_1 = NULL;
7207 int __pyx_lineno = 0;
7208 const char *__pyx_filename = NULL;
7209 int __pyx_clineno = 0;
7210 __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
7211
7212 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":736
7213 *
7214 * cdef inline object PyArray_MultiIterNew1(a):
7215 * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
7216 *
7217 * cdef inline object PyArray_MultiIterNew2(a, b):
7218 */
7219 __Pyx_XDECREF(__pyx_r);
7220 __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
7221 __Pyx_GOTREF(__pyx_t_1);
7222 __pyx_r = __pyx_t_1;
7223 __pyx_t_1 = 0;
7224 goto __pyx_L0;
7225
7226 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":735
7227 * ctypedef npy_cdouble complex_t
7228 *
7229 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
7230 * return PyArray_MultiIterNew(1, <void*>a)
7231 *
7232 */
7233
7234 /* function exit code */
7235 __pyx_L1_error:;
7236 __Pyx_XDECREF(__pyx_t_1);
7237 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
7238 __pyx_r = 0;
7239 __pyx_L0:;
7240 __Pyx_XGIVEREF(__pyx_r);
7241 __Pyx_RefNannyFinishContext();
7242 return __pyx_r;
7243}
7244
7245/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":738
7246 * return PyArray_MultiIterNew(1, <void*>a)
7247 *
7248 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
7249 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
7250 *
7251 */
7252
7253static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
7254 PyObject *__pyx_r = NULL;
7255 __Pyx_RefNannyDeclarations
7256 PyObject *__pyx_t_1 = NULL;
7257 int __pyx_lineno = 0;
7258 const char *__pyx_filename = NULL;
7259 int __pyx_clineno = 0;
7260 __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
7261
7262 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":739
7263 *
7264 * cdef inline object PyArray_MultiIterNew2(a, b):
7265 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
7266 *
7267 * cdef inline object PyArray_MultiIterNew3(a, b, c):
7268 */
7269 __Pyx_XDECREF(__pyx_r);
7270 __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)
7271 __Pyx_GOTREF(__pyx_t_1);
7272 __pyx_r = __pyx_t_1;
7273 __pyx_t_1 = 0;
7274 goto __pyx_L0;
7275
7276 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":738
7277 * return PyArray_MultiIterNew(1, <void*>a)
7278 *
7279 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
7280 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
7281 *
7282 */
7283
7284 /* function exit code */
7285 __pyx_L1_error:;
7286 __Pyx_XDECREF(__pyx_t_1);
7287 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
7288 __pyx_r = 0;
7289 __pyx_L0:;
7290 __Pyx_XGIVEREF(__pyx_r);
7291 __Pyx_RefNannyFinishContext();
7292 return __pyx_r;
7293}
7294
7295/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":741
7296 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
7297 *
7298 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
7299 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
7300 *
7301 */
7302
7303static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
7304 PyObject *__pyx_r = NULL;
7305 __Pyx_RefNannyDeclarations
7306 PyObject *__pyx_t_1 = NULL;
7307 int __pyx_lineno = 0;
7308 const char *__pyx_filename = NULL;
7309 int __pyx_clineno = 0;
7310 __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
7311
7312 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":742
7313 *
7314 * cdef inline object PyArray_MultiIterNew3(a, b, c):
7315 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
7316 *
7317 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
7318 */
7319 __Pyx_XDECREF(__pyx_r);
7320 __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)
7321 __Pyx_GOTREF(__pyx_t_1);
7322 __pyx_r = __pyx_t_1;
7323 __pyx_t_1 = 0;
7324 goto __pyx_L0;
7325
7326 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":741
7327 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
7328 *
7329 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
7330 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
7331 *
7332 */
7333
7334 /* function exit code */
7335 __pyx_L1_error:;
7336 __Pyx_XDECREF(__pyx_t_1);
7337 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
7338 __pyx_r = 0;
7339 __pyx_L0:;
7340 __Pyx_XGIVEREF(__pyx_r);
7341 __Pyx_RefNannyFinishContext();
7342 return __pyx_r;
7343}
7344
7345/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":744
7346 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
7347 *
7348 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
7349 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
7350 *
7351 */
7352
7353static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
7354 PyObject *__pyx_r = NULL;
7355 __Pyx_RefNannyDeclarations
7356 PyObject *__pyx_t_1 = NULL;
7357 int __pyx_lineno = 0;
7358 const char *__pyx_filename = NULL;
7359 int __pyx_clineno = 0;
7360 __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
7361
7362 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":745
7363 *
7364 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
7365 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
7366 *
7367 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
7368 */
7369 __Pyx_XDECREF(__pyx_r);
7370 __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)
7371 __Pyx_GOTREF(__pyx_t_1);
7372 __pyx_r = __pyx_t_1;
7373 __pyx_t_1 = 0;
7374 goto __pyx_L0;
7375
7376 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":744
7377 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
7378 *
7379 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
7380 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
7381 *
7382 */
7383
7384 /* function exit code */
7385 __pyx_L1_error:;
7386 __Pyx_XDECREF(__pyx_t_1);
7387 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
7388 __pyx_r = 0;
7389 __pyx_L0:;
7390 __Pyx_XGIVEREF(__pyx_r);
7391 __Pyx_RefNannyFinishContext();
7392 return __pyx_r;
7393}
7394
7395/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":747
7396 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
7397 *
7398 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
7399 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
7400 *
7401 */
7402
7403static 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) {
7404 PyObject *__pyx_r = NULL;
7405 __Pyx_RefNannyDeclarations
7406 PyObject *__pyx_t_1 = NULL;
7407 int __pyx_lineno = 0;
7408 const char *__pyx_filename = NULL;
7409 int __pyx_clineno = 0;
7410 __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
7411
7412 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":748
7413 *
7414 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
7415 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
7416 *
7417 * cdef inline tuple PyDataType_SHAPE(dtype d):
7418 */
7419 __Pyx_XDECREF(__pyx_r);
7420 __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)
7421 __Pyx_GOTREF(__pyx_t_1);
7422 __pyx_r = __pyx_t_1;
7423 __pyx_t_1 = 0;
7424 goto __pyx_L0;
7425
7426 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":747
7427 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
7428 *
7429 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
7430 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
7431 *
7432 */
7433
7434 /* function exit code */
7435 __pyx_L1_error:;
7436 __Pyx_XDECREF(__pyx_t_1);
7437 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
7438 __pyx_r = 0;
7439 __pyx_L0:;
7440 __Pyx_XGIVEREF(__pyx_r);
7441 __Pyx_RefNannyFinishContext();
7442 return __pyx_r;
7443}
7444
7445/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":750
7446 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
7447 *
7448 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
7449 * if PyDataType_HASSUBARRAY(d):
7450 * return <tuple>d.subarray.shape
7451 */
7452
7453static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
7454 PyObject *__pyx_r = NULL;
7455 __Pyx_RefNannyDeclarations
7456 int __pyx_t_1;
7457 __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
7458
7459 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":751
7460 *
7461 * cdef inline tuple PyDataType_SHAPE(dtype d):
7462 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
7463 * return <tuple>d.subarray.shape
7464 * else:
7465 */
7466 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
7467 if (__pyx_t_1) {
7468
7469 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":752
7470 * cdef inline tuple PyDataType_SHAPE(dtype d):
7471 * if PyDataType_HASSUBARRAY(d):
7472 * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
7473 * else:
7474 * return ()
7475 */
7476 __Pyx_XDECREF(__pyx_r);
7477 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
7478 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
7479 goto __pyx_L0;
7480
7481 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":751
7482 *
7483 * cdef inline tuple PyDataType_SHAPE(dtype d):
7484 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
7485 * return <tuple>d.subarray.shape
7486 * else:
7487 */
7488 }
7489
7490 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":754
7491 * return <tuple>d.subarray.shape
7492 * else:
7493 * return () # <<<<<<<<<<<<<<
7494 *
7495 *
7496 */
7497 /*else*/ {
7498 __Pyx_XDECREF(__pyx_r);
7499 __Pyx_INCREF(__pyx_empty_tuple);
7500 __pyx_r = __pyx_empty_tuple;
7501 goto __pyx_L0;
7502 }
7503
7504 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":750
7505 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
7506 *
7507 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
7508 * if PyDataType_HASSUBARRAY(d):
7509 * return <tuple>d.subarray.shape
7510 */
7511
7512 /* function exit code */
7513 __pyx_L0:;
7514 __Pyx_XGIVEREF(__pyx_r);
7515 __Pyx_RefNannyFinishContext();
7516 return __pyx_r;
7517}
7518
7519/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":929
7520 * int _import_umath() except -1
7521 *
7522 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
7523 * Py_INCREF(base) # important to do this before stealing the reference below!
7524 * PyArray_SetBaseObject(arr, base)
7525 */
7526
7527static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
7528 __Pyx_RefNannyDeclarations
7529 __Pyx_RefNannySetupContext("set_array_base", 0);
7530
7531 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":930
7532 *
7533 * cdef inline void set_array_base(ndarray arr, object base):
7534 * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
7535 * PyArray_SetBaseObject(arr, base)
7536 *
7537 */
7538 Py_INCREF(__pyx_v_base);
7539
7540 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":931
7541 * cdef inline void set_array_base(ndarray arr, object base):
7542 * Py_INCREF(base) # important to do this before stealing the reference below!
7543 * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
7544 *
7545 * cdef inline object get_array_base(ndarray arr):
7546 */
7547 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
7548
7549 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":929
7550 * int _import_umath() except -1
7551 *
7552 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
7553 * Py_INCREF(base) # important to do this before stealing the reference below!
7554 * PyArray_SetBaseObject(arr, base)
7555 */
7556
7557 /* function exit code */
7558 __Pyx_RefNannyFinishContext();
7559}
7560
7561/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":933
7562 * PyArray_SetBaseObject(arr, base)
7563 *
7564 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
7565 * base = PyArray_BASE(arr)
7566 * if base is NULL:
7567 */
7568
7569static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
7570 PyObject *__pyx_v_base;
7571 PyObject *__pyx_r = NULL;
7572 __Pyx_RefNannyDeclarations
7573 int __pyx_t_1;
7574 __Pyx_RefNannySetupContext("get_array_base", 0);
7575
7576 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":934
7577 *
7578 * cdef inline object get_array_base(ndarray arr):
7579 * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
7580 * if base is NULL:
7581 * return None
7582 */
7583 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
7584
7585 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":935
7586 * cdef inline object get_array_base(ndarray arr):
7587 * base = PyArray_BASE(arr)
7588 * if base is NULL: # <<<<<<<<<<<<<<
7589 * return None
7590 * return <object>base
7591 */
7592 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
7593 if (__pyx_t_1) {
7594
7595 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":936
7596 * base = PyArray_BASE(arr)
7597 * if base is NULL:
7598 * return None # <<<<<<<<<<<<<<
7599 * return <object>base
7600 *
7601 */
7602 __Pyx_XDECREF(__pyx_r);
7603 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7604 goto __pyx_L0;
7605
7606 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":935
7607 * cdef inline object get_array_base(ndarray arr):
7608 * base = PyArray_BASE(arr)
7609 * if base is NULL: # <<<<<<<<<<<<<<
7610 * return None
7611 * return <object>base
7612 */
7613 }
7614
7615 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":937
7616 * if base is NULL:
7617 * return None
7618 * return <object>base # <<<<<<<<<<<<<<
7619 *
7620 * # Versions of the import_* functions which are more suitable for
7621 */
7622 __Pyx_XDECREF(__pyx_r);
7623 __Pyx_INCREF(((PyObject *)__pyx_v_base));
7624 __pyx_r = ((PyObject *)__pyx_v_base);
7625 goto __pyx_L0;
7626
7627 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":933
7628 * PyArray_SetBaseObject(arr, base)
7629 *
7630 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
7631 * base = PyArray_BASE(arr)
7632 * if base is NULL:
7633 */
7634
7635 /* function exit code */
7636 __pyx_L0:;
7637 __Pyx_XGIVEREF(__pyx_r);
7638 __Pyx_RefNannyFinishContext();
7639 return __pyx_r;
7640}
7641
7642/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":941
7643 * # Versions of the import_* functions which are more suitable for
7644 * # Cython code.
7645 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
7646 * try:
7647 * __pyx_import_array()
7648 */
7649
7650static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
7651 int __pyx_r;
7652 __Pyx_RefNannyDeclarations
7653 PyObject *__pyx_t_1 = NULL;
7654 PyObject *__pyx_t_2 = NULL;
7655 PyObject *__pyx_t_3 = NULL;
7656 int __pyx_t_4;
7657 PyObject *__pyx_t_5 = NULL;
7658 PyObject *__pyx_t_6 = NULL;
7659 PyObject *__pyx_t_7 = NULL;
7660 PyObject *__pyx_t_8 = NULL;
7661 int __pyx_lineno = 0;
7662 const char *__pyx_filename = NULL;
7663 int __pyx_clineno = 0;
7664 __Pyx_RefNannySetupContext("import_array", 0);
7665
7666 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":942
7667 * # Cython code.
7668 * cdef inline int import_array() except -1:
7669 * try: # <<<<<<<<<<<<<<
7670 * __pyx_import_array()
7671 * except Exception:
7672 */
7673 {
7674 __Pyx_PyThreadState_declare
7675 __Pyx_PyThreadState_assign
7676 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7677 __Pyx_XGOTREF(__pyx_t_1);
7678 __Pyx_XGOTREF(__pyx_t_2);
7679 __Pyx_XGOTREF(__pyx_t_3);
7680 /*try:*/ {
7681
7682 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":943
7683 * cdef inline int import_array() except -1:
7684 * try:
7685 * __pyx_import_array() # <<<<<<<<<<<<<<
7686 * except Exception:
7687 * raise ImportError("numpy.core.multiarray failed to import")
7688 */
7689 __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
7690
7691 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":942
7692 * # Cython code.
7693 * cdef inline int import_array() except -1:
7694 * try: # <<<<<<<<<<<<<<
7695 * __pyx_import_array()
7696 * except Exception:
7697 */
7698 }
7699 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7700 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7701 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7702 goto __pyx_L8_try_end;
7703 __pyx_L3_error:;
7704
7705 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":944
7706 * try:
7707 * __pyx_import_array()
7708 * except Exception: # <<<<<<<<<<<<<<
7709 * raise ImportError("numpy.core.multiarray failed to import")
7710 *
7711 */
7712 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7713 if (__pyx_t_4) {
7714 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7715 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
7716 __Pyx_GOTREF(__pyx_t_5);
7717 __Pyx_GOTREF(__pyx_t_6);
7718 __Pyx_GOTREF(__pyx_t_7);
7719
7720 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":945
7721 * __pyx_import_array()
7722 * except Exception:
7723 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
7724 *
7725 * cdef inline int import_umath() except -1:
7726 */
7727 __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)
7728 __Pyx_GOTREF(__pyx_t_8);
7729 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7730 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7731 __PYX_ERR(1, 945, __pyx_L5_except_error)
7732 }
7733 goto __pyx_L5_except_error;
7734 __pyx_L5_except_error:;
7735
7736 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":942
7737 * # Cython code.
7738 * cdef inline int import_array() except -1:
7739 * try: # <<<<<<<<<<<<<<
7740 * __pyx_import_array()
7741 * except Exception:
7742 */
7743 __Pyx_XGIVEREF(__pyx_t_1);
7744 __Pyx_XGIVEREF(__pyx_t_2);
7745 __Pyx_XGIVEREF(__pyx_t_3);
7746 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7747 goto __pyx_L1_error;
7748 __pyx_L8_try_end:;
7749 }
7750
7751 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":941
7752 * # Versions of the import_* functions which are more suitable for
7753 * # Cython code.
7754 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
7755 * try:
7756 * __pyx_import_array()
7757 */
7758
7759 /* function exit code */
7760 __pyx_r = 0;
7761 goto __pyx_L0;
7762 __pyx_L1_error:;
7763 __Pyx_XDECREF(__pyx_t_5);
7764 __Pyx_XDECREF(__pyx_t_6);
7765 __Pyx_XDECREF(__pyx_t_7);
7766 __Pyx_XDECREF(__pyx_t_8);
7767 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7768 __pyx_r = -1;
7769 __pyx_L0:;
7770 __Pyx_RefNannyFinishContext();
7771 return __pyx_r;
7772}
7773
7774/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":947
7775 * raise ImportError("numpy.core.multiarray failed to import")
7776 *
7777 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
7778 * try:
7779 * _import_umath()
7780 */
7781
7782static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
7783 int __pyx_r;
7784 __Pyx_RefNannyDeclarations
7785 PyObject *__pyx_t_1 = NULL;
7786 PyObject *__pyx_t_2 = NULL;
7787 PyObject *__pyx_t_3 = NULL;
7788 int __pyx_t_4;
7789 PyObject *__pyx_t_5 = NULL;
7790 PyObject *__pyx_t_6 = NULL;
7791 PyObject *__pyx_t_7 = NULL;
7792 PyObject *__pyx_t_8 = NULL;
7793 int __pyx_lineno = 0;
7794 const char *__pyx_filename = NULL;
7795 int __pyx_clineno = 0;
7796 __Pyx_RefNannySetupContext("import_umath", 0);
7797
7798 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":948
7799 *
7800 * cdef inline int import_umath() except -1:
7801 * try: # <<<<<<<<<<<<<<
7802 * _import_umath()
7803 * except Exception:
7804 */
7805 {
7806 __Pyx_PyThreadState_declare
7807 __Pyx_PyThreadState_assign
7808 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7809 __Pyx_XGOTREF(__pyx_t_1);
7810 __Pyx_XGOTREF(__pyx_t_2);
7811 __Pyx_XGOTREF(__pyx_t_3);
7812 /*try:*/ {
7813
7814 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":949
7815 * cdef inline int import_umath() except -1:
7816 * try:
7817 * _import_umath() # <<<<<<<<<<<<<<
7818 * except Exception:
7819 * raise ImportError("numpy.core.umath failed to import")
7820 */
7821 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
7822
7823 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":948
7824 *
7825 * cdef inline int import_umath() except -1:
7826 * try: # <<<<<<<<<<<<<<
7827 * _import_umath()
7828 * except Exception:
7829 */
7830 }
7831 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7832 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7833 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7834 goto __pyx_L8_try_end;
7835 __pyx_L3_error:;
7836
7837 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":950
7838 * try:
7839 * _import_umath()
7840 * except Exception: # <<<<<<<<<<<<<<
7841 * raise ImportError("numpy.core.umath failed to import")
7842 *
7843 */
7844 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7845 if (__pyx_t_4) {
7846 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7847 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
7848 __Pyx_GOTREF(__pyx_t_5);
7849 __Pyx_GOTREF(__pyx_t_6);
7850 __Pyx_GOTREF(__pyx_t_7);
7851
7852 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":951
7853 * _import_umath()
7854 * except Exception:
7855 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
7856 *
7857 * cdef inline int import_ufunc() except -1:
7858 */
7859 __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)
7860 __Pyx_GOTREF(__pyx_t_8);
7861 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7862 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7863 __PYX_ERR(1, 951, __pyx_L5_except_error)
7864 }
7865 goto __pyx_L5_except_error;
7866 __pyx_L5_except_error:;
7867
7868 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":948
7869 *
7870 * cdef inline int import_umath() except -1:
7871 * try: # <<<<<<<<<<<<<<
7872 * _import_umath()
7873 * except Exception:
7874 */
7875 __Pyx_XGIVEREF(__pyx_t_1);
7876 __Pyx_XGIVEREF(__pyx_t_2);
7877 __Pyx_XGIVEREF(__pyx_t_3);
7878 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7879 goto __pyx_L1_error;
7880 __pyx_L8_try_end:;
7881 }
7882
7883 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":947
7884 * raise ImportError("numpy.core.multiarray failed to import")
7885 *
7886 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
7887 * try:
7888 * _import_umath()
7889 */
7890
7891 /* function exit code */
7892 __pyx_r = 0;
7893 goto __pyx_L0;
7894 __pyx_L1_error:;
7895 __Pyx_XDECREF(__pyx_t_5);
7896 __Pyx_XDECREF(__pyx_t_6);
7897 __Pyx_XDECREF(__pyx_t_7);
7898 __Pyx_XDECREF(__pyx_t_8);
7899 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7900 __pyx_r = -1;
7901 __pyx_L0:;
7902 __Pyx_RefNannyFinishContext();
7903 return __pyx_r;
7904}
7905
7906/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":953
7907 * raise ImportError("numpy.core.umath failed to import")
7908 *
7909 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
7910 * try:
7911 * _import_umath()
7912 */
7913
7914static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
7915 int __pyx_r;
7916 __Pyx_RefNannyDeclarations
7917 PyObject *__pyx_t_1 = NULL;
7918 PyObject *__pyx_t_2 = NULL;
7919 PyObject *__pyx_t_3 = NULL;
7920 int __pyx_t_4;
7921 PyObject *__pyx_t_5 = NULL;
7922 PyObject *__pyx_t_6 = NULL;
7923 PyObject *__pyx_t_7 = NULL;
7924 PyObject *__pyx_t_8 = NULL;
7925 int __pyx_lineno = 0;
7926 const char *__pyx_filename = NULL;
7927 int __pyx_clineno = 0;
7928 __Pyx_RefNannySetupContext("import_ufunc", 0);
7929
7930 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":954
7931 *
7932 * cdef inline int import_ufunc() except -1:
7933 * try: # <<<<<<<<<<<<<<
7934 * _import_umath()
7935 * except Exception:
7936 */
7937 {
7938 __Pyx_PyThreadState_declare
7939 __Pyx_PyThreadState_assign
7940 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7941 __Pyx_XGOTREF(__pyx_t_1);
7942 __Pyx_XGOTREF(__pyx_t_2);
7943 __Pyx_XGOTREF(__pyx_t_3);
7944 /*try:*/ {
7945
7946 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":955
7947 * cdef inline int import_ufunc() except -1:
7948 * try:
7949 * _import_umath() # <<<<<<<<<<<<<<
7950 * except Exception:
7951 * raise ImportError("numpy.core.umath failed to import")
7952 */
7953 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
7954
7955 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":954
7956 *
7957 * cdef inline int import_ufunc() except -1:
7958 * try: # <<<<<<<<<<<<<<
7959 * _import_umath()
7960 * except Exception:
7961 */
7962 }
7963 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7964 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7965 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7966 goto __pyx_L8_try_end;
7967 __pyx_L3_error:;
7968
7969 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":956
7970 * try:
7971 * _import_umath()
7972 * except Exception: # <<<<<<<<<<<<<<
7973 * raise ImportError("numpy.core.umath failed to import")
7974 *
7975 */
7976 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7977 if (__pyx_t_4) {
7978 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7979 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
7980 __Pyx_GOTREF(__pyx_t_5);
7981 __Pyx_GOTREF(__pyx_t_6);
7982 __Pyx_GOTREF(__pyx_t_7);
7983
7984 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":957
7985 * _import_umath()
7986 * except Exception:
7987 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
7988 *
7989 * cdef extern from *:
7990 */
7991 __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)
7992 __Pyx_GOTREF(__pyx_t_8);
7993 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7994 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7995 __PYX_ERR(1, 957, __pyx_L5_except_error)
7996 }
7997 goto __pyx_L5_except_error;
7998 __pyx_L5_except_error:;
7999
8000 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":954
8001 *
8002 * cdef inline int import_ufunc() except -1:
8003 * try: # <<<<<<<<<<<<<<
8004 * _import_umath()
8005 * except Exception:
8006 */
8007 __Pyx_XGIVEREF(__pyx_t_1);
8008 __Pyx_XGIVEREF(__pyx_t_2);
8009 __Pyx_XGIVEREF(__pyx_t_3);
8010 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
8011 goto __pyx_L1_error;
8012 __pyx_L8_try_end:;
8013 }
8014
8015 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":953
8016 * raise ImportError("numpy.core.umath failed to import")
8017 *
8018 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
8019 * try:
8020 * _import_umath()
8021 */
8022
8023 /* function exit code */
8024 __pyx_r = 0;
8025 goto __pyx_L0;
8026 __pyx_L1_error:;
8027 __Pyx_XDECREF(__pyx_t_5);
8028 __Pyx_XDECREF(__pyx_t_6);
8029 __Pyx_XDECREF(__pyx_t_7);
8030 __Pyx_XDECREF(__pyx_t_8);
8031 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
8032 __pyx_r = -1;
8033 __pyx_L0:;
8034 __Pyx_RefNannyFinishContext();
8035 return __pyx_r;
8036}
8037
8038/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":967
8039 *
8040 *
8041 * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
8042 * """
8043 * Cython equivalent of `isinstance(obj, np.timedelta64)`
8044 */
8045
8046static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
8047 int __pyx_r;
8048 __Pyx_RefNannyDeclarations
8049 __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
8050
8051 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":979
8052 * bool
8053 * """
8054 * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<<
8055 *
8056 *
8057 */
8058 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
8059 goto __pyx_L0;
8060
8061 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":967
8062 *
8063 *
8064 * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
8065 * """
8066 * Cython equivalent of `isinstance(obj, np.timedelta64)`
8067 */
8068
8069 /* function exit code */
8070 __pyx_L0:;
8071 __Pyx_RefNannyFinishContext();
8072 return __pyx_r;
8073}
8074
8075/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":982
8076 *
8077 *
8078 * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
8079 * """
8080 * Cython equivalent of `isinstance(obj, np.datetime64)`
8081 */
8082
8083static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
8084 int __pyx_r;
8085 __Pyx_RefNannyDeclarations
8086 __Pyx_RefNannySetupContext("is_datetime64_object", 0);
8087
8088 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":994
8089 * bool
8090 * """
8091 * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<<
8092 *
8093 *
8094 */
8095 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
8096 goto __pyx_L0;
8097
8098 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":982
8099 *
8100 *
8101 * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
8102 * """
8103 * Cython equivalent of `isinstance(obj, np.datetime64)`
8104 */
8105
8106 /* function exit code */
8107 __pyx_L0:;
8108 __Pyx_RefNannyFinishContext();
8109 return __pyx_r;
8110}
8111
8112/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":997
8113 *
8114 *
8115 * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
8116 * """
8117 * returns the int64 value underlying scalar numpy datetime64 object
8118 */
8119
8120static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
8121 npy_datetime __pyx_r;
8122
8123 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1004
8124 * also needed. That can be found using `get_datetime64_unit`.
8125 * """
8126 * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<<
8127 *
8128 *
8129 */
8130 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
8131 goto __pyx_L0;
8132
8133 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":997
8134 *
8135 *
8136 * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
8137 * """
8138 * returns the int64 value underlying scalar numpy datetime64 object
8139 */
8140
8141 /* function exit code */
8142 __pyx_L0:;
8143 return __pyx_r;
8144}
8145
8146/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1007
8147 *
8148 *
8149 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
8150 * """
8151 * returns the int64 value underlying scalar numpy timedelta64 object
8152 */
8153
8154static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
8155 npy_timedelta __pyx_r;
8156
8157 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1011
8158 * returns the int64 value underlying scalar numpy timedelta64 object
8159 * """
8160 * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<<
8161 *
8162 *
8163 */
8164 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
8165 goto __pyx_L0;
8166
8167 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1007
8168 *
8169 *
8170 * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
8171 * """
8172 * returns the int64 value underlying scalar numpy timedelta64 object
8173 */
8174
8175 /* function exit code */
8176 __pyx_L0:;
8177 return __pyx_r;
8178}
8179
8180/* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1014
8181 *
8182 *
8183 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
8184 * """
8185 * returns the unit part of the dtype for a numpy datetime64 object.
8186 */
8187
8188static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
8189 NPY_DATETIMEUNIT __pyx_r;
8190
8191 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1018
8192 * returns the unit part of the dtype for a numpy datetime64 object.
8193 * """
8194 * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<<
8195 */
8196 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
8197 goto __pyx_L0;
8198
8199 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":1014
8200 *
8201 *
8202 * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
8203 * """
8204 * returns the unit part of the dtype for a numpy datetime64 object.
8205 */
8206
8207 /* function exit code */
8208 __pyx_L0:;
8209 return __pyx_r;
8210}
8211
8212/* "View.MemoryView":122
8213 * cdef bint dtype_is_object
8214 *
8215 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
8216 * mode="c", bint allocate_buffer=True):
8217 *
8218 */
8219
8220/* Python wrapper */
8221static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8222static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8223 PyObject *__pyx_v_shape = 0;
8224 Py_ssize_t __pyx_v_itemsize;
8225 PyObject *__pyx_v_format = 0;
8226 PyObject *__pyx_v_mode = 0;
8227 int __pyx_v_allocate_buffer;
8228 int __pyx_lineno = 0;
8229 const char *__pyx_filename = NULL;
8230 int __pyx_clineno = 0;
8231 int __pyx_r;
8232 __Pyx_RefNannyDeclarations
8233 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
8234 {
8235 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};
8236 PyObject* values[5] = {0,0,0,0,0};
8237 values[3] = ((PyObject *)__pyx_n_s_c);
8238 if (unlikely(__pyx_kwds)) {
8239 Py_ssize_t kw_args;
8240 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8241 switch (pos_args) {
8242 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8243 CYTHON_FALLTHROUGH;
8244 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8245 CYTHON_FALLTHROUGH;
8246 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8247 CYTHON_FALLTHROUGH;
8248 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8249 CYTHON_FALLTHROUGH;
8250 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8251 CYTHON_FALLTHROUGH;
8252 case 0: break;
8253 default: goto __pyx_L5_argtuple_error;
8254 }
8255 kw_args = PyDict_Size(__pyx_kwds);
8256 switch (pos_args) {
8257 case 0:
8258 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
8259 else goto __pyx_L5_argtuple_error;
8260 CYTHON_FALLTHROUGH;
8261 case 1:
8262 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
8263 else {
8264 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
8265 }
8266 CYTHON_FALLTHROUGH;
8267 case 2:
8268 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
8269 else {
8270 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
8271 }
8272 CYTHON_FALLTHROUGH;
8273 case 3:
8274 if (kw_args > 0) {
8275 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
8276 if (value) { values[3] = value; kw_args--; }
8277 }
8278 CYTHON_FALLTHROUGH;
8279 case 4:
8280 if (kw_args > 0) {
8281 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
8282 if (value) { values[4] = value; kw_args--; }
8283 }
8284 }
8285 if (unlikely(kw_args > 0)) {
8286 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
8287 }
8288 } else {
8289 switch (PyTuple_GET_SIZE(__pyx_args)) {
8290 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8291 CYTHON_FALLTHROUGH;
8292 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8293 CYTHON_FALLTHROUGH;
8294 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8295 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8296 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8297 break;
8298 default: goto __pyx_L5_argtuple_error;
8299 }
8300 }
8301 __pyx_v_shape = ((PyObject*)values[0]);
8302 __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)
8303 __pyx_v_format = values[2];
8304 __pyx_v_mode = values[3];
8305 if (values[4]) {
8306 __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)
8307 } else {
8308
8309 /* "View.MemoryView":123
8310 *
8311 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
8312 * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
8313 *
8314 * cdef int idx
8315 */
8316 __pyx_v_allocate_buffer = ((int)1);
8317 }
8318 }
8319 goto __pyx_L4_argument_unpacking_done;
8320 __pyx_L5_argtuple_error:;
8321 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
8322 __pyx_L3_error:;
8323 __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8324 __Pyx_RefNannyFinishContext();
8325 return -1;
8326 __pyx_L4_argument_unpacking_done:;
8327 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
8328 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
8329 PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
8330 }
8331 __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);
8332
8333 /* "View.MemoryView":122
8334 * cdef bint dtype_is_object
8335 *
8336 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
8337 * mode="c", bint allocate_buffer=True):
8338 *
8339 */
8340
8341 /* function exit code */
8342 goto __pyx_L0;
8343 __pyx_L1_error:;
8344 __pyx_r = -1;
8345 __pyx_L0:;
8346 __Pyx_RefNannyFinishContext();
8347 return __pyx_r;
8348}
8349
8350static 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) {
8351 int __pyx_v_idx;
8352 Py_ssize_t __pyx_v_i;
8353 Py_ssize_t __pyx_v_dim;
8354 PyObject **__pyx_v_p;
8355 char __pyx_v_order;
8356 int __pyx_r;
8357 __Pyx_RefNannyDeclarations
8358 Py_ssize_t __pyx_t_1;
8359 int __pyx_t_2;
8360 PyObject *__pyx_t_3 = NULL;
8361 int __pyx_t_4;
8362 PyObject *__pyx_t_5 = NULL;
8363 PyObject *__pyx_t_6 = NULL;
8364 char *__pyx_t_7;
8365 int __pyx_t_8;
8366 Py_ssize_t __pyx_t_9;
8367 PyObject *__pyx_t_10 = NULL;
8368 Py_ssize_t __pyx_t_11;
8369 int __pyx_lineno = 0;
8370 const char *__pyx_filename = NULL;
8371 int __pyx_clineno = 0;
8372 __Pyx_RefNannySetupContext("__cinit__", 0);
8373 __Pyx_INCREF(__pyx_v_format);
8374
8375 /* "View.MemoryView":129
8376 * cdef PyObject **p
8377 *
8378 * self.ndim = <int> len(shape) # <<<<<<<<<<<<<<
8379 * self.itemsize = itemsize
8380 *
8381 */
8382 if (unlikely(__pyx_v_shape == Py_None)) {
8383 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
8384 __PYX_ERR(2, 129, __pyx_L1_error)
8385 }
8386 __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)
8387 __pyx_v_self->ndim = ((int)__pyx_t_1);
8388
8389 /* "View.MemoryView":130
8390 *
8391 * self.ndim = <int> len(shape)
8392 * self.itemsize = itemsize # <<<<<<<<<<<<<<
8393 *
8394 * if not self.ndim:
8395 */
8396 __pyx_v_self->itemsize = __pyx_v_itemsize;
8397
8398 /* "View.MemoryView":132
8399 * self.itemsize = itemsize
8400 *
8401 * if not self.ndim: # <<<<<<<<<<<<<<
8402 * raise ValueError("Empty shape tuple for cython.array")
8403 *
8404 */
8405 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
8406 if (unlikely(__pyx_t_2)) {
8407
8408 /* "View.MemoryView":133
8409 *
8410 * if not self.ndim:
8411 * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
8412 *
8413 * if itemsize <= 0:
8414 */
8415 __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)
8416 __Pyx_GOTREF(__pyx_t_3);
8417 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8418 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8419 __PYX_ERR(2, 133, __pyx_L1_error)
8420
8421 /* "View.MemoryView":132
8422 * self.itemsize = itemsize
8423 *
8424 * if not self.ndim: # <<<<<<<<<<<<<<
8425 * raise ValueError("Empty shape tuple for cython.array")
8426 *
8427 */
8428 }
8429
8430 /* "View.MemoryView":135
8431 * raise ValueError("Empty shape tuple for cython.array")
8432 *
8433 * if itemsize <= 0: # <<<<<<<<<<<<<<
8434 * raise ValueError("itemsize <= 0 for cython.array")
8435 *
8436 */
8437 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
8438 if (unlikely(__pyx_t_2)) {
8439
8440 /* "View.MemoryView":136
8441 *
8442 * if itemsize <= 0:
8443 * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
8444 *
8445 * if not isinstance(format, bytes):
8446 */
8447 __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)
8448 __Pyx_GOTREF(__pyx_t_3);
8449 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8450 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8451 __PYX_ERR(2, 136, __pyx_L1_error)
8452
8453 /* "View.MemoryView":135
8454 * raise ValueError("Empty shape tuple for cython.array")
8455 *
8456 * if itemsize <= 0: # <<<<<<<<<<<<<<
8457 * raise ValueError("itemsize <= 0 for cython.array")
8458 *
8459 */
8460 }
8461
8462 /* "View.MemoryView":138
8463 * raise ValueError("itemsize <= 0 for cython.array")
8464 *
8465 * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
8466 * format = format.encode('ASCII')
8467 * self._format = format # keep a reference to the byte string
8468 */
8469 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
8470 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
8471 if (__pyx_t_4) {
8472
8473 /* "View.MemoryView":139
8474 *
8475 * if not isinstance(format, bytes):
8476 * format = format.encode('ASCII') # <<<<<<<<<<<<<<
8477 * self._format = format # keep a reference to the byte string
8478 * self.format = self._format
8479 */
8480 __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)
8481 __Pyx_GOTREF(__pyx_t_5);
8482 __pyx_t_6 = NULL;
8483 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
8484 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8485 if (likely(__pyx_t_6)) {
8486 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8487 __Pyx_INCREF(__pyx_t_6);
8488 __Pyx_INCREF(function);
8489 __Pyx_DECREF_SET(__pyx_t_5, function);
8490 }
8491 }
8492 __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);
8493 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8494 if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
8495 __Pyx_GOTREF(__pyx_t_3);
8496 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8497 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
8498 __pyx_t_3 = 0;
8499
8500 /* "View.MemoryView":138
8501 * raise ValueError("itemsize <= 0 for cython.array")
8502 *
8503 * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
8504 * format = format.encode('ASCII')
8505 * self._format = format # keep a reference to the byte string
8506 */
8507 }
8508
8509 /* "View.MemoryView":140
8510 * if not isinstance(format, bytes):
8511 * format = format.encode('ASCII')
8512 * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
8513 * self.format = self._format
8514 *
8515 */
8516 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)
8517 __pyx_t_3 = __pyx_v_format;
8518 __Pyx_INCREF(__pyx_t_3);
8519 __Pyx_GIVEREF(__pyx_t_3);
8520 __Pyx_GOTREF(__pyx_v_self->_format);
8521 __Pyx_DECREF(__pyx_v_self->_format);
8522 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
8523 __pyx_t_3 = 0;
8524
8525 /* "View.MemoryView":141
8526 * format = format.encode('ASCII')
8527 * self._format = format # keep a reference to the byte string
8528 * self.format = self._format # <<<<<<<<<<<<<<
8529 *
8530 *
8531 */
8532 if (unlikely(__pyx_v_self->_format == Py_None)) {
8533 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
8534 __PYX_ERR(2, 141, __pyx_L1_error)
8535 }
8536 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
8537 __pyx_v_self->format = __pyx_t_7;
8538
8539 /* "View.MemoryView":144
8540 *
8541 *
8542 * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
8543 * self._strides = self._shape + self.ndim
8544 *
8545 */
8546 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
8547
8548 /* "View.MemoryView":145
8549 *
8550 * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
8551 * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
8552 *
8553 * if not self._shape:
8554 */
8555 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
8556
8557 /* "View.MemoryView":147
8558 * self._strides = self._shape + self.ndim
8559 *
8560 * if not self._shape: # <<<<<<<<<<<<<<
8561 * raise MemoryError("unable to allocate shape and strides.")
8562 *
8563 */
8564 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
8565 if (unlikely(__pyx_t_4)) {
8566
8567 /* "View.MemoryView":148
8568 *
8569 * if not self._shape:
8570 * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
8571 *
8572 *
8573 */
8574 __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)
8575 __Pyx_GOTREF(__pyx_t_3);
8576 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8577 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8578 __PYX_ERR(2, 148, __pyx_L1_error)
8579
8580 /* "View.MemoryView":147
8581 * self._strides = self._shape + self.ndim
8582 *
8583 * if not self._shape: # <<<<<<<<<<<<<<
8584 * raise MemoryError("unable to allocate shape and strides.")
8585 *
8586 */
8587 }
8588
8589 /* "View.MemoryView":151
8590 *
8591 *
8592 * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
8593 * if dim <= 0:
8594 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
8595 */
8596 __pyx_t_8 = 0;
8597 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
8598 for (;;) {
8599 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
8600 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8601 __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)
8602 #else
8603 __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)
8604 __Pyx_GOTREF(__pyx_t_5);
8605 #endif
8606 __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)
8607 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8608 __pyx_v_dim = __pyx_t_9;
8609 __pyx_v_idx = __pyx_t_8;
8610 __pyx_t_8 = (__pyx_t_8 + 1);
8611
8612 /* "View.MemoryView":152
8613 *
8614 * for idx, dim in enumerate(shape):
8615 * if dim <= 0: # <<<<<<<<<<<<<<
8616 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
8617 * self._shape[idx] = dim
8618 */
8619 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
8620 if (unlikely(__pyx_t_4)) {
8621
8622 /* "View.MemoryView":153
8623 * for idx, dim in enumerate(shape):
8624 * if dim <= 0:
8625 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<<
8626 * self._shape[idx] = dim
8627 *
8628 */
8629 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
8630 __Pyx_GOTREF(__pyx_t_5);
8631 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
8632 __Pyx_GOTREF(__pyx_t_6);
8633 __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
8634 __Pyx_GOTREF(__pyx_t_10);
8635 __Pyx_GIVEREF(__pyx_t_5);
8636 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
8637 __Pyx_GIVEREF(__pyx_t_6);
8638 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
8639 __pyx_t_5 = 0;
8640 __pyx_t_6 = 0;
8641 __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)
8642 __Pyx_GOTREF(__pyx_t_6);
8643 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8644 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
8645 __Pyx_GOTREF(__pyx_t_10);
8646 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8647 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8648 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8649 __PYX_ERR(2, 153, __pyx_L1_error)
8650
8651 /* "View.MemoryView":152
8652 *
8653 * for idx, dim in enumerate(shape):
8654 * if dim <= 0: # <<<<<<<<<<<<<<
8655 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
8656 * self._shape[idx] = dim
8657 */
8658 }
8659
8660 /* "View.MemoryView":154
8661 * if dim <= 0:
8662 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
8663 * self._shape[idx] = dim # <<<<<<<<<<<<<<
8664 *
8665 * cdef char order
8666 */
8667 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
8668
8669 /* "View.MemoryView":151
8670 *
8671 *
8672 * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
8673 * if dim <= 0:
8674 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
8675 */
8676 }
8677 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8678
8679 /* "View.MemoryView":157
8680 *
8681 * cdef char order
8682 * if mode == 'fortran': # <<<<<<<<<<<<<<
8683 * order = b'F'
8684 * self.mode = u'fortran'
8685 */
8686 __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)
8687 if (__pyx_t_4) {
8688
8689 /* "View.MemoryView":158
8690 * cdef char order
8691 * if mode == 'fortran':
8692 * order = b'F' # <<<<<<<<<<<<<<
8693 * self.mode = u'fortran'
8694 * elif mode == 'c':
8695 */
8696 __pyx_v_order = 'F';
8697
8698 /* "View.MemoryView":159
8699 * if mode == 'fortran':
8700 * order = b'F'
8701 * self.mode = u'fortran' # <<<<<<<<<<<<<<
8702 * elif mode == 'c':
8703 * order = b'C'
8704 */
8705 __Pyx_INCREF(__pyx_n_u_fortran);
8706 __Pyx_GIVEREF(__pyx_n_u_fortran);
8707 __Pyx_GOTREF(__pyx_v_self->mode);
8708 __Pyx_DECREF(__pyx_v_self->mode);
8709 __pyx_v_self->mode = __pyx_n_u_fortran;
8710
8711 /* "View.MemoryView":157
8712 *
8713 * cdef char order
8714 * if mode == 'fortran': # <<<<<<<<<<<<<<
8715 * order = b'F'
8716 * self.mode = u'fortran'
8717 */
8718 goto __pyx_L10;
8719 }
8720
8721 /* "View.MemoryView":160
8722 * order = b'F'
8723 * self.mode = u'fortran'
8724 * elif mode == 'c': # <<<<<<<<<<<<<<
8725 * order = b'C'
8726 * self.mode = u'c'
8727 */
8728 __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)
8729 if (likely(__pyx_t_4)) {
8730
8731 /* "View.MemoryView":161
8732 * self.mode = u'fortran'
8733 * elif mode == 'c':
8734 * order = b'C' # <<<<<<<<<<<<<<
8735 * self.mode = u'c'
8736 * else:
8737 */
8738 __pyx_v_order = 'C';
8739
8740 /* "View.MemoryView":162
8741 * elif mode == 'c':
8742 * order = b'C'
8743 * self.mode = u'c' # <<<<<<<<<<<<<<
8744 * else:
8745 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
8746 */
8747 __Pyx_INCREF(__pyx_n_u_c);
8748 __Pyx_GIVEREF(__pyx_n_u_c);
8749 __Pyx_GOTREF(__pyx_v_self->mode);
8750 __Pyx_DECREF(__pyx_v_self->mode);
8751 __pyx_v_self->mode = __pyx_n_u_c;
8752
8753 /* "View.MemoryView":160
8754 * order = b'F'
8755 * self.mode = u'fortran'
8756 * elif mode == 'c': # <<<<<<<<<<<<<<
8757 * order = b'C'
8758 * self.mode = u'c'
8759 */
8760 goto __pyx_L10;
8761 }
8762
8763 /* "View.MemoryView":164
8764 * self.mode = u'c'
8765 * else:
8766 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
8767 *
8768 * self.len = fill_contig_strides_array(self._shape, self._strides,
8769 */
8770 /*else*/ {
8771 __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)
8772 __Pyx_GOTREF(__pyx_t_3);
8773 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
8774 __Pyx_GOTREF(__pyx_t_10);
8775 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8776 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8777 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8778 __PYX_ERR(2, 164, __pyx_L1_error)
8779 }
8780 __pyx_L10:;
8781
8782 /* "View.MemoryView":166
8783 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
8784 *
8785 * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
8786 * itemsize, self.ndim, order)
8787 *
8788 */
8789 __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);
8790
8791 /* "View.MemoryView":169
8792 * itemsize, self.ndim, order)
8793 *
8794 * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
8795 * self.dtype_is_object = format == b'O'
8796 * if allocate_buffer:
8797 */
8798 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
8799
8800 /* "View.MemoryView":170
8801 *
8802 * self.free_data = allocate_buffer
8803 * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
8804 * if allocate_buffer:
8805 *
8806 */
8807 __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)
8808 __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)
8809 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8810 __pyx_v_self->dtype_is_object = __pyx_t_4;
8811
8812 /* "View.MemoryView":171
8813 * self.free_data = allocate_buffer
8814 * self.dtype_is_object = format == b'O'
8815 * if allocate_buffer: # <<<<<<<<<<<<<<
8816 *
8817 *
8818 */
8819 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
8820 if (__pyx_t_4) {
8821
8822 /* "View.MemoryView":174
8823 *
8824 *
8825 * self.data = <char *>malloc(self.len) # <<<<<<<<<<<<<<
8826 * if not self.data:
8827 * raise MemoryError("unable to allocate array data.")
8828 */
8829 __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
8830
8831 /* "View.MemoryView":175
8832 *
8833 * self.data = <char *>malloc(self.len)
8834 * if not self.data: # <<<<<<<<<<<<<<
8835 * raise MemoryError("unable to allocate array data.")
8836 *
8837 */
8838 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
8839 if (unlikely(__pyx_t_4)) {
8840
8841 /* "View.MemoryView":176
8842 * self.data = <char *>malloc(self.len)
8843 * if not self.data:
8844 * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
8845 *
8846 * if self.dtype_is_object:
8847 */
8848 __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)
8849 __Pyx_GOTREF(__pyx_t_10);
8850 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8851 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8852 __PYX_ERR(2, 176, __pyx_L1_error)
8853
8854 /* "View.MemoryView":175
8855 *
8856 * self.data = <char *>malloc(self.len)
8857 * if not self.data: # <<<<<<<<<<<<<<
8858 * raise MemoryError("unable to allocate array data.")
8859 *
8860 */
8861 }
8862
8863 /* "View.MemoryView":178
8864 * raise MemoryError("unable to allocate array data.")
8865 *
8866 * if self.dtype_is_object: # <<<<<<<<<<<<<<
8867 * p = <PyObject **> self.data
8868 * for i in range(self.len / itemsize):
8869 */
8870 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
8871 if (__pyx_t_4) {
8872
8873 /* "View.MemoryView":179
8874 *
8875 * if self.dtype_is_object:
8876 * p = <PyObject **> self.data # <<<<<<<<<<<<<<
8877 * for i in range(self.len / itemsize):
8878 * p[i] = Py_None
8879 */
8880 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
8881
8882 /* "View.MemoryView":180
8883 * if self.dtype_is_object:
8884 * p = <PyObject **> self.data
8885 * for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
8886 * p[i] = Py_None
8887 * Py_INCREF(Py_None)
8888 */
8889 if (unlikely(__pyx_v_itemsize == 0)) {
8890 PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
8891 __PYX_ERR(2, 180, __pyx_L1_error)
8892 }
8893 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))) {
8894 PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
8895 __PYX_ERR(2, 180, __pyx_L1_error)
8896 }
8897 __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
8898 __pyx_t_9 = __pyx_t_1;
8899 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
8900 __pyx_v_i = __pyx_t_11;
8901
8902 /* "View.MemoryView":181
8903 * p = <PyObject **> self.data
8904 * for i in range(self.len / itemsize):
8905 * p[i] = Py_None # <<<<<<<<<<<<<<
8906 * Py_INCREF(Py_None)
8907 *
8908 */
8909 (__pyx_v_p[__pyx_v_i]) = Py_None;
8910
8911 /* "View.MemoryView":182
8912 * for i in range(self.len / itemsize):
8913 * p[i] = Py_None
8914 * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
8915 *
8916 * @cname('getbuffer')
8917 */
8918 Py_INCREF(Py_None);
8919 }
8920
8921 /* "View.MemoryView":178
8922 * raise MemoryError("unable to allocate array data.")
8923 *
8924 * if self.dtype_is_object: # <<<<<<<<<<<<<<
8925 * p = <PyObject **> self.data
8926 * for i in range(self.len / itemsize):
8927 */
8928 }
8929
8930 /* "View.MemoryView":171
8931 * self.free_data = allocate_buffer
8932 * self.dtype_is_object = format == b'O'
8933 * if allocate_buffer: # <<<<<<<<<<<<<<
8934 *
8935 *
8936 */
8937 }
8938
8939 /* "View.MemoryView":122
8940 * cdef bint dtype_is_object
8941 *
8942 * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
8943 * mode="c", bint allocate_buffer=True):
8944 *
8945 */
8946
8947 /* function exit code */
8948 __pyx_r = 0;
8949 goto __pyx_L0;
8950 __pyx_L1_error:;
8951 __Pyx_XDECREF(__pyx_t_3);
8952 __Pyx_XDECREF(__pyx_t_5);
8953 __Pyx_XDECREF(__pyx_t_6);
8954 __Pyx_XDECREF(__pyx_t_10);
8955 __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8956 __pyx_r = -1;
8957 __pyx_L0:;
8958 __Pyx_XDECREF(__pyx_v_format);
8959 __Pyx_RefNannyFinishContext();
8960 return __pyx_r;
8961}
8962
8963/* "View.MemoryView":185
8964 *
8965 * @cname('getbuffer')
8966 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
8967 * cdef int bufmode = -1
8968 * if self.mode == u"c":
8969 */
8970
8971/* Python wrapper */
8972static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
8973static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
8974 int __pyx_r;
8975 __Pyx_RefNannyDeclarations
8976 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
8977 __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));
8978
8979 /* function exit code */
8980 __Pyx_RefNannyFinishContext();
8981 return __pyx_r;
8982}
8983
8984static 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) {
8985 int __pyx_v_bufmode;
8986 int __pyx_r;
8987 __Pyx_RefNannyDeclarations
8988 int __pyx_t_1;
8989 int __pyx_t_2;
8990 PyObject *__pyx_t_3 = NULL;
8991 char *__pyx_t_4;
8992 Py_ssize_t __pyx_t_5;
8993 int __pyx_t_6;
8994 Py_ssize_t *__pyx_t_7;
8995 int __pyx_lineno = 0;
8996 const char *__pyx_filename = NULL;
8997 int __pyx_clineno = 0;
8998 if (__pyx_v_info == NULL) {
8999 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
9000 return -1;
9001 }
9002 __Pyx_RefNannySetupContext("__getbuffer__", 0);
9003 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
9004 __Pyx_GIVEREF(__pyx_v_info->obj);
9005
9006 /* "View.MemoryView":186
9007 * @cname('getbuffer')
9008 * def __getbuffer__(self, Py_buffer *info, int flags):
9009 * cdef int bufmode = -1 # <<<<<<<<<<<<<<
9010 * if self.mode == u"c":
9011 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9012 */
9013 __pyx_v_bufmode = -1;
9014
9015 /* "View.MemoryView":187
9016 * def __getbuffer__(self, Py_buffer *info, int flags):
9017 * cdef int bufmode = -1
9018 * if self.mode == u"c": # <<<<<<<<<<<<<<
9019 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9020 * elif self.mode == u"fortran":
9021 */
9022 __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)
9023 __pyx_t_2 = (__pyx_t_1 != 0);
9024 if (__pyx_t_2) {
9025
9026 /* "View.MemoryView":188
9027 * cdef int bufmode = -1
9028 * if self.mode == u"c":
9029 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
9030 * elif self.mode == u"fortran":
9031 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9032 */
9033 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
9034
9035 /* "View.MemoryView":187
9036 * def __getbuffer__(self, Py_buffer *info, int flags):
9037 * cdef int bufmode = -1
9038 * if self.mode == u"c": # <<<<<<<<<<<<<<
9039 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9040 * elif self.mode == u"fortran":
9041 */
9042 goto __pyx_L3;
9043 }
9044
9045 /* "View.MemoryView":189
9046 * if self.mode == u"c":
9047 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9048 * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
9049 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9050 * if not (flags & bufmode):
9051 */
9052 __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)
9053 __pyx_t_1 = (__pyx_t_2 != 0);
9054 if (__pyx_t_1) {
9055
9056 /* "View.MemoryView":190
9057 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9058 * elif self.mode == u"fortran":
9059 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
9060 * if not (flags & bufmode):
9061 * raise ValueError("Can only create a buffer that is contiguous in memory.")
9062 */
9063 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
9064
9065 /* "View.MemoryView":189
9066 * if self.mode == u"c":
9067 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9068 * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
9069 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9070 * if not (flags & bufmode):
9071 */
9072 }
9073 __pyx_L3:;
9074
9075 /* "View.MemoryView":191
9076 * elif self.mode == u"fortran":
9077 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9078 * if not (flags & bufmode): # <<<<<<<<<<<<<<
9079 * raise ValueError("Can only create a buffer that is contiguous in memory.")
9080 * info.buf = self.data
9081 */
9082 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
9083 if (unlikely(__pyx_t_1)) {
9084
9085 /* "View.MemoryView":192
9086 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9087 * if not (flags & bufmode):
9088 * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
9089 * info.buf = self.data
9090 * info.len = self.len
9091 */
9092 __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)
9093 __Pyx_GOTREF(__pyx_t_3);
9094 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9095 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9096 __PYX_ERR(2, 192, __pyx_L1_error)
9097
9098 /* "View.MemoryView":191
9099 * elif self.mode == u"fortran":
9100 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9101 * if not (flags & bufmode): # <<<<<<<<<<<<<<
9102 * raise ValueError("Can only create a buffer that is contiguous in memory.")
9103 * info.buf = self.data
9104 */
9105 }
9106
9107 /* "View.MemoryView":193
9108 * if not (flags & bufmode):
9109 * raise ValueError("Can only create a buffer that is contiguous in memory.")
9110 * info.buf = self.data # <<<<<<<<<<<<<<
9111 * info.len = self.len
9112 * info.ndim = self.ndim
9113 */
9114 __pyx_t_4 = __pyx_v_self->data;
9115 __pyx_v_info->buf = __pyx_t_4;
9116
9117 /* "View.MemoryView":194
9118 * raise ValueError("Can only create a buffer that is contiguous in memory.")
9119 * info.buf = self.data
9120 * info.len = self.len # <<<<<<<<<<<<<<
9121 * info.ndim = self.ndim
9122 * info.shape = self._shape
9123 */
9124 __pyx_t_5 = __pyx_v_self->len;
9125 __pyx_v_info->len = __pyx_t_5;
9126
9127 /* "View.MemoryView":195
9128 * info.buf = self.data
9129 * info.len = self.len
9130 * info.ndim = self.ndim # <<<<<<<<<<<<<<
9131 * info.shape = self._shape
9132 * info.strides = self._strides
9133 */
9134 __pyx_t_6 = __pyx_v_self->ndim;
9135 __pyx_v_info->ndim = __pyx_t_6;
9136
9137 /* "View.MemoryView":196
9138 * info.len = self.len
9139 * info.ndim = self.ndim
9140 * info.shape = self._shape # <<<<<<<<<<<<<<
9141 * info.strides = self._strides
9142 * info.suboffsets = NULL
9143 */
9144 __pyx_t_7 = __pyx_v_self->_shape;
9145 __pyx_v_info->shape = __pyx_t_7;
9146
9147 /* "View.MemoryView":197
9148 * info.ndim = self.ndim
9149 * info.shape = self._shape
9150 * info.strides = self._strides # <<<<<<<<<<<<<<
9151 * info.suboffsets = NULL
9152 * info.itemsize = self.itemsize
9153 */
9154 __pyx_t_7 = __pyx_v_self->_strides;
9155 __pyx_v_info->strides = __pyx_t_7;
9156
9157 /* "View.MemoryView":198
9158 * info.shape = self._shape
9159 * info.strides = self._strides
9160 * info.suboffsets = NULL # <<<<<<<<<<<<<<
9161 * info.itemsize = self.itemsize
9162 * info.readonly = 0
9163 */
9164 __pyx_v_info->suboffsets = NULL;
9165
9166 /* "View.MemoryView":199
9167 * info.strides = self._strides
9168 * info.suboffsets = NULL
9169 * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
9170 * info.readonly = 0
9171 *
9172 */
9173 __pyx_t_5 = __pyx_v_self->itemsize;
9174 __pyx_v_info->itemsize = __pyx_t_5;
9175
9176 /* "View.MemoryView":200
9177 * info.suboffsets = NULL
9178 * info.itemsize = self.itemsize
9179 * info.readonly = 0 # <<<<<<<<<<<<<<
9180 *
9181 * if flags & PyBUF_FORMAT:
9182 */
9183 __pyx_v_info->readonly = 0;
9184
9185 /* "View.MemoryView":202
9186 * info.readonly = 0
9187 *
9188 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
9189 * info.format = self.format
9190 * else:
9191 */
9192 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9193 if (__pyx_t_1) {
9194
9195 /* "View.MemoryView":203
9196 *
9197 * if flags & PyBUF_FORMAT:
9198 * info.format = self.format # <<<<<<<<<<<<<<
9199 * else:
9200 * info.format = NULL
9201 */
9202 __pyx_t_4 = __pyx_v_self->format;
9203 __pyx_v_info->format = __pyx_t_4;
9204
9205 /* "View.MemoryView":202
9206 * info.readonly = 0
9207 *
9208 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
9209 * info.format = self.format
9210 * else:
9211 */
9212 goto __pyx_L5;
9213 }
9214
9215 /* "View.MemoryView":205
9216 * info.format = self.format
9217 * else:
9218 * info.format = NULL # <<<<<<<<<<<<<<
9219 *
9220 * info.obj = self
9221 */
9222 /*else*/ {
9223 __pyx_v_info->format = NULL;
9224 }
9225 __pyx_L5:;
9226
9227 /* "View.MemoryView":207
9228 * info.format = NULL
9229 *
9230 * info.obj = self # <<<<<<<<<<<<<<
9231 *
9232 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
9233 */
9234 __Pyx_INCREF(((PyObject *)__pyx_v_self));
9235 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9236 __Pyx_GOTREF(__pyx_v_info->obj);
9237 __Pyx_DECREF(__pyx_v_info->obj);
9238 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
9239
9240 /* "View.MemoryView":185
9241 *
9242 * @cname('getbuffer')
9243 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
9244 * cdef int bufmode = -1
9245 * if self.mode == u"c":
9246 */
9247
9248 /* function exit code */
9249 __pyx_r = 0;
9250 goto __pyx_L0;
9251 __pyx_L1_error:;
9252 __Pyx_XDECREF(__pyx_t_3);
9253 __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9254 __pyx_r = -1;
9255 if (__pyx_v_info->obj != NULL) {
9256 __Pyx_GOTREF(__pyx_v_info->obj);
9257 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9258 }
9259 goto __pyx_L2;
9260 __pyx_L0:;
9261 if (__pyx_v_info->obj == Py_None) {
9262 __Pyx_GOTREF(__pyx_v_info->obj);
9263 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9264 }
9265 __pyx_L2:;
9266 __Pyx_RefNannyFinishContext();
9267 return __pyx_r;
9268}
9269
9270/* "View.MemoryView":211
9271 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
9272 *
9273 * def __dealloc__(array self): # <<<<<<<<<<<<<<
9274 * if self.callback_free_data != NULL:
9275 * self.callback_free_data(self.data)
9276 */
9277
9278/* Python wrapper */
9279static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
9280static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
9281 __Pyx_RefNannyDeclarations
9282 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
9283 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
9284
9285 /* function exit code */
9286 __Pyx_RefNannyFinishContext();
9287}
9288
9289static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
9290 __Pyx_RefNannyDeclarations
9291 int __pyx_t_1;
9292 __Pyx_RefNannySetupContext("__dealloc__", 0);
9293
9294 /* "View.MemoryView":212
9295 *
9296 * def __dealloc__(array self):
9297 * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
9298 * self.callback_free_data(self.data)
9299 * elif self.free_data:
9300 */
9301 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
9302 if (__pyx_t_1) {
9303
9304 /* "View.MemoryView":213
9305 * def __dealloc__(array self):
9306 * if self.callback_free_data != NULL:
9307 * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
9308 * elif self.free_data:
9309 * if self.dtype_is_object:
9310 */
9311 __pyx_v_self->callback_free_data(__pyx_v_self->data);
9312
9313 /* "View.MemoryView":212
9314 *
9315 * def __dealloc__(array self):
9316 * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
9317 * self.callback_free_data(self.data)
9318 * elif self.free_data:
9319 */
9320 goto __pyx_L3;
9321 }
9322
9323 /* "View.MemoryView":214
9324 * if self.callback_free_data != NULL:
9325 * self.callback_free_data(self.data)
9326 * elif self.free_data: # <<<<<<<<<<<<<<
9327 * if self.dtype_is_object:
9328 * refcount_objects_in_slice(self.data, self._shape,
9329 */
9330 __pyx_t_1 = (__pyx_v_self->free_data != 0);
9331 if (__pyx_t_1) {
9332
9333 /* "View.MemoryView":215
9334 * self.callback_free_data(self.data)
9335 * elif self.free_data:
9336 * if self.dtype_is_object: # <<<<<<<<<<<<<<
9337 * refcount_objects_in_slice(self.data, self._shape,
9338 * self._strides, self.ndim, False)
9339 */
9340 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
9341 if (__pyx_t_1) {
9342
9343 /* "View.MemoryView":216
9344 * elif self.free_data:
9345 * if self.dtype_is_object:
9346 * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<<
9347 * self._strides, self.ndim, False)
9348 * free(self.data)
9349 */
9350 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
9351
9352 /* "View.MemoryView":215
9353 * self.callback_free_data(self.data)
9354 * elif self.free_data:
9355 * if self.dtype_is_object: # <<<<<<<<<<<<<<
9356 * refcount_objects_in_slice(self.data, self._shape,
9357 * self._strides, self.ndim, False)
9358 */
9359 }
9360
9361 /* "View.MemoryView":218
9362 * refcount_objects_in_slice(self.data, self._shape,
9363 * self._strides, self.ndim, False)
9364 * free(self.data) # <<<<<<<<<<<<<<
9365 * PyObject_Free(self._shape)
9366 *
9367 */
9368 free(__pyx_v_self->data);
9369
9370 /* "View.MemoryView":214
9371 * if self.callback_free_data != NULL:
9372 * self.callback_free_data(self.data)
9373 * elif self.free_data: # <<<<<<<<<<<<<<
9374 * if self.dtype_is_object:
9375 * refcount_objects_in_slice(self.data, self._shape,
9376 */
9377 }
9378 __pyx_L3:;
9379
9380 /* "View.MemoryView":219
9381 * self._strides, self.ndim, False)
9382 * free(self.data)
9383 * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
9384 *
9385 * @property
9386 */
9387 PyObject_Free(__pyx_v_self->_shape);
9388
9389 /* "View.MemoryView":211
9390 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
9391 *
9392 * def __dealloc__(array self): # <<<<<<<<<<<<<<
9393 * if self.callback_free_data != NULL:
9394 * self.callback_free_data(self.data)
9395 */
9396
9397 /* function exit code */
9398 __Pyx_RefNannyFinishContext();
9399}
9400
9401/* "View.MemoryView":222
9402 *
9403 * @property
9404 * def memview(self): # <<<<<<<<<<<<<<
9405 * return self.get_memview()
9406 *
9407 */
9408
9409/* Python wrapper */
9410static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
9411static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
9412 PyObject *__pyx_r = 0;
9413 __Pyx_RefNannyDeclarations
9414 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
9415 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
9416
9417 /* function exit code */
9418 __Pyx_RefNannyFinishContext();
9419 return __pyx_r;
9420}
9421
9422static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
9423 PyObject *__pyx_r = NULL;
9424 __Pyx_RefNannyDeclarations
9425 PyObject *__pyx_t_1 = NULL;
9426 int __pyx_lineno = 0;
9427 const char *__pyx_filename = NULL;
9428 int __pyx_clineno = 0;
9429 __Pyx_RefNannySetupContext("__get__", 0);
9430
9431 /* "View.MemoryView":223
9432 * @property
9433 * def memview(self):
9434 * return self.get_memview() # <<<<<<<<<<<<<<
9435 *
9436 * @cname('get_memview')
9437 */
9438 __Pyx_XDECREF(__pyx_r);
9439 __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)
9440 __Pyx_GOTREF(__pyx_t_1);
9441 __pyx_r = __pyx_t_1;
9442 __pyx_t_1 = 0;
9443 goto __pyx_L0;
9444
9445 /* "View.MemoryView":222
9446 *
9447 * @property
9448 * def memview(self): # <<<<<<<<<<<<<<
9449 * return self.get_memview()
9450 *
9451 */
9452
9453 /* function exit code */
9454 __pyx_L1_error:;
9455 __Pyx_XDECREF(__pyx_t_1);
9456 __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9457 __pyx_r = NULL;
9458 __pyx_L0:;
9459 __Pyx_XGIVEREF(__pyx_r);
9460 __Pyx_RefNannyFinishContext();
9461 return __pyx_r;
9462}
9463
9464/* "View.MemoryView":226
9465 *
9466 * @cname('get_memview')
9467 * cdef get_memview(self): # <<<<<<<<<<<<<<
9468 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
9469 * return memoryview(self, flags, self.dtype_is_object)
9470 */
9471
9472static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
9473 int __pyx_v_flags;
9474 PyObject *__pyx_r = NULL;
9475 __Pyx_RefNannyDeclarations
9476 PyObject *__pyx_t_1 = NULL;
9477 PyObject *__pyx_t_2 = NULL;
9478 PyObject *__pyx_t_3 = NULL;
9479 int __pyx_lineno = 0;
9480 const char *__pyx_filename = NULL;
9481 int __pyx_clineno = 0;
9482 __Pyx_RefNannySetupContext("get_memview", 0);
9483
9484 /* "View.MemoryView":227
9485 * @cname('get_memview')
9486 * cdef get_memview(self):
9487 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
9488 * return memoryview(self, flags, self.dtype_is_object)
9489 *
9490 */
9491 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
9492
9493 /* "View.MemoryView":228
9494 * cdef get_memview(self):
9495 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
9496 * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
9497 *
9498 * def __len__(self):
9499 */
9500 __Pyx_XDECREF(__pyx_r);
9501 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
9502 __Pyx_GOTREF(__pyx_t_1);
9503 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
9504 __Pyx_GOTREF(__pyx_t_2);
9505 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
9506 __Pyx_GOTREF(__pyx_t_3);
9507 __Pyx_INCREF(((PyObject *)__pyx_v_self));
9508 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9509 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
9510 __Pyx_GIVEREF(__pyx_t_1);
9511 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
9512 __Pyx_GIVEREF(__pyx_t_2);
9513 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
9514 __pyx_t_1 = 0;
9515 __pyx_t_2 = 0;
9516 __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)
9517 __Pyx_GOTREF(__pyx_t_2);
9518 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9519 __pyx_r = __pyx_t_2;
9520 __pyx_t_2 = 0;
9521 goto __pyx_L0;
9522
9523 /* "View.MemoryView":226
9524 *
9525 * @cname('get_memview')
9526 * cdef get_memview(self): # <<<<<<<<<<<<<<
9527 * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
9528 * return memoryview(self, flags, self.dtype_is_object)
9529 */
9530
9531 /* function exit code */
9532 __pyx_L1_error:;
9533 __Pyx_XDECREF(__pyx_t_1);
9534 __Pyx_XDECREF(__pyx_t_2);
9535 __Pyx_XDECREF(__pyx_t_3);
9536 __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
9537 __pyx_r = 0;
9538 __pyx_L0:;
9539 __Pyx_XGIVEREF(__pyx_r);
9540 __Pyx_RefNannyFinishContext();
9541 return __pyx_r;
9542}
9543
9544/* "View.MemoryView":230
9545 * return memoryview(self, flags, self.dtype_is_object)
9546 *
9547 * def __len__(self): # <<<<<<<<<<<<<<
9548 * return self._shape[0]
9549 *
9550 */
9551
9552/* Python wrapper */
9553static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
9554static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
9555 Py_ssize_t __pyx_r;
9556 __Pyx_RefNannyDeclarations
9557 __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
9558 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
9559
9560 /* function exit code */
9561 __Pyx_RefNannyFinishContext();
9562 return __pyx_r;
9563}
9564
9565static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
9566 Py_ssize_t __pyx_r;
9567 __Pyx_RefNannyDeclarations
9568 __Pyx_RefNannySetupContext("__len__", 0);
9569
9570 /* "View.MemoryView":231
9571 *
9572 * def __len__(self):
9573 * return self._shape[0] # <<<<<<<<<<<<<<
9574 *
9575 * def __getattr__(self, attr):
9576 */
9577 __pyx_r = (__pyx_v_self->_shape[0]);
9578 goto __pyx_L0;
9579
9580 /* "View.MemoryView":230
9581 * return memoryview(self, flags, self.dtype_is_object)
9582 *
9583 * def __len__(self): # <<<<<<<<<<<<<<
9584 * return self._shape[0]
9585 *
9586 */
9587
9588 /* function exit code */
9589 __pyx_L0:;
9590 __Pyx_RefNannyFinishContext();
9591 return __pyx_r;
9592}
9593
9594/* "View.MemoryView":233
9595 * return self._shape[0]
9596 *
9597 * def __getattr__(self, attr): # <<<<<<<<<<<<<<
9598 * return getattr(self.memview, attr)
9599 *
9600 */
9601
9602/* Python wrapper */
9603static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
9604static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
9605 PyObject *__pyx_r = 0;
9606 __Pyx_RefNannyDeclarations
9607 __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
9608 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
9609
9610 /* function exit code */
9611 __Pyx_RefNannyFinishContext();
9612 return __pyx_r;
9613}
9614
9615static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
9616 PyObject *__pyx_r = NULL;
9617 __Pyx_RefNannyDeclarations
9618 PyObject *__pyx_t_1 = NULL;
9619 PyObject *__pyx_t_2 = NULL;
9620 int __pyx_lineno = 0;
9621 const char *__pyx_filename = NULL;
9622 int __pyx_clineno = 0;
9623 __Pyx_RefNannySetupContext("__getattr__", 0);
9624
9625 /* "View.MemoryView":234
9626 *
9627 * def __getattr__(self, attr):
9628 * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
9629 *
9630 * def __getitem__(self, item):
9631 */
9632 __Pyx_XDECREF(__pyx_r);
9633 __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)
9634 __Pyx_GOTREF(__pyx_t_1);
9635 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
9636 __Pyx_GOTREF(__pyx_t_2);
9637 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9638 __pyx_r = __pyx_t_2;
9639 __pyx_t_2 = 0;
9640 goto __pyx_L0;
9641
9642 /* "View.MemoryView":233
9643 * return self._shape[0]
9644 *
9645 * def __getattr__(self, attr): # <<<<<<<<<<<<<<
9646 * return getattr(self.memview, attr)
9647 *
9648 */
9649
9650 /* function exit code */
9651 __pyx_L1_error:;
9652 __Pyx_XDECREF(__pyx_t_1);
9653 __Pyx_XDECREF(__pyx_t_2);
9654 __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9655 __pyx_r = NULL;
9656 __pyx_L0:;
9657 __Pyx_XGIVEREF(__pyx_r);
9658 __Pyx_RefNannyFinishContext();
9659 return __pyx_r;
9660}
9661
9662/* "View.MemoryView":236
9663 * return getattr(self.memview, attr)
9664 *
9665 * def __getitem__(self, item): # <<<<<<<<<<<<<<
9666 * return self.memview[item]
9667 *
9668 */
9669
9670/* Python wrapper */
9671static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
9672static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
9673 PyObject *__pyx_r = 0;
9674 __Pyx_RefNannyDeclarations
9675 __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
9676 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
9677
9678 /* function exit code */
9679 __Pyx_RefNannyFinishContext();
9680 return __pyx_r;
9681}
9682
9683static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
9684 PyObject *__pyx_r = NULL;
9685 __Pyx_RefNannyDeclarations
9686 PyObject *__pyx_t_1 = NULL;
9687 PyObject *__pyx_t_2 = NULL;
9688 int __pyx_lineno = 0;
9689 const char *__pyx_filename = NULL;
9690 int __pyx_clineno = 0;
9691 __Pyx_RefNannySetupContext("__getitem__", 0);
9692
9693 /* "View.MemoryView":237
9694 *
9695 * def __getitem__(self, item):
9696 * return self.memview[item] # <<<<<<<<<<<<<<
9697 *
9698 * def __setitem__(self, item, value):
9699 */
9700 __Pyx_XDECREF(__pyx_r);
9701 __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)
9702 __Pyx_GOTREF(__pyx_t_1);
9703 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
9704 __Pyx_GOTREF(__pyx_t_2);
9705 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9706 __pyx_r = __pyx_t_2;
9707 __pyx_t_2 = 0;
9708 goto __pyx_L0;
9709
9710 /* "View.MemoryView":236
9711 * return getattr(self.memview, attr)
9712 *
9713 * def __getitem__(self, item): # <<<<<<<<<<<<<<
9714 * return self.memview[item]
9715 *
9716 */
9717
9718 /* function exit code */
9719 __pyx_L1_error:;
9720 __Pyx_XDECREF(__pyx_t_1);
9721 __Pyx_XDECREF(__pyx_t_2);
9722 __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9723 __pyx_r = NULL;
9724 __pyx_L0:;
9725 __Pyx_XGIVEREF(__pyx_r);
9726 __Pyx_RefNannyFinishContext();
9727 return __pyx_r;
9728}
9729
9730/* "View.MemoryView":239
9731 * return self.memview[item]
9732 *
9733 * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
9734 * self.memview[item] = value
9735 *
9736 */
9737
9738/* Python wrapper */
9739static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
9740static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
9741 int __pyx_r;
9742 __Pyx_RefNannyDeclarations
9743 __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
9744 __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));
9745
9746 /* function exit code */
9747 __Pyx_RefNannyFinishContext();
9748 return __pyx_r;
9749}
9750
9751static 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) {
9752 int __pyx_r;
9753 __Pyx_RefNannyDeclarations
9754 PyObject *__pyx_t_1 = NULL;
9755 int __pyx_lineno = 0;
9756 const char *__pyx_filename = NULL;
9757 int __pyx_clineno = 0;
9758 __Pyx_RefNannySetupContext("__setitem__", 0);
9759
9760 /* "View.MemoryView":240
9761 *
9762 * def __setitem__(self, item, value):
9763 * self.memview[item] = value # <<<<<<<<<<<<<<
9764 *
9765 *
9766 */
9767 __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)
9768 __Pyx_GOTREF(__pyx_t_1);
9769 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
9770 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9771
9772 /* "View.MemoryView":239
9773 * return self.memview[item]
9774 *
9775 * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
9776 * self.memview[item] = value
9777 *
9778 */
9779
9780 /* function exit code */
9781 __pyx_r = 0;
9782 goto __pyx_L0;
9783 __pyx_L1_error:;
9784 __Pyx_XDECREF(__pyx_t_1);
9785 __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9786 __pyx_r = -1;
9787 __pyx_L0:;
9788 __Pyx_RefNannyFinishContext();
9789 return __pyx_r;
9790}
9791
9792/* "(tree fragment)":1
9793 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
9794 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9795 * def __setstate_cython__(self, __pyx_state):
9796 */
9797
9798/* Python wrapper */
9799static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9800static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9801 PyObject *__pyx_r = 0;
9802 __Pyx_RefNannyDeclarations
9803 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
9804 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
9805
9806 /* function exit code */
9807 __Pyx_RefNannyFinishContext();
9808 return __pyx_r;
9809}
9810
9811static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
9812 PyObject *__pyx_r = NULL;
9813 __Pyx_RefNannyDeclarations
9814 PyObject *__pyx_t_1 = NULL;
9815 int __pyx_lineno = 0;
9816 const char *__pyx_filename = NULL;
9817 int __pyx_clineno = 0;
9818 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
9819
9820 /* "(tree fragment)":2
9821 * def __reduce_cython__(self):
9822 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
9823 * def __setstate_cython__(self, __pyx_state):
9824 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9825 */
9826 __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)
9827 __Pyx_GOTREF(__pyx_t_1);
9828 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9829 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9830 __PYX_ERR(2, 2, __pyx_L1_error)
9831
9832 /* "(tree fragment)":1
9833 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
9834 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9835 * def __setstate_cython__(self, __pyx_state):
9836 */
9837
9838 /* function exit code */
9839 __pyx_L1_error:;
9840 __Pyx_XDECREF(__pyx_t_1);
9841 __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9842 __pyx_r = NULL;
9843 __Pyx_XGIVEREF(__pyx_r);
9844 __Pyx_RefNannyFinishContext();
9845 return __pyx_r;
9846}
9847
9848/* "(tree fragment)":3
9849 * def __reduce_cython__(self):
9850 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9851 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
9852 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9853 */
9854
9855/* Python wrapper */
9856static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
9857static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9858 PyObject *__pyx_r = 0;
9859 __Pyx_RefNannyDeclarations
9860 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
9861 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9862
9863 /* function exit code */
9864 __Pyx_RefNannyFinishContext();
9865 return __pyx_r;
9866}
9867
9868static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
9869 PyObject *__pyx_r = NULL;
9870 __Pyx_RefNannyDeclarations
9871 PyObject *__pyx_t_1 = NULL;
9872 int __pyx_lineno = 0;
9873 const char *__pyx_filename = NULL;
9874 int __pyx_clineno = 0;
9875 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
9876
9877 /* "(tree fragment)":4
9878 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9879 * def __setstate_cython__(self, __pyx_state):
9880 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
9881 */
9882 __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)
9883 __Pyx_GOTREF(__pyx_t_1);
9884 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9885 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9886 __PYX_ERR(2, 4, __pyx_L1_error)
9887
9888 /* "(tree fragment)":3
9889 * def __reduce_cython__(self):
9890 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9891 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
9892 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
9893 */
9894
9895 /* function exit code */
9896 __pyx_L1_error:;
9897 __Pyx_XDECREF(__pyx_t_1);
9898 __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9899 __pyx_r = NULL;
9900 __Pyx_XGIVEREF(__pyx_r);
9901 __Pyx_RefNannyFinishContext();
9902 return __pyx_r;
9903}
9904
9905/* "View.MemoryView":244
9906 *
9907 * @cname("__pyx_array_new")
9908 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
9909 * char *mode, char *buf):
9910 * cdef array result
9911 */
9912
9913static 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) {
9914 struct __pyx_array_obj *__pyx_v_result = 0;
9915 struct __pyx_array_obj *__pyx_r = NULL;
9916 __Pyx_RefNannyDeclarations
9917 int __pyx_t_1;
9918 PyObject *__pyx_t_2 = NULL;
9919 PyObject *__pyx_t_3 = NULL;
9920 PyObject *__pyx_t_4 = NULL;
9921 PyObject *__pyx_t_5 = NULL;
9922 int __pyx_lineno = 0;
9923 const char *__pyx_filename = NULL;
9924 int __pyx_clineno = 0;
9925 __Pyx_RefNannySetupContext("array_cwrapper", 0);
9926
9927 /* "View.MemoryView":248
9928 * cdef array result
9929 *
9930 * if buf == NULL: # <<<<<<<<<<<<<<
9931 * result = array(shape, itemsize, format, mode.decode('ASCII'))
9932 * else:
9933 */
9934 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
9935 if (__pyx_t_1) {
9936
9937 /* "View.MemoryView":249
9938 *
9939 * if buf == NULL:
9940 * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<<
9941 * else:
9942 * result = array(shape, itemsize, format, mode.decode('ASCII'),
9943 */
9944 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
9945 __Pyx_GOTREF(__pyx_t_2);
9946 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
9947 __Pyx_GOTREF(__pyx_t_3);
9948 __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)
9949 __Pyx_GOTREF(__pyx_t_4);
9950 __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
9951 __Pyx_GOTREF(__pyx_t_5);
9952 __Pyx_INCREF(__pyx_v_shape);
9953 __Pyx_GIVEREF(__pyx_v_shape);
9954 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
9955 __Pyx_GIVEREF(__pyx_t_2);
9956 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
9957 __Pyx_GIVEREF(__pyx_t_3);
9958 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
9959 __Pyx_GIVEREF(__pyx_t_4);
9960 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
9961 __pyx_t_2 = 0;
9962 __pyx_t_3 = 0;
9963 __pyx_t_4 = 0;
9964 __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)
9965 __Pyx_GOTREF(__pyx_t_4);
9966 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9967 __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
9968 __pyx_t_4 = 0;
9969
9970 /* "View.MemoryView":248
9971 * cdef array result
9972 *
9973 * if buf == NULL: # <<<<<<<<<<<<<<
9974 * result = array(shape, itemsize, format, mode.decode('ASCII'))
9975 * else:
9976 */
9977 goto __pyx_L3;
9978 }
9979
9980 /* "View.MemoryView":251
9981 * result = array(shape, itemsize, format, mode.decode('ASCII'))
9982 * else:
9983 * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
9984 * allocate_buffer=False)
9985 * result.data = buf
9986 */
9987 /*else*/ {
9988 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
9989 __Pyx_GOTREF(__pyx_t_4);
9990 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
9991 __Pyx_GOTREF(__pyx_t_5);
9992 __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)
9993 __Pyx_GOTREF(__pyx_t_3);
9994 __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
9995 __Pyx_GOTREF(__pyx_t_2);
9996 __Pyx_INCREF(__pyx_v_shape);
9997 __Pyx_GIVEREF(__pyx_v_shape);
9998 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
9999 __Pyx_GIVEREF(__pyx_t_4);
10000 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
10001 __Pyx_GIVEREF(__pyx_t_5);
10002 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
10003 __Pyx_GIVEREF(__pyx_t_3);
10004 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
10005 __pyx_t_4 = 0;
10006 __pyx_t_5 = 0;
10007 __pyx_t_3 = 0;
10008
10009 /* "View.MemoryView":252
10010 * else:
10011 * result = array(shape, itemsize, format, mode.decode('ASCII'),
10012 * allocate_buffer=False) # <<<<<<<<<<<<<<
10013 * result.data = buf
10014 *
10015 */
10016 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
10017 __Pyx_GOTREF(__pyx_t_3);
10018 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
10019
10020 /* "View.MemoryView":251
10021 * result = array(shape, itemsize, format, mode.decode('ASCII'))
10022 * else:
10023 * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
10024 * allocate_buffer=False)
10025 * result.data = buf
10026 */
10027 __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)
10028 __Pyx_GOTREF(__pyx_t_5);
10029 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10030 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10031 __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
10032 __pyx_t_5 = 0;
10033
10034 /* "View.MemoryView":253
10035 * result = array(shape, itemsize, format, mode.decode('ASCII'),
10036 * allocate_buffer=False)
10037 * result.data = buf # <<<<<<<<<<<<<<
10038 *
10039 * return result
10040 */
10041 __pyx_v_result->data = __pyx_v_buf;
10042 }
10043 __pyx_L3:;
10044
10045 /* "View.MemoryView":255
10046 * result.data = buf
10047 *
10048 * return result # <<<<<<<<<<<<<<
10049 *
10050 *
10051 */
10052 __Pyx_XDECREF(((PyObject *)__pyx_r));
10053 __Pyx_INCREF(((PyObject *)__pyx_v_result));
10054 __pyx_r = __pyx_v_result;
10055 goto __pyx_L0;
10056
10057 /* "View.MemoryView":244
10058 *
10059 * @cname("__pyx_array_new")
10060 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
10061 * char *mode, char *buf):
10062 * cdef array result
10063 */
10064
10065 /* function exit code */
10066 __pyx_L1_error:;
10067 __Pyx_XDECREF(__pyx_t_2);
10068 __Pyx_XDECREF(__pyx_t_3);
10069 __Pyx_XDECREF(__pyx_t_4);
10070 __Pyx_XDECREF(__pyx_t_5);
10071 __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
10072 __pyx_r = 0;
10073 __pyx_L0:;
10074 __Pyx_XDECREF((PyObject *)__pyx_v_result);
10075 __Pyx_XGIVEREF((PyObject *)__pyx_r);
10076 __Pyx_RefNannyFinishContext();
10077 return __pyx_r;
10078}
10079
10080/* "View.MemoryView":281
10081 * cdef class Enum(object):
10082 * cdef object name
10083 * def __init__(self, name): # <<<<<<<<<<<<<<
10084 * self.name = name
10085 * def __repr__(self):
10086 */
10087
10088/* Python wrapper */
10089static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10090static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10091 PyObject *__pyx_v_name = 0;
10092 int __pyx_lineno = 0;
10093 const char *__pyx_filename = NULL;
10094 int __pyx_clineno = 0;
10095 int __pyx_r;
10096 __Pyx_RefNannyDeclarations
10097 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
10098 {
10099 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
10100 PyObject* values[1] = {0};
10101 if (unlikely(__pyx_kwds)) {
10102 Py_ssize_t kw_args;
10103 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10104 switch (pos_args) {
10105 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10106 CYTHON_FALLTHROUGH;
10107 case 0: break;
10108 default: goto __pyx_L5_argtuple_error;
10109 }
10110 kw_args = PyDict_Size(__pyx_kwds);
10111 switch (pos_args) {
10112 case 0:
10113 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
10114 else goto __pyx_L5_argtuple_error;
10115 }
10116 if (unlikely(kw_args > 0)) {
10117 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
10118 }
10119 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
10120 goto __pyx_L5_argtuple_error;
10121 } else {
10122 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10123 }
10124 __pyx_v_name = values[0];
10125 }
10126 goto __pyx_L4_argument_unpacking_done;
10127 __pyx_L5_argtuple_error:;
10128 __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
10129 __pyx_L3_error:;
10130 __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10131 __Pyx_RefNannyFinishContext();
10132 return -1;
10133 __pyx_L4_argument_unpacking_done:;
10134 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
10135
10136 /* function exit code */
10137 __Pyx_RefNannyFinishContext();
10138 return __pyx_r;
10139}
10140
10141static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
10142 int __pyx_r;
10143 __Pyx_RefNannyDeclarations
10144 __Pyx_RefNannySetupContext("__init__", 0);
10145
10146 /* "View.MemoryView":282
10147 * cdef object name
10148 * def __init__(self, name):
10149 * self.name = name # <<<<<<<<<<<<<<
10150 * def __repr__(self):
10151 * return self.name
10152 */
10153 __Pyx_INCREF(__pyx_v_name);
10154 __Pyx_GIVEREF(__pyx_v_name);
10155 __Pyx_GOTREF(__pyx_v_self->name);
10156 __Pyx_DECREF(__pyx_v_self->name);
10157 __pyx_v_self->name = __pyx_v_name;
10158
10159 /* "View.MemoryView":281
10160 * cdef class Enum(object):
10161 * cdef object name
10162 * def __init__(self, name): # <<<<<<<<<<<<<<
10163 * self.name = name
10164 * def __repr__(self):
10165 */
10166
10167 /* function exit code */
10168 __pyx_r = 0;
10169 __Pyx_RefNannyFinishContext();
10170 return __pyx_r;
10171}
10172
10173/* "View.MemoryView":283
10174 * def __init__(self, name):
10175 * self.name = name
10176 * def __repr__(self): # <<<<<<<<<<<<<<
10177 * return self.name
10178 *
10179 */
10180
10181/* Python wrapper */
10182static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
10183static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
10184 PyObject *__pyx_r = 0;
10185 __Pyx_RefNannyDeclarations
10186 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
10187 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
10188
10189 /* function exit code */
10190 __Pyx_RefNannyFinishContext();
10191 return __pyx_r;
10192}
10193
10194static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
10195 PyObject *__pyx_r = NULL;
10196 __Pyx_RefNannyDeclarations
10197 __Pyx_RefNannySetupContext("__repr__", 0);
10198
10199 /* "View.MemoryView":284
10200 * self.name = name
10201 * def __repr__(self):
10202 * return self.name # <<<<<<<<<<<<<<
10203 *
10204 * cdef generic = Enum("<strided and direct or indirect>")
10205 */
10206 __Pyx_XDECREF(__pyx_r);
10207 __Pyx_INCREF(__pyx_v_self->name);
10208 __pyx_r = __pyx_v_self->name;
10209 goto __pyx_L0;
10210
10211 /* "View.MemoryView":283
10212 * def __init__(self, name):
10213 * self.name = name
10214 * def __repr__(self): # <<<<<<<<<<<<<<
10215 * return self.name
10216 *
10217 */
10218
10219 /* function exit code */
10220 __pyx_L0:;
10221 __Pyx_XGIVEREF(__pyx_r);
10222 __Pyx_RefNannyFinishContext();
10223 return __pyx_r;
10224}
10225
10226/* "(tree fragment)":1
10227 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
10228 * cdef tuple state
10229 * cdef object _dict
10230 */
10231
10232/* Python wrapper */
10233static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
10234static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10235 PyObject *__pyx_r = 0;
10236 __Pyx_RefNannyDeclarations
10237 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
10238 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
10239
10240 /* function exit code */
10241 __Pyx_RefNannyFinishContext();
10242 return __pyx_r;
10243}
10244
10245static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
10246 PyObject *__pyx_v_state = 0;
10247 PyObject *__pyx_v__dict = 0;
10248 int __pyx_v_use_setstate;
10249 PyObject *__pyx_r = NULL;
10250 __Pyx_RefNannyDeclarations
10251 PyObject *__pyx_t_1 = NULL;
10252 int __pyx_t_2;
10253 int __pyx_t_3;
10254 PyObject *__pyx_t_4 = NULL;
10255 PyObject *__pyx_t_5 = NULL;
10256 int __pyx_lineno = 0;
10257 const char *__pyx_filename = NULL;
10258 int __pyx_clineno = 0;
10259 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
10260
10261 /* "(tree fragment)":5
10262 * cdef object _dict
10263 * cdef bint use_setstate
10264 * state = (self.name,) # <<<<<<<<<<<<<<
10265 * _dict = getattr(self, '__dict__', None)
10266 * if _dict is not None:
10267 */
10268 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
10269 __Pyx_GOTREF(__pyx_t_1);
10270 __Pyx_INCREF(__pyx_v_self->name);
10271 __Pyx_GIVEREF(__pyx_v_self->name);
10272 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
10273 __pyx_v_state = ((PyObject*)__pyx_t_1);
10274 __pyx_t_1 = 0;
10275
10276 /* "(tree fragment)":6
10277 * cdef bint use_setstate
10278 * state = (self.name,)
10279 * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
10280 * if _dict is not None:
10281 * state += (_dict,)
10282 */
10283 __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)
10284 __Pyx_GOTREF(__pyx_t_1);
10285 __pyx_v__dict = __pyx_t_1;
10286 __pyx_t_1 = 0;
10287
10288 /* "(tree fragment)":7
10289 * state = (self.name,)
10290 * _dict = getattr(self, '__dict__', None)
10291 * if _dict is not None: # <<<<<<<<<<<<<<
10292 * state += (_dict,)
10293 * use_setstate = True
10294 */
10295 __pyx_t_2 = (__pyx_v__dict != Py_None);
10296 __pyx_t_3 = (__pyx_t_2 != 0);
10297 if (__pyx_t_3) {
10298
10299 /* "(tree fragment)":8
10300 * _dict = getattr(self, '__dict__', None)
10301 * if _dict is not None:
10302 * state += (_dict,) # <<<<<<<<<<<<<<
10303 * use_setstate = True
10304 * else:
10305 */
10306 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
10307 __Pyx_GOTREF(__pyx_t_1);
10308 __Pyx_INCREF(__pyx_v__dict);
10309 __Pyx_GIVEREF(__pyx_v__dict);
10310 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
10311 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
10312 __Pyx_GOTREF(__pyx_t_4);
10313 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10314 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
10315 __pyx_t_4 = 0;
10316
10317 /* "(tree fragment)":9
10318 * if _dict is not None:
10319 * state += (_dict,)
10320 * use_setstate = True # <<<<<<<<<<<<<<
10321 * else:
10322 * use_setstate = self.name is not None
10323 */
10324 __pyx_v_use_setstate = 1;
10325
10326 /* "(tree fragment)":7
10327 * state = (self.name,)
10328 * _dict = getattr(self, '__dict__', None)
10329 * if _dict is not None: # <<<<<<<<<<<<<<
10330 * state += (_dict,)
10331 * use_setstate = True
10332 */
10333 goto __pyx_L3;
10334 }
10335
10336 /* "(tree fragment)":11
10337 * use_setstate = True
10338 * else:
10339 * use_setstate = self.name is not None # <<<<<<<<<<<<<<
10340 * if use_setstate:
10341 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
10342 */
10343 /*else*/ {
10344 __pyx_t_3 = (__pyx_v_self->name != Py_None);
10345 __pyx_v_use_setstate = __pyx_t_3;
10346 }
10347 __pyx_L3:;
10348
10349 /* "(tree fragment)":12
10350 * else:
10351 * use_setstate = self.name is not None
10352 * if use_setstate: # <<<<<<<<<<<<<<
10353 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
10354 * else:
10355 */
10356 __pyx_t_3 = (__pyx_v_use_setstate != 0);
10357 if (__pyx_t_3) {
10358
10359 /* "(tree fragment)":13
10360 * use_setstate = self.name is not None
10361 * if use_setstate:
10362 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<<
10363 * else:
10364 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
10365 */
10366 __Pyx_XDECREF(__pyx_r);
10367 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
10368 __Pyx_GOTREF(__pyx_t_4);
10369 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
10370 __Pyx_GOTREF(__pyx_t_1);
10371 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10372 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10373 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10374 __Pyx_INCREF(__pyx_int_184977713);
10375 __Pyx_GIVEREF(__pyx_int_184977713);
10376 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
10377 __Pyx_INCREF(Py_None);
10378 __Pyx_GIVEREF(Py_None);
10379 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
10380 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
10381 __Pyx_GOTREF(__pyx_t_5);
10382 __Pyx_GIVEREF(__pyx_t_4);
10383 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
10384 __Pyx_GIVEREF(__pyx_t_1);
10385 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
10386 __Pyx_INCREF(__pyx_v_state);
10387 __Pyx_GIVEREF(__pyx_v_state);
10388 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
10389 __pyx_t_4 = 0;
10390 __pyx_t_1 = 0;
10391 __pyx_r = __pyx_t_5;
10392 __pyx_t_5 = 0;
10393 goto __pyx_L0;
10394
10395 /* "(tree fragment)":12
10396 * else:
10397 * use_setstate = self.name is not None
10398 * if use_setstate: # <<<<<<<<<<<<<<
10399 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
10400 * else:
10401 */
10402 }
10403
10404 /* "(tree fragment)":15
10405 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
10406 * else:
10407 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<<
10408 * def __setstate_cython__(self, __pyx_state):
10409 * __pyx_unpickle_Enum__set_state(self, __pyx_state)
10410 */
10411 /*else*/ {
10412 __Pyx_XDECREF(__pyx_r);
10413 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
10414 __Pyx_GOTREF(__pyx_t_5);
10415 __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
10416 __Pyx_GOTREF(__pyx_t_1);
10417 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10418 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10419 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10420 __Pyx_INCREF(__pyx_int_184977713);
10421 __Pyx_GIVEREF(__pyx_int_184977713);
10422 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
10423 __Pyx_INCREF(__pyx_v_state);
10424 __Pyx_GIVEREF(__pyx_v_state);
10425 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
10426 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
10427 __Pyx_GOTREF(__pyx_t_4);
10428 __Pyx_GIVEREF(__pyx_t_5);
10429 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
10430 __Pyx_GIVEREF(__pyx_t_1);
10431 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
10432 __pyx_t_5 = 0;
10433 __pyx_t_1 = 0;
10434 __pyx_r = __pyx_t_4;
10435 __pyx_t_4 = 0;
10436 goto __pyx_L0;
10437 }
10438
10439 /* "(tree fragment)":1
10440 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
10441 * cdef tuple state
10442 * cdef object _dict
10443 */
10444
10445 /* function exit code */
10446 __pyx_L1_error:;
10447 __Pyx_XDECREF(__pyx_t_1);
10448 __Pyx_XDECREF(__pyx_t_4);
10449 __Pyx_XDECREF(__pyx_t_5);
10450 __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10451 __pyx_r = NULL;
10452 __pyx_L0:;
10453 __Pyx_XDECREF(__pyx_v_state);
10454 __Pyx_XDECREF(__pyx_v__dict);
10455 __Pyx_XGIVEREF(__pyx_r);
10456 __Pyx_RefNannyFinishContext();
10457 return __pyx_r;
10458}
10459
10460/* "(tree fragment)":16
10461 * else:
10462 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
10463 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
10464 * __pyx_unpickle_Enum__set_state(self, __pyx_state)
10465 */
10466
10467/* Python wrapper */
10468static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
10469static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10470 PyObject *__pyx_r = 0;
10471 __Pyx_RefNannyDeclarations
10472 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
10473 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
10474
10475 /* function exit code */
10476 __Pyx_RefNannyFinishContext();
10477 return __pyx_r;
10478}
10479
10480static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10481 PyObject *__pyx_r = NULL;
10482 __Pyx_RefNannyDeclarations
10483 PyObject *__pyx_t_1 = NULL;
10484 int __pyx_lineno = 0;
10485 const char *__pyx_filename = NULL;
10486 int __pyx_clineno = 0;
10487 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
10488
10489 /* "(tree fragment)":17
10490 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
10491 * def __setstate_cython__(self, __pyx_state):
10492 * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
10493 */
10494 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)
10495 __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)
10496 __Pyx_GOTREF(__pyx_t_1);
10497 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10498
10499 /* "(tree fragment)":16
10500 * else:
10501 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
10502 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
10503 * __pyx_unpickle_Enum__set_state(self, __pyx_state)
10504 */
10505
10506 /* function exit code */
10507 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10508 goto __pyx_L0;
10509 __pyx_L1_error:;
10510 __Pyx_XDECREF(__pyx_t_1);
10511 __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10512 __pyx_r = NULL;
10513 __pyx_L0:;
10514 __Pyx_XGIVEREF(__pyx_r);
10515 __Pyx_RefNannyFinishContext();
10516 return __pyx_r;
10517}
10518
10519/* "View.MemoryView":298
10520 *
10521 * @cname('__pyx_align_pointer')
10522 * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
10523 * "Align pointer memory on a given boundary"
10524 * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
10525 */
10526
10527static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
10528 Py_intptr_t __pyx_v_aligned_p;
10529 size_t __pyx_v_offset;
10530 void *__pyx_r;
10531 int __pyx_t_1;
10532
10533 /* "View.MemoryView":300
10534 * cdef void *align_pointer(void *memory, size_t alignment) nogil:
10535 * "Align pointer memory on a given boundary"
10536 * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory # <<<<<<<<<<<<<<
10537 * cdef size_t offset
10538 *
10539 */
10540 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
10541
10542 /* "View.MemoryView":304
10543 *
10544 * with cython.cdivision(True):
10545 * offset = aligned_p % alignment # <<<<<<<<<<<<<<
10546 *
10547 * if offset > 0:
10548 */
10549 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
10550
10551 /* "View.MemoryView":306
10552 * offset = aligned_p % alignment
10553 *
10554 * if offset > 0: # <<<<<<<<<<<<<<
10555 * aligned_p += alignment - offset
10556 *
10557 */
10558 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
10559 if (__pyx_t_1) {
10560
10561 /* "View.MemoryView":307
10562 *
10563 * if offset > 0:
10564 * aligned_p += alignment - offset # <<<<<<<<<<<<<<
10565 *
10566 * return <void *> aligned_p
10567 */
10568 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
10569
10570 /* "View.MemoryView":306
10571 * offset = aligned_p % alignment
10572 *
10573 * if offset > 0: # <<<<<<<<<<<<<<
10574 * aligned_p += alignment - offset
10575 *
10576 */
10577 }
10578
10579 /* "View.MemoryView":309
10580 * aligned_p += alignment - offset
10581 *
10582 * return <void *> aligned_p # <<<<<<<<<<<<<<
10583 *
10584 *
10585 */
10586 __pyx_r = ((void *)__pyx_v_aligned_p);
10587 goto __pyx_L0;
10588
10589 /* "View.MemoryView":298
10590 *
10591 * @cname('__pyx_align_pointer')
10592 * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
10593 * "Align pointer memory on a given boundary"
10594 * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
10595 */
10596
10597 /* function exit code */
10598 __pyx_L0:;
10599 return __pyx_r;
10600}
10601
10602/* "View.MemoryView":345
10603 * cdef __Pyx_TypeInfo *typeinfo
10604 *
10605 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
10606 * self.obj = obj
10607 * self.flags = flags
10608 */
10609
10610/* Python wrapper */
10611static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10612static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10613 PyObject *__pyx_v_obj = 0;
10614 int __pyx_v_flags;
10615 int __pyx_v_dtype_is_object;
10616 int __pyx_lineno = 0;
10617 const char *__pyx_filename = NULL;
10618 int __pyx_clineno = 0;
10619 int __pyx_r;
10620 __Pyx_RefNannyDeclarations
10621 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
10622 {
10623 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
10624 PyObject* values[3] = {0,0,0};
10625 if (unlikely(__pyx_kwds)) {
10626 Py_ssize_t kw_args;
10627 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10628 switch (pos_args) {
10629 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10630 CYTHON_FALLTHROUGH;
10631 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10632 CYTHON_FALLTHROUGH;
10633 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10634 CYTHON_FALLTHROUGH;
10635 case 0: break;
10636 default: goto __pyx_L5_argtuple_error;
10637 }
10638 kw_args = PyDict_Size(__pyx_kwds);
10639 switch (pos_args) {
10640 case 0:
10641 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
10642 else goto __pyx_L5_argtuple_error;
10643 CYTHON_FALLTHROUGH;
10644 case 1:
10645 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
10646 else {
10647 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
10648 }
10649 CYTHON_FALLTHROUGH;
10650 case 2:
10651 if (kw_args > 0) {
10652 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
10653 if (value) { values[2] = value; kw_args--; }
10654 }
10655 }
10656 if (unlikely(kw_args > 0)) {
10657 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
10658 }
10659 } else {
10660 switch (PyTuple_GET_SIZE(__pyx_args)) {
10661 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10662 CYTHON_FALLTHROUGH;
10663 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10664 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10665 break;
10666 default: goto __pyx_L5_argtuple_error;
10667 }
10668 }
10669 __pyx_v_obj = values[0];
10670 __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)
10671 if (values[2]) {
10672 __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)
10673 } else {
10674 __pyx_v_dtype_is_object = ((int)0);
10675 }
10676 }
10677 goto __pyx_L4_argument_unpacking_done;
10678 __pyx_L5_argtuple_error:;
10679 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
10680 __pyx_L3_error:;
10681 __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10682 __Pyx_RefNannyFinishContext();
10683 return -1;
10684 __pyx_L4_argument_unpacking_done:;
10685 __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);
10686
10687 /* function exit code */
10688 __Pyx_RefNannyFinishContext();
10689 return __pyx_r;
10690}
10691
10692static 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) {
10693 int __pyx_r;
10694 __Pyx_RefNannyDeclarations
10695 int __pyx_t_1;
10696 int __pyx_t_2;
10697 int __pyx_t_3;
10698 int __pyx_t_4;
10699 int __pyx_lineno = 0;
10700 const char *__pyx_filename = NULL;
10701 int __pyx_clineno = 0;
10702 __Pyx_RefNannySetupContext("__cinit__", 0);
10703
10704 /* "View.MemoryView":346
10705 *
10706 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
10707 * self.obj = obj # <<<<<<<<<<<<<<
10708 * self.flags = flags
10709 * if type(self) is memoryview or obj is not None:
10710 */
10711 __Pyx_INCREF(__pyx_v_obj);
10712 __Pyx_GIVEREF(__pyx_v_obj);
10713 __Pyx_GOTREF(__pyx_v_self->obj);
10714 __Pyx_DECREF(__pyx_v_self->obj);
10715 __pyx_v_self->obj = __pyx_v_obj;
10716
10717 /* "View.MemoryView":347
10718 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
10719 * self.obj = obj
10720 * self.flags = flags # <<<<<<<<<<<<<<
10721 * if type(self) is memoryview or obj is not None:
10722 * __Pyx_GetBuffer(obj, &self.view, flags)
10723 */
10724 __pyx_v_self->flags = __pyx_v_flags;
10725
10726 /* "View.MemoryView":348
10727 * self.obj = obj
10728 * self.flags = flags
10729 * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
10730 * __Pyx_GetBuffer(obj, &self.view, flags)
10731 * if <PyObject *> self.view.obj == NULL:
10732 */
10733 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
10734 __pyx_t_3 = (__pyx_t_2 != 0);
10735 if (!__pyx_t_3) {
10736 } else {
10737 __pyx_t_1 = __pyx_t_3;
10738 goto __pyx_L4_bool_binop_done;
10739 }
10740 __pyx_t_3 = (__pyx_v_obj != Py_None);
10741 __pyx_t_2 = (__pyx_t_3 != 0);
10742 __pyx_t_1 = __pyx_t_2;
10743 __pyx_L4_bool_binop_done:;
10744 if (__pyx_t_1) {
10745
10746 /* "View.MemoryView":349
10747 * self.flags = flags
10748 * if type(self) is memoryview or obj is not None:
10749 * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
10750 * if <PyObject *> self.view.obj == NULL:
10751 * (<__pyx_buffer *> &self.view).obj = Py_None
10752 */
10753 __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)
10754
10755 /* "View.MemoryView":350
10756 * if type(self) is memoryview or obj is not None:
10757 * __Pyx_GetBuffer(obj, &self.view, flags)
10758 * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
10759 * (<__pyx_buffer *> &self.view).obj = Py_None
10760 * Py_INCREF(Py_None)
10761 */
10762 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
10763 if (__pyx_t_1) {
10764
10765 /* "View.MemoryView":351
10766 * __Pyx_GetBuffer(obj, &self.view, flags)
10767 * if <PyObject *> self.view.obj == NULL:
10768 * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
10769 * Py_INCREF(Py_None)
10770 *
10771 */
10772 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
10773
10774 /* "View.MemoryView":352
10775 * if <PyObject *> self.view.obj == NULL:
10776 * (<__pyx_buffer *> &self.view).obj = Py_None
10777 * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
10778 *
10779 * global __pyx_memoryview_thread_locks_used
10780 */
10781 Py_INCREF(Py_None);
10782
10783 /* "View.MemoryView":350
10784 * if type(self) is memoryview or obj is not None:
10785 * __Pyx_GetBuffer(obj, &self.view, flags)
10786 * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
10787 * (<__pyx_buffer *> &self.view).obj = Py_None
10788 * Py_INCREF(Py_None)
10789 */
10790 }
10791
10792 /* "View.MemoryView":348
10793 * self.obj = obj
10794 * self.flags = flags
10795 * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
10796 * __Pyx_GetBuffer(obj, &self.view, flags)
10797 * if <PyObject *> self.view.obj == NULL:
10798 */
10799 }
10800
10801 /* "View.MemoryView":355
10802 *
10803 * global __pyx_memoryview_thread_locks_used
10804 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
10805 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
10806 * __pyx_memoryview_thread_locks_used += 1
10807 */
10808 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
10809 if (__pyx_t_1) {
10810
10811 /* "View.MemoryView":356
10812 * global __pyx_memoryview_thread_locks_used
10813 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
10814 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
10815 * __pyx_memoryview_thread_locks_used += 1
10816 * if self.lock is NULL:
10817 */
10818 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
10819
10820 /* "View.MemoryView":357
10821 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
10822 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
10823 * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
10824 * if self.lock is NULL:
10825 * self.lock = PyThread_allocate_lock()
10826 */
10827 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
10828
10829 /* "View.MemoryView":355
10830 *
10831 * global __pyx_memoryview_thread_locks_used
10832 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
10833 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
10834 * __pyx_memoryview_thread_locks_used += 1
10835 */
10836 }
10837
10838 /* "View.MemoryView":358
10839 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
10840 * __pyx_memoryview_thread_locks_used += 1
10841 * if self.lock is NULL: # <<<<<<<<<<<<<<
10842 * self.lock = PyThread_allocate_lock()
10843 * if self.lock is NULL:
10844 */
10845 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
10846 if (__pyx_t_1) {
10847
10848 /* "View.MemoryView":359
10849 * __pyx_memoryview_thread_locks_used += 1
10850 * if self.lock is NULL:
10851 * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
10852 * if self.lock is NULL:
10853 * raise MemoryError
10854 */
10855 __pyx_v_self->lock = PyThread_allocate_lock();
10856
10857 /* "View.MemoryView":360
10858 * if self.lock is NULL:
10859 * self.lock = PyThread_allocate_lock()
10860 * if self.lock is NULL: # <<<<<<<<<<<<<<
10861 * raise MemoryError
10862 *
10863 */
10864 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
10865 if (unlikely(__pyx_t_1)) {
10866
10867 /* "View.MemoryView":361
10868 * self.lock = PyThread_allocate_lock()
10869 * if self.lock is NULL:
10870 * raise MemoryError # <<<<<<<<<<<<<<
10871 *
10872 * if flags & PyBUF_FORMAT:
10873 */
10874 PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
10875
10876 /* "View.MemoryView":360
10877 * if self.lock is NULL:
10878 * self.lock = PyThread_allocate_lock()
10879 * if self.lock is NULL: # <<<<<<<<<<<<<<
10880 * raise MemoryError
10881 *
10882 */
10883 }
10884
10885 /* "View.MemoryView":358
10886 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
10887 * __pyx_memoryview_thread_locks_used += 1
10888 * if self.lock is NULL: # <<<<<<<<<<<<<<
10889 * self.lock = PyThread_allocate_lock()
10890 * if self.lock is NULL:
10891 */
10892 }
10893
10894 /* "View.MemoryView":363
10895 * raise MemoryError
10896 *
10897 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
10898 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
10899 * else:
10900 */
10901 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10902 if (__pyx_t_1) {
10903
10904 /* "View.MemoryView":364
10905 *
10906 * if flags & PyBUF_FORMAT:
10907 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
10908 * else:
10909 * self.dtype_is_object = dtype_is_object
10910 */
10911 __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
10912 if (__pyx_t_2) {
10913 } else {
10914 __pyx_t_1 = __pyx_t_2;
10915 goto __pyx_L11_bool_binop_done;
10916 }
10917 __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
10918 __pyx_t_1 = __pyx_t_2;
10919 __pyx_L11_bool_binop_done:;
10920 __pyx_v_self->dtype_is_object = __pyx_t_1;
10921
10922 /* "View.MemoryView":363
10923 * raise MemoryError
10924 *
10925 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
10926 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
10927 * else:
10928 */
10929 goto __pyx_L10;
10930 }
10931
10932 /* "View.MemoryView":366
10933 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
10934 * else:
10935 * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
10936 *
10937 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
10938 */
10939 /*else*/ {
10940 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
10941 }
10942 __pyx_L10:;
10943
10944 /* "View.MemoryView":368
10945 * self.dtype_is_object = dtype_is_object
10946 *
10947 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
10948 * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
10949 * self.typeinfo = NULL
10950 */
10951 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
10952
10953 /* "View.MemoryView":370
10954 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
10955 * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
10956 * self.typeinfo = NULL # <<<<<<<<<<<<<<
10957 *
10958 * def __dealloc__(memoryview self):
10959 */
10960 __pyx_v_self->typeinfo = NULL;
10961
10962 /* "View.MemoryView":345
10963 * cdef __Pyx_TypeInfo *typeinfo
10964 *
10965 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
10966 * self.obj = obj
10967 * self.flags = flags
10968 */
10969
10970 /* function exit code */
10971 __pyx_r = 0;
10972 goto __pyx_L0;
10973 __pyx_L1_error:;
10974 __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10975 __pyx_r = -1;
10976 __pyx_L0:;
10977 __Pyx_RefNannyFinishContext();
10978 return __pyx_r;
10979}
10980
10981/* "View.MemoryView":372
10982 * self.typeinfo = NULL
10983 *
10984 * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
10985 * if self.obj is not None:
10986 * __Pyx_ReleaseBuffer(&self.view)
10987 */
10988
10989/* Python wrapper */
10990static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
10991static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
10992 __Pyx_RefNannyDeclarations
10993 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
10994 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10995
10996 /* function exit code */
10997 __Pyx_RefNannyFinishContext();
10998}
10999
11000static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
11001 int __pyx_v_i;
11002 __Pyx_RefNannyDeclarations
11003 int __pyx_t_1;
11004 int __pyx_t_2;
11005 int __pyx_t_3;
11006 int __pyx_t_4;
11007 int __pyx_t_5;
11008 PyThread_type_lock __pyx_t_6;
11009 PyThread_type_lock __pyx_t_7;
11010 __Pyx_RefNannySetupContext("__dealloc__", 0);
11011
11012 /* "View.MemoryView":373
11013 *
11014 * def __dealloc__(memoryview self):
11015 * if self.obj is not None: # <<<<<<<<<<<<<<
11016 * __Pyx_ReleaseBuffer(&self.view)
11017 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
11018 */
11019 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
11020 __pyx_t_2 = (__pyx_t_1 != 0);
11021 if (__pyx_t_2) {
11022
11023 /* "View.MemoryView":374
11024 * def __dealloc__(memoryview self):
11025 * if self.obj is not None:
11026 * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
11027 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
11028 *
11029 */
11030 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
11031
11032 /* "View.MemoryView":373
11033 *
11034 * def __dealloc__(memoryview self):
11035 * if self.obj is not None: # <<<<<<<<<<<<<<
11036 * __Pyx_ReleaseBuffer(&self.view)
11037 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
11038 */
11039 goto __pyx_L3;
11040 }
11041
11042 /* "View.MemoryView":375
11043 * if self.obj is not None:
11044 * __Pyx_ReleaseBuffer(&self.view)
11045 * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
11046 *
11047 * (<__pyx_buffer *> &self.view).obj = NULL
11048 */
11049 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
11050 if (__pyx_t_2) {
11051
11052 /* "View.MemoryView":377
11053 * elif (<__pyx_buffer *> &self.view).obj == Py_None:
11054 *
11055 * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
11056 * Py_DECREF(Py_None)
11057 *
11058 */
11059 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
11060
11061 /* "View.MemoryView":378
11062 *
11063 * (<__pyx_buffer *> &self.view).obj = NULL
11064 * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
11065 *
11066 * cdef int i
11067 */
11068 Py_DECREF(Py_None);
11069
11070 /* "View.MemoryView":375
11071 * if self.obj is not None:
11072 * __Pyx_ReleaseBuffer(&self.view)
11073 * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
11074 *
11075 * (<__pyx_buffer *> &self.view).obj = NULL
11076 */
11077 }
11078 __pyx_L3:;
11079
11080 /* "View.MemoryView":382
11081 * cdef int i
11082 * global __pyx_memoryview_thread_locks_used
11083 * if self.lock != NULL: # <<<<<<<<<<<<<<
11084 * for i in range(__pyx_memoryview_thread_locks_used):
11085 * if __pyx_memoryview_thread_locks[i] is self.lock:
11086 */
11087 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
11088 if (__pyx_t_2) {
11089
11090 /* "View.MemoryView":383
11091 * global __pyx_memoryview_thread_locks_used
11092 * if self.lock != NULL:
11093 * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
11094 * if __pyx_memoryview_thread_locks[i] is self.lock:
11095 * __pyx_memoryview_thread_locks_used -= 1
11096 */
11097 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
11098 __pyx_t_4 = __pyx_t_3;
11099 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
11100 __pyx_v_i = __pyx_t_5;
11101
11102 /* "View.MemoryView":384
11103 * if self.lock != NULL:
11104 * for i in range(__pyx_memoryview_thread_locks_used):
11105 * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
11106 * __pyx_memoryview_thread_locks_used -= 1
11107 * if i != __pyx_memoryview_thread_locks_used:
11108 */
11109 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
11110 if (__pyx_t_2) {
11111
11112 /* "View.MemoryView":385
11113 * for i in range(__pyx_memoryview_thread_locks_used):
11114 * if __pyx_memoryview_thread_locks[i] is self.lock:
11115 * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
11116 * if i != __pyx_memoryview_thread_locks_used:
11117 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
11118 */
11119 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
11120
11121 /* "View.MemoryView":386
11122 * if __pyx_memoryview_thread_locks[i] is self.lock:
11123 * __pyx_memoryview_thread_locks_used -= 1
11124 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
11125 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
11126 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
11127 */
11128 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
11129 if (__pyx_t_2) {
11130
11131 /* "View.MemoryView":388
11132 * if i != __pyx_memoryview_thread_locks_used:
11133 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
11134 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
11135 * break
11136 * else:
11137 */
11138 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
11139 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
11140
11141 /* "View.MemoryView":387
11142 * __pyx_memoryview_thread_locks_used -= 1
11143 * if i != __pyx_memoryview_thread_locks_used:
11144 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
11145 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
11146 * break
11147 */
11148 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
11149 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
11150
11151 /* "View.MemoryView":386
11152 * if __pyx_memoryview_thread_locks[i] is self.lock:
11153 * __pyx_memoryview_thread_locks_used -= 1
11154 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
11155 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
11156 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
11157 */
11158 }
11159
11160 /* "View.MemoryView":389
11161 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
11162 * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
11163 * break # <<<<<<<<<<<<<<
11164 * else:
11165 * PyThread_free_lock(self.lock)
11166 */
11167 goto __pyx_L6_break;
11168
11169 /* "View.MemoryView":384
11170 * if self.lock != NULL:
11171 * for i in range(__pyx_memoryview_thread_locks_used):
11172 * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
11173 * __pyx_memoryview_thread_locks_used -= 1
11174 * if i != __pyx_memoryview_thread_locks_used:
11175 */
11176 }
11177 }
11178 /*else*/ {
11179
11180 /* "View.MemoryView":391
11181 * break
11182 * else:
11183 * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
11184 *
11185 * cdef char *get_item_pointer(memoryview self, object index) except NULL:
11186 */
11187 PyThread_free_lock(__pyx_v_self->lock);
11188 }
11189 __pyx_L6_break:;
11190
11191 /* "View.MemoryView":382
11192 * cdef int i
11193 * global __pyx_memoryview_thread_locks_used
11194 * if self.lock != NULL: # <<<<<<<<<<<<<<
11195 * for i in range(__pyx_memoryview_thread_locks_used):
11196 * if __pyx_memoryview_thread_locks[i] is self.lock:
11197 */
11198 }
11199
11200 /* "View.MemoryView":372
11201 * self.typeinfo = NULL
11202 *
11203 * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
11204 * if self.obj is not None:
11205 * __Pyx_ReleaseBuffer(&self.view)
11206 */
11207
11208 /* function exit code */
11209 __Pyx_RefNannyFinishContext();
11210}
11211
11212/* "View.MemoryView":393
11213 * PyThread_free_lock(self.lock)
11214 *
11215 * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
11216 * cdef Py_ssize_t dim
11217 * cdef char *itemp = <char *> self.view.buf
11218 */
11219
11220static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
11221 Py_ssize_t __pyx_v_dim;
11222 char *__pyx_v_itemp;
11223 PyObject *__pyx_v_idx = NULL;
11224 char *__pyx_r;
11225 __Pyx_RefNannyDeclarations
11226 Py_ssize_t __pyx_t_1;
11227 PyObject *__pyx_t_2 = NULL;
11228 Py_ssize_t __pyx_t_3;
11229 PyObject *(*__pyx_t_4)(PyObject *);
11230 PyObject *__pyx_t_5 = NULL;
11231 Py_ssize_t __pyx_t_6;
11232 char *__pyx_t_7;
11233 int __pyx_lineno = 0;
11234 const char *__pyx_filename = NULL;
11235 int __pyx_clineno = 0;
11236 __Pyx_RefNannySetupContext("get_item_pointer", 0);
11237
11238 /* "View.MemoryView":395
11239 * cdef char *get_item_pointer(memoryview self, object index) except NULL:
11240 * cdef Py_ssize_t dim
11241 * cdef char *itemp = <char *> self.view.buf # <<<<<<<<<<<<<<
11242 *
11243 * for dim, idx in enumerate(index):
11244 */
11245 __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
11246
11247 /* "View.MemoryView":397
11248 * cdef char *itemp = <char *> self.view.buf
11249 *
11250 * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
11251 * itemp = pybuffer_index(&self.view, itemp, idx, dim)
11252 *
11253 */
11254 __pyx_t_1 = 0;
11255 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
11256 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
11257 __pyx_t_4 = NULL;
11258 } else {
11259 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
11260 __Pyx_GOTREF(__pyx_t_2);
11261 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
11262 }
11263 for (;;) {
11264 if (likely(!__pyx_t_4)) {
11265 if (likely(PyList_CheckExact(__pyx_t_2))) {
11266 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
11267 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11268 __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)
11269 #else
11270 __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)
11271 __Pyx_GOTREF(__pyx_t_5);
11272 #endif
11273 } else {
11274 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
11275 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11276 __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)
11277 #else
11278 __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)
11279 __Pyx_GOTREF(__pyx_t_5);
11280 #endif
11281 }
11282 } else {
11283 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
11284 if (unlikely(!__pyx_t_5)) {
11285 PyObject* exc_type = PyErr_Occurred();
11286 if (exc_type) {
11287 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11288 else __PYX_ERR(2, 397, __pyx_L1_error)
11289 }
11290 break;
11291 }
11292 __Pyx_GOTREF(__pyx_t_5);
11293 }
11294 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
11295 __pyx_t_5 = 0;
11296 __pyx_v_dim = __pyx_t_1;
11297 __pyx_t_1 = (__pyx_t_1 + 1);
11298
11299 /* "View.MemoryView":398
11300 *
11301 * for dim, idx in enumerate(index):
11302 * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
11303 *
11304 * return itemp
11305 */
11306 __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)
11307 __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)
11308 __pyx_v_itemp = __pyx_t_7;
11309
11310 /* "View.MemoryView":397
11311 * cdef char *itemp = <char *> self.view.buf
11312 *
11313 * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
11314 * itemp = pybuffer_index(&self.view, itemp, idx, dim)
11315 *
11316 */
11317 }
11318 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11319
11320 /* "View.MemoryView":400
11321 * itemp = pybuffer_index(&self.view, itemp, idx, dim)
11322 *
11323 * return itemp # <<<<<<<<<<<<<<
11324 *
11325 *
11326 */
11327 __pyx_r = __pyx_v_itemp;
11328 goto __pyx_L0;
11329
11330 /* "View.MemoryView":393
11331 * PyThread_free_lock(self.lock)
11332 *
11333 * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
11334 * cdef Py_ssize_t dim
11335 * cdef char *itemp = <char *> self.view.buf
11336 */
11337
11338 /* function exit code */
11339 __pyx_L1_error:;
11340 __Pyx_XDECREF(__pyx_t_2);
11341 __Pyx_XDECREF(__pyx_t_5);
11342 __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
11343 __pyx_r = NULL;
11344 __pyx_L0:;
11345 __Pyx_XDECREF(__pyx_v_idx);
11346 __Pyx_RefNannyFinishContext();
11347 return __pyx_r;
11348}
11349
11350/* "View.MemoryView":403
11351 *
11352 *
11353 * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
11354 * if index is Ellipsis:
11355 * return self
11356 */
11357
11358/* Python wrapper */
11359static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
11360static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
11361 PyObject *__pyx_r = 0;
11362 __Pyx_RefNannyDeclarations
11363 __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
11364 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
11365
11366 /* function exit code */
11367 __Pyx_RefNannyFinishContext();
11368 return __pyx_r;
11369}
11370
11371static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
11372 PyObject *__pyx_v_have_slices = NULL;
11373 PyObject *__pyx_v_indices = NULL;
11374 char *__pyx_v_itemp;
11375 PyObject *__pyx_r = NULL;
11376 __Pyx_RefNannyDeclarations
11377 int __pyx_t_1;
11378 int __pyx_t_2;
11379 PyObject *__pyx_t_3 = NULL;
11380 PyObject *__pyx_t_4 = NULL;
11381 PyObject *__pyx_t_5 = NULL;
11382 char *__pyx_t_6;
11383 int __pyx_lineno = 0;
11384 const char *__pyx_filename = NULL;
11385 int __pyx_clineno = 0;
11386 __Pyx_RefNannySetupContext("__getitem__", 0);
11387
11388 /* "View.MemoryView":404
11389 *
11390 * def __getitem__(memoryview self, object index):
11391 * if index is Ellipsis: # <<<<<<<<<<<<<<
11392 * return self
11393 *
11394 */
11395 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
11396 __pyx_t_2 = (__pyx_t_1 != 0);
11397 if (__pyx_t_2) {
11398
11399 /* "View.MemoryView":405
11400 * def __getitem__(memoryview self, object index):
11401 * if index is Ellipsis:
11402 * return self # <<<<<<<<<<<<<<
11403 *
11404 * have_slices, indices = _unellipsify(index, self.view.ndim)
11405 */
11406 __Pyx_XDECREF(__pyx_r);
11407 __Pyx_INCREF(((PyObject *)__pyx_v_self));
11408 __pyx_r = ((PyObject *)__pyx_v_self);
11409 goto __pyx_L0;
11410
11411 /* "View.MemoryView":404
11412 *
11413 * def __getitem__(memoryview self, object index):
11414 * if index is Ellipsis: # <<<<<<<<<<<<<<
11415 * return self
11416 *
11417 */
11418 }
11419
11420 /* "View.MemoryView":407
11421 * return self
11422 *
11423 * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
11424 *
11425 * cdef char *itemp
11426 */
11427 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
11428 __Pyx_GOTREF(__pyx_t_3);
11429 if (likely(__pyx_t_3 != Py_None)) {
11430 PyObject* sequence = __pyx_t_3;
11431 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11432 if (unlikely(size != 2)) {
11433 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11434 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11435 __PYX_ERR(2, 407, __pyx_L1_error)
11436 }
11437 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11438 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
11439 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
11440 __Pyx_INCREF(__pyx_t_4);
11441 __Pyx_INCREF(__pyx_t_5);
11442 #else
11443 __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
11444 __Pyx_GOTREF(__pyx_t_4);
11445 __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
11446 __Pyx_GOTREF(__pyx_t_5);
11447 #endif
11448 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11449 } else {
11450 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
11451 }
11452 __pyx_v_have_slices = __pyx_t_4;
11453 __pyx_t_4 = 0;
11454 __pyx_v_indices = __pyx_t_5;
11455 __pyx_t_5 = 0;
11456
11457 /* "View.MemoryView":410
11458 *
11459 * cdef char *itemp
11460 * if have_slices: # <<<<<<<<<<<<<<
11461 * return memview_slice(self, indices)
11462 * else:
11463 */
11464 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
11465 if (__pyx_t_2) {
11466
11467 /* "View.MemoryView":411
11468 * cdef char *itemp
11469 * if have_slices:
11470 * return memview_slice(self, indices) # <<<<<<<<<<<<<<
11471 * else:
11472 * itemp = self.get_item_pointer(indices)
11473 */
11474 __Pyx_XDECREF(__pyx_r);
11475 __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)
11476 __Pyx_GOTREF(__pyx_t_3);
11477 __pyx_r = __pyx_t_3;
11478 __pyx_t_3 = 0;
11479 goto __pyx_L0;
11480
11481 /* "View.MemoryView":410
11482 *
11483 * cdef char *itemp
11484 * if have_slices: # <<<<<<<<<<<<<<
11485 * return memview_slice(self, indices)
11486 * else:
11487 */
11488 }
11489
11490 /* "View.MemoryView":413
11491 * return memview_slice(self, indices)
11492 * else:
11493 * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
11494 * return self.convert_item_to_object(itemp)
11495 *
11496 */
11497 /*else*/ {
11498 __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)
11499 __pyx_v_itemp = __pyx_t_6;
11500
11501 /* "View.MemoryView":414
11502 * else:
11503 * itemp = self.get_item_pointer(indices)
11504 * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
11505 *
11506 * def __setitem__(memoryview self, object index, object value):
11507 */
11508 __Pyx_XDECREF(__pyx_r);
11509 __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)
11510 __Pyx_GOTREF(__pyx_t_3);
11511 __pyx_r = __pyx_t_3;
11512 __pyx_t_3 = 0;
11513 goto __pyx_L0;
11514 }
11515
11516 /* "View.MemoryView":403
11517 *
11518 *
11519 * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
11520 * if index is Ellipsis:
11521 * return self
11522 */
11523
11524 /* function exit code */
11525 __pyx_L1_error:;
11526 __Pyx_XDECREF(__pyx_t_3);
11527 __Pyx_XDECREF(__pyx_t_4);
11528 __Pyx_XDECREF(__pyx_t_5);
11529 __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11530 __pyx_r = NULL;
11531 __pyx_L0:;
11532 __Pyx_XDECREF(__pyx_v_have_slices);
11533 __Pyx_XDECREF(__pyx_v_indices);
11534 __Pyx_XGIVEREF(__pyx_r);
11535 __Pyx_RefNannyFinishContext();
11536 return __pyx_r;
11537}
11538
11539/* "View.MemoryView":416
11540 * return self.convert_item_to_object(itemp)
11541 *
11542 * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
11543 * if self.view.readonly:
11544 * raise TypeError("Cannot assign to read-only memoryview")
11545 */
11546
11547/* Python wrapper */
11548static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
11549static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11550 int __pyx_r;
11551 __Pyx_RefNannyDeclarations
11552 __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
11553 __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));
11554
11555 /* function exit code */
11556 __Pyx_RefNannyFinishContext();
11557 return __pyx_r;
11558}
11559
11560static 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) {
11561 PyObject *__pyx_v_have_slices = NULL;
11562 PyObject *__pyx_v_obj = NULL;
11563 int __pyx_r;
11564 __Pyx_RefNannyDeclarations
11565 int __pyx_t_1;
11566 PyObject *__pyx_t_2 = NULL;
11567 PyObject *__pyx_t_3 = NULL;
11568 PyObject *__pyx_t_4 = NULL;
11569 int __pyx_lineno = 0;
11570 const char *__pyx_filename = NULL;
11571 int __pyx_clineno = 0;
11572 __Pyx_RefNannySetupContext("__setitem__", 0);
11573 __Pyx_INCREF(__pyx_v_index);
11574
11575 /* "View.MemoryView":417
11576 *
11577 * def __setitem__(memoryview self, object index, object value):
11578 * if self.view.readonly: # <<<<<<<<<<<<<<
11579 * raise TypeError("Cannot assign to read-only memoryview")
11580 *
11581 */
11582 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
11583 if (unlikely(__pyx_t_1)) {
11584
11585 /* "View.MemoryView":418
11586 * def __setitem__(memoryview self, object index, object value):
11587 * if self.view.readonly:
11588 * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
11589 *
11590 * have_slices, index = _unellipsify(index, self.view.ndim)
11591 */
11592 __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)
11593 __Pyx_GOTREF(__pyx_t_2);
11594 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11595 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11596 __PYX_ERR(2, 418, __pyx_L1_error)
11597
11598 /* "View.MemoryView":417
11599 *
11600 * def __setitem__(memoryview self, object index, object value):
11601 * if self.view.readonly: # <<<<<<<<<<<<<<
11602 * raise TypeError("Cannot assign to read-only memoryview")
11603 *
11604 */
11605 }
11606
11607 /* "View.MemoryView":420
11608 * raise TypeError("Cannot assign to read-only memoryview")
11609 *
11610 * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
11611 *
11612 * if have_slices:
11613 */
11614 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
11615 __Pyx_GOTREF(__pyx_t_2);
11616 if (likely(__pyx_t_2 != Py_None)) {
11617 PyObject* sequence = __pyx_t_2;
11618 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11619 if (unlikely(size != 2)) {
11620 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11621 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11622 __PYX_ERR(2, 420, __pyx_L1_error)
11623 }
11624 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11625 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
11626 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
11627 __Pyx_INCREF(__pyx_t_3);
11628 __Pyx_INCREF(__pyx_t_4);
11629 #else
11630 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
11631 __Pyx_GOTREF(__pyx_t_3);
11632 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
11633 __Pyx_GOTREF(__pyx_t_4);
11634 #endif
11635 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11636 } else {
11637 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
11638 }
11639 __pyx_v_have_slices = __pyx_t_3;
11640 __pyx_t_3 = 0;
11641 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
11642 __pyx_t_4 = 0;
11643
11644 /* "View.MemoryView":422
11645 * have_slices, index = _unellipsify(index, self.view.ndim)
11646 *
11647 * if have_slices: # <<<<<<<<<<<<<<
11648 * obj = self.is_slice(value)
11649 * if obj:
11650 */
11651 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
11652 if (__pyx_t_1) {
11653
11654 /* "View.MemoryView":423
11655 *
11656 * if have_slices:
11657 * obj = self.is_slice(value) # <<<<<<<<<<<<<<
11658 * if obj:
11659 * self.setitem_slice_assignment(self[index], obj)
11660 */
11661 __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)
11662 __Pyx_GOTREF(__pyx_t_2);
11663 __pyx_v_obj = __pyx_t_2;
11664 __pyx_t_2 = 0;
11665
11666 /* "View.MemoryView":424
11667 * if have_slices:
11668 * obj = self.is_slice(value)
11669 * if obj: # <<<<<<<<<<<<<<
11670 * self.setitem_slice_assignment(self[index], obj)
11671 * else:
11672 */
11673 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
11674 if (__pyx_t_1) {
11675
11676 /* "View.MemoryView":425
11677 * obj = self.is_slice(value)
11678 * if obj:
11679 * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
11680 * else:
11681 * self.setitem_slice_assign_scalar(self[index], value)
11682 */
11683 __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)
11684 __Pyx_GOTREF(__pyx_t_2);
11685 __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)
11686 __Pyx_GOTREF(__pyx_t_4);
11687 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11688 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11689
11690 /* "View.MemoryView":424
11691 * if have_slices:
11692 * obj = self.is_slice(value)
11693 * if obj: # <<<<<<<<<<<<<<
11694 * self.setitem_slice_assignment(self[index], obj)
11695 * else:
11696 */
11697 goto __pyx_L5;
11698 }
11699
11700 /* "View.MemoryView":427
11701 * self.setitem_slice_assignment(self[index], obj)
11702 * else:
11703 * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
11704 * else:
11705 * self.setitem_indexed(index, value)
11706 */
11707 /*else*/ {
11708 __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)
11709 __Pyx_GOTREF(__pyx_t_4);
11710 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
11711 __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)
11712 __Pyx_GOTREF(__pyx_t_2);
11713 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11714 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11715 }
11716 __pyx_L5:;
11717
11718 /* "View.MemoryView":422
11719 * have_slices, index = _unellipsify(index, self.view.ndim)
11720 *
11721 * if have_slices: # <<<<<<<<<<<<<<
11722 * obj = self.is_slice(value)
11723 * if obj:
11724 */
11725 goto __pyx_L4;
11726 }
11727
11728 /* "View.MemoryView":429
11729 * self.setitem_slice_assign_scalar(self[index], value)
11730 * else:
11731 * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
11732 *
11733 * cdef is_slice(self, obj):
11734 */
11735 /*else*/ {
11736 __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)
11737 __Pyx_GOTREF(__pyx_t_2);
11738 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11739 }
11740 __pyx_L4:;
11741
11742 /* "View.MemoryView":416
11743 * return self.convert_item_to_object(itemp)
11744 *
11745 * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
11746 * if self.view.readonly:
11747 * raise TypeError("Cannot assign to read-only memoryview")
11748 */
11749
11750 /* function exit code */
11751 __pyx_r = 0;
11752 goto __pyx_L0;
11753 __pyx_L1_error:;
11754 __Pyx_XDECREF(__pyx_t_2);
11755 __Pyx_XDECREF(__pyx_t_3);
11756 __Pyx_XDECREF(__pyx_t_4);
11757 __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11758 __pyx_r = -1;
11759 __pyx_L0:;
11760 __Pyx_XDECREF(__pyx_v_have_slices);
11761 __Pyx_XDECREF(__pyx_v_obj);
11762 __Pyx_XDECREF(__pyx_v_index);
11763 __Pyx_RefNannyFinishContext();
11764 return __pyx_r;
11765}
11766
11767/* "View.MemoryView":431
11768 * self.setitem_indexed(index, value)
11769 *
11770 * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
11771 * if not isinstance(obj, memoryview):
11772 * try:
11773 */
11774
11775static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
11776 PyObject *__pyx_r = NULL;
11777 __Pyx_RefNannyDeclarations
11778 int __pyx_t_1;
11779 int __pyx_t_2;
11780 PyObject *__pyx_t_3 = NULL;
11781 PyObject *__pyx_t_4 = NULL;
11782 PyObject *__pyx_t_5 = NULL;
11783 PyObject *__pyx_t_6 = NULL;
11784 PyObject *__pyx_t_7 = NULL;
11785 PyObject *__pyx_t_8 = NULL;
11786 int __pyx_t_9;
11787 int __pyx_lineno = 0;
11788 const char *__pyx_filename = NULL;
11789 int __pyx_clineno = 0;
11790 __Pyx_RefNannySetupContext("is_slice", 0);
11791 __Pyx_INCREF(__pyx_v_obj);
11792
11793 /* "View.MemoryView":432
11794 *
11795 * cdef is_slice(self, obj):
11796 * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
11797 * try:
11798 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
11799 */
11800 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
11801 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
11802 if (__pyx_t_2) {
11803
11804 /* "View.MemoryView":433
11805 * cdef is_slice(self, obj):
11806 * if not isinstance(obj, memoryview):
11807 * try: # <<<<<<<<<<<<<<
11808 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
11809 * self.dtype_is_object)
11810 */
11811 {
11812 __Pyx_PyThreadState_declare
11813 __Pyx_PyThreadState_assign
11814 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
11815 __Pyx_XGOTREF(__pyx_t_3);
11816 __Pyx_XGOTREF(__pyx_t_4);
11817 __Pyx_XGOTREF(__pyx_t_5);
11818 /*try:*/ {
11819
11820 /* "View.MemoryView":434
11821 * if not isinstance(obj, memoryview):
11822 * try:
11823 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
11824 * self.dtype_is_object)
11825 * except TypeError:
11826 */
11827 __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)
11828 __Pyx_GOTREF(__pyx_t_6);
11829
11830 /* "View.MemoryView":435
11831 * try:
11832 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
11833 * self.dtype_is_object) # <<<<<<<<<<<<<<
11834 * except TypeError:
11835 * return None
11836 */
11837 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
11838 __Pyx_GOTREF(__pyx_t_7);
11839
11840 /* "View.MemoryView":434
11841 * if not isinstance(obj, memoryview):
11842 * try:
11843 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
11844 * self.dtype_is_object)
11845 * except TypeError:
11846 */
11847 __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
11848 __Pyx_GOTREF(__pyx_t_8);
11849 __Pyx_INCREF(__pyx_v_obj);
11850 __Pyx_GIVEREF(__pyx_v_obj);
11851 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
11852 __Pyx_GIVEREF(__pyx_t_6);
11853 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
11854 __Pyx_GIVEREF(__pyx_t_7);
11855 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
11856 __pyx_t_6 = 0;
11857 __pyx_t_7 = 0;
11858 __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)
11859 __Pyx_GOTREF(__pyx_t_7);
11860 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11861 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
11862 __pyx_t_7 = 0;
11863
11864 /* "View.MemoryView":433
11865 * cdef is_slice(self, obj):
11866 * if not isinstance(obj, memoryview):
11867 * try: # <<<<<<<<<<<<<<
11868 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
11869 * self.dtype_is_object)
11870 */
11871 }
11872 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11873 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11874 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11875 goto __pyx_L9_try_end;
11876 __pyx_L4_error:;
11877 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11878 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11879 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
11880
11881 /* "View.MemoryView":436
11882 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
11883 * self.dtype_is_object)
11884 * except TypeError: # <<<<<<<<<<<<<<
11885 * return None
11886 *
11887 */
11888 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
11889 if (__pyx_t_9) {
11890 __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
11891 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
11892 __Pyx_GOTREF(__pyx_t_7);
11893 __Pyx_GOTREF(__pyx_t_8);
11894 __Pyx_GOTREF(__pyx_t_6);
11895
11896 /* "View.MemoryView":437
11897 * self.dtype_is_object)
11898 * except TypeError:
11899 * return None # <<<<<<<<<<<<<<
11900 *
11901 * return obj
11902 */
11903 __Pyx_XDECREF(__pyx_r);
11904 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11905 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11906 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11907 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11908 goto __pyx_L7_except_return;
11909 }
11910 goto __pyx_L6_except_error;
11911 __pyx_L6_except_error:;
11912
11913 /* "View.MemoryView":433
11914 * cdef is_slice(self, obj):
11915 * if not isinstance(obj, memoryview):
11916 * try: # <<<<<<<<<<<<<<
11917 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
11918 * self.dtype_is_object)
11919 */
11920 __Pyx_XGIVEREF(__pyx_t_3);
11921 __Pyx_XGIVEREF(__pyx_t_4);
11922 __Pyx_XGIVEREF(__pyx_t_5);
11923 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
11924 goto __pyx_L1_error;
11925 __pyx_L7_except_return:;
11926 __Pyx_XGIVEREF(__pyx_t_3);
11927 __Pyx_XGIVEREF(__pyx_t_4);
11928 __Pyx_XGIVEREF(__pyx_t_5);
11929 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
11930 goto __pyx_L0;
11931 __pyx_L9_try_end:;
11932 }
11933
11934 /* "View.MemoryView":432
11935 *
11936 * cdef is_slice(self, obj):
11937 * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
11938 * try:
11939 * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
11940 */
11941 }
11942
11943 /* "View.MemoryView":439
11944 * return None
11945 *
11946 * return obj # <<<<<<<<<<<<<<
11947 *
11948 * cdef setitem_slice_assignment(self, dst, src):
11949 */
11950 __Pyx_XDECREF(__pyx_r);
11951 __Pyx_INCREF(__pyx_v_obj);
11952 __pyx_r = __pyx_v_obj;
11953 goto __pyx_L0;
11954
11955 /* "View.MemoryView":431
11956 * self.setitem_indexed(index, value)
11957 *
11958 * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
11959 * if not isinstance(obj, memoryview):
11960 * try:
11961 */
11962
11963 /* function exit code */
11964 __pyx_L1_error:;
11965 __Pyx_XDECREF(__pyx_t_6);
11966 __Pyx_XDECREF(__pyx_t_7);
11967 __Pyx_XDECREF(__pyx_t_8);
11968 __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
11969 __pyx_r = 0;
11970 __pyx_L0:;
11971 __Pyx_XDECREF(__pyx_v_obj);
11972 __Pyx_XGIVEREF(__pyx_r);
11973 __Pyx_RefNannyFinishContext();
11974 return __pyx_r;
11975}
11976
11977/* "View.MemoryView":441
11978 * return obj
11979 *
11980 * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
11981 * cdef __Pyx_memviewslice dst_slice
11982 * cdef __Pyx_memviewslice src_slice
11983 */
11984
11985static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
11986 __Pyx_memviewslice __pyx_v_dst_slice;
11987 __Pyx_memviewslice __pyx_v_src_slice;
11988 PyObject *__pyx_r = NULL;
11989 __Pyx_RefNannyDeclarations
11990 __Pyx_memviewslice *__pyx_t_1;
11991 __Pyx_memviewslice *__pyx_t_2;
11992 PyObject *__pyx_t_3 = NULL;
11993 int __pyx_t_4;
11994 int __pyx_t_5;
11995 int __pyx_t_6;
11996 int __pyx_lineno = 0;
11997 const char *__pyx_filename = NULL;
11998 int __pyx_clineno = 0;
11999 __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
12000
12001 /* "View.MemoryView":445
12002 * cdef __Pyx_memviewslice src_slice
12003 *
12004 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
12005 * get_slice_from_memview(dst, &dst_slice)[0],
12006 * src.ndim, dst.ndim, self.dtype_is_object)
12007 */
12008 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
12009 __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)
12010
12011 /* "View.MemoryView":446
12012 *
12013 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
12014 * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<<
12015 * src.ndim, dst.ndim, self.dtype_is_object)
12016 *
12017 */
12018 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
12019 __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)
12020
12021 /* "View.MemoryView":447
12022 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
12023 * get_slice_from_memview(dst, &dst_slice)[0],
12024 * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
12025 *
12026 * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
12027 */
12028 __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)
12029 __Pyx_GOTREF(__pyx_t_3);
12030 __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)
12031 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12032 __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)
12033 __Pyx_GOTREF(__pyx_t_3);
12034 __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)
12035 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12036
12037 /* "View.MemoryView":445
12038 * cdef __Pyx_memviewslice src_slice
12039 *
12040 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
12041 * get_slice_from_memview(dst, &dst_slice)[0],
12042 * src.ndim, dst.ndim, self.dtype_is_object)
12043 */
12044 __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)
12045
12046 /* "View.MemoryView":441
12047 * return obj
12048 *
12049 * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
12050 * cdef __Pyx_memviewslice dst_slice
12051 * cdef __Pyx_memviewslice src_slice
12052 */
12053
12054 /* function exit code */
12055 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12056 goto __pyx_L0;
12057 __pyx_L1_error:;
12058 __Pyx_XDECREF(__pyx_t_3);
12059 __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
12060 __pyx_r = 0;
12061 __pyx_L0:;
12062 __Pyx_XGIVEREF(__pyx_r);
12063 __Pyx_RefNannyFinishContext();
12064 return __pyx_r;
12065}
12066
12067/* "View.MemoryView":449
12068 * src.ndim, dst.ndim, self.dtype_is_object)
12069 *
12070 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
12071 * cdef int array[128]
12072 * cdef void *tmp = NULL
12073 */
12074
12075static 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) {
12076 int __pyx_v_array[0x80];
12077 void *__pyx_v_tmp;
12078 void *__pyx_v_item;
12079 __Pyx_memviewslice *__pyx_v_dst_slice;
12080 __Pyx_memviewslice __pyx_v_tmp_slice;
12081 PyObject *__pyx_r = NULL;
12082 __Pyx_RefNannyDeclarations
12083 __Pyx_memviewslice *__pyx_t_1;
12084 int __pyx_t_2;
12085 PyObject *__pyx_t_3 = NULL;
12086 int __pyx_t_4;
12087 int __pyx_t_5;
12088 char const *__pyx_t_6;
12089 PyObject *__pyx_t_7 = NULL;
12090 PyObject *__pyx_t_8 = NULL;
12091 PyObject *__pyx_t_9 = NULL;
12092 PyObject *__pyx_t_10 = NULL;
12093 PyObject *__pyx_t_11 = NULL;
12094 PyObject *__pyx_t_12 = NULL;
12095 int __pyx_lineno = 0;
12096 const char *__pyx_filename = NULL;
12097 int __pyx_clineno = 0;
12098 __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
12099
12100 /* "View.MemoryView":451
12101 * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
12102 * cdef int array[128]
12103 * cdef void *tmp = NULL # <<<<<<<<<<<<<<
12104 * cdef void *item
12105 *
12106 */
12107 __pyx_v_tmp = NULL;
12108
12109 /* "View.MemoryView":456
12110 * cdef __Pyx_memviewslice *dst_slice
12111 * cdef __Pyx_memviewslice tmp_slice
12112 * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
12113 *
12114 * if <size_t>self.view.itemsize > sizeof(array):
12115 */
12116 __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)
12117 __pyx_v_dst_slice = __pyx_t_1;
12118
12119 /* "View.MemoryView":458
12120 * dst_slice = get_slice_from_memview(dst, &tmp_slice)
12121 *
12122 * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
12123 * tmp = PyMem_Malloc(self.view.itemsize)
12124 * if tmp == NULL:
12125 */
12126 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
12127 if (__pyx_t_2) {
12128
12129 /* "View.MemoryView":459
12130 *
12131 * if <size_t>self.view.itemsize > sizeof(array):
12132 * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
12133 * if tmp == NULL:
12134 * raise MemoryError
12135 */
12136 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
12137
12138 /* "View.MemoryView":460
12139 * if <size_t>self.view.itemsize > sizeof(array):
12140 * tmp = PyMem_Malloc(self.view.itemsize)
12141 * if tmp == NULL: # <<<<<<<<<<<<<<
12142 * raise MemoryError
12143 * item = tmp
12144 */
12145 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
12146 if (unlikely(__pyx_t_2)) {
12147
12148 /* "View.MemoryView":461
12149 * tmp = PyMem_Malloc(self.view.itemsize)
12150 * if tmp == NULL:
12151 * raise MemoryError # <<<<<<<<<<<<<<
12152 * item = tmp
12153 * else:
12154 */
12155 PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
12156
12157 /* "View.MemoryView":460
12158 * if <size_t>self.view.itemsize > sizeof(array):
12159 * tmp = PyMem_Malloc(self.view.itemsize)
12160 * if tmp == NULL: # <<<<<<<<<<<<<<
12161 * raise MemoryError
12162 * item = tmp
12163 */
12164 }
12165
12166 /* "View.MemoryView":462
12167 * if tmp == NULL:
12168 * raise MemoryError
12169 * item = tmp # <<<<<<<<<<<<<<
12170 * else:
12171 * item = <void *> array
12172 */
12173 __pyx_v_item = __pyx_v_tmp;
12174
12175 /* "View.MemoryView":458
12176 * dst_slice = get_slice_from_memview(dst, &tmp_slice)
12177 *
12178 * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
12179 * tmp = PyMem_Malloc(self.view.itemsize)
12180 * if tmp == NULL:
12181 */
12182 goto __pyx_L3;
12183 }
12184
12185 /* "View.MemoryView":464
12186 * item = tmp
12187 * else:
12188 * item = <void *> array # <<<<<<<<<<<<<<
12189 *
12190 * try:
12191 */
12192 /*else*/ {
12193 __pyx_v_item = ((void *)__pyx_v_array);
12194 }
12195 __pyx_L3:;
12196
12197 /* "View.MemoryView":466
12198 * item = <void *> array
12199 *
12200 * try: # <<<<<<<<<<<<<<
12201 * if self.dtype_is_object:
12202 * (<PyObject **> item)[0] = <PyObject *> value
12203 */
12204 /*try:*/ {
12205
12206 /* "View.MemoryView":467
12207 *
12208 * try:
12209 * if self.dtype_is_object: # <<<<<<<<<<<<<<
12210 * (<PyObject **> item)[0] = <PyObject *> value
12211 * else:
12212 */
12213 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
12214 if (__pyx_t_2) {
12215
12216 /* "View.MemoryView":468
12217 * try:
12218 * if self.dtype_is_object:
12219 * (<PyObject **> item)[0] = <PyObject *> value # <<<<<<<<<<<<<<
12220 * else:
12221 * self.assign_item_from_object(<char *> item, value)
12222 */
12223 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
12224
12225 /* "View.MemoryView":467
12226 *
12227 * try:
12228 * if self.dtype_is_object: # <<<<<<<<<<<<<<
12229 * (<PyObject **> item)[0] = <PyObject *> value
12230 * else:
12231 */
12232 goto __pyx_L8;
12233 }
12234
12235 /* "View.MemoryView":470
12236 * (<PyObject **> item)[0] = <PyObject *> value
12237 * else:
12238 * self.assign_item_from_object(<char *> item, value) # <<<<<<<<<<<<<<
12239 *
12240 *
12241 */
12242 /*else*/ {
12243 __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)
12244 __Pyx_GOTREF(__pyx_t_3);
12245 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12246 }
12247 __pyx_L8:;
12248
12249 /* "View.MemoryView":474
12250 *
12251 *
12252 * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
12253 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
12254 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
12255 */
12256 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
12257 if (__pyx_t_2) {
12258
12259 /* "View.MemoryView":475
12260 *
12261 * if self.view.suboffsets != NULL:
12262 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
12263 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
12264 * item, self.dtype_is_object)
12265 */
12266 __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)
12267 __Pyx_GOTREF(__pyx_t_3);
12268 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12269
12270 /* "View.MemoryView":474
12271 *
12272 *
12273 * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
12274 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
12275 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
12276 */
12277 }
12278
12279 /* "View.MemoryView":476
12280 * if self.view.suboffsets != NULL:
12281 * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
12282 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
12283 * item, self.dtype_is_object)
12284 * finally:
12285 */
12286 __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);
12287 }
12288
12289 /* "View.MemoryView":479
12290 * item, self.dtype_is_object)
12291 * finally:
12292 * PyMem_Free(tmp) # <<<<<<<<<<<<<<
12293 *
12294 * cdef setitem_indexed(self, index, value):
12295 */
12296 /*finally:*/ {
12297 /*normal exit:*/{
12298 PyMem_Free(__pyx_v_tmp);
12299 goto __pyx_L7;
12300 }
12301 __pyx_L6_error:;
12302 /*exception exit:*/{
12303 __Pyx_PyThreadState_declare
12304 __Pyx_PyThreadState_assign
12305 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
12306 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12307 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
12308 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);
12309 __Pyx_XGOTREF(__pyx_t_7);
12310 __Pyx_XGOTREF(__pyx_t_8);
12311 __Pyx_XGOTREF(__pyx_t_9);
12312 __Pyx_XGOTREF(__pyx_t_10);
12313 __Pyx_XGOTREF(__pyx_t_11);
12314 __Pyx_XGOTREF(__pyx_t_12);
12315 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
12316 {
12317 PyMem_Free(__pyx_v_tmp);
12318 }
12319 if (PY_MAJOR_VERSION >= 3) {
12320 __Pyx_XGIVEREF(__pyx_t_10);
12321 __Pyx_XGIVEREF(__pyx_t_11);
12322 __Pyx_XGIVEREF(__pyx_t_12);
12323 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
12324 }
12325 __Pyx_XGIVEREF(__pyx_t_7);
12326 __Pyx_XGIVEREF(__pyx_t_8);
12327 __Pyx_XGIVEREF(__pyx_t_9);
12328 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
12329 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
12330 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
12331 goto __pyx_L1_error;
12332 }
12333 __pyx_L7:;
12334 }
12335
12336 /* "View.MemoryView":449
12337 * src.ndim, dst.ndim, self.dtype_is_object)
12338 *
12339 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
12340 * cdef int array[128]
12341 * cdef void *tmp = NULL
12342 */
12343
12344 /* function exit code */
12345 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12346 goto __pyx_L0;
12347 __pyx_L1_error:;
12348 __Pyx_XDECREF(__pyx_t_3);
12349 __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
12350 __pyx_r = 0;
12351 __pyx_L0:;
12352 __Pyx_XGIVEREF(__pyx_r);
12353 __Pyx_RefNannyFinishContext();
12354 return __pyx_r;
12355}
12356
12357/* "View.MemoryView":481
12358 * PyMem_Free(tmp)
12359 *
12360 * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
12361 * cdef char *itemp = self.get_item_pointer(index)
12362 * self.assign_item_from_object(itemp, value)
12363 */
12364
12365static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
12366 char *__pyx_v_itemp;
12367 PyObject *__pyx_r = NULL;
12368 __Pyx_RefNannyDeclarations
12369 char *__pyx_t_1;
12370 PyObject *__pyx_t_2 = NULL;
12371 int __pyx_lineno = 0;
12372 const char *__pyx_filename = NULL;
12373 int __pyx_clineno = 0;
12374 __Pyx_RefNannySetupContext("setitem_indexed", 0);
12375
12376 /* "View.MemoryView":482
12377 *
12378 * cdef setitem_indexed(self, index, value):
12379 * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
12380 * self.assign_item_from_object(itemp, value)
12381 *
12382 */
12383 __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)
12384 __pyx_v_itemp = __pyx_t_1;
12385
12386 /* "View.MemoryView":483
12387 * cdef setitem_indexed(self, index, value):
12388 * cdef char *itemp = self.get_item_pointer(index)
12389 * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
12390 *
12391 * cdef convert_item_to_object(self, char *itemp):
12392 */
12393 __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)
12394 __Pyx_GOTREF(__pyx_t_2);
12395 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12396
12397 /* "View.MemoryView":481
12398 * PyMem_Free(tmp)
12399 *
12400 * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
12401 * cdef char *itemp = self.get_item_pointer(index)
12402 * self.assign_item_from_object(itemp, value)
12403 */
12404
12405 /* function exit code */
12406 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12407 goto __pyx_L0;
12408 __pyx_L1_error:;
12409 __Pyx_XDECREF(__pyx_t_2);
12410 __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
12411 __pyx_r = 0;
12412 __pyx_L0:;
12413 __Pyx_XGIVEREF(__pyx_r);
12414 __Pyx_RefNannyFinishContext();
12415 return __pyx_r;
12416}
12417
12418/* "View.MemoryView":485
12419 * self.assign_item_from_object(itemp, value)
12420 *
12421 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
12422 * """Only used if instantiated manually by the user, or if Cython doesn't
12423 * know how to convert the type"""
12424 */
12425
12426static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
12427 PyObject *__pyx_v_struct = NULL;
12428 PyObject *__pyx_v_bytesitem = 0;
12429 PyObject *__pyx_v_result = NULL;
12430 PyObject *__pyx_r = NULL;
12431 __Pyx_RefNannyDeclarations
12432 PyObject *__pyx_t_1 = NULL;
12433 PyObject *__pyx_t_2 = NULL;
12434 PyObject *__pyx_t_3 = NULL;
12435 PyObject *__pyx_t_4 = NULL;
12436 PyObject *__pyx_t_5 = NULL;
12437 PyObject *__pyx_t_6 = NULL;
12438 PyObject *__pyx_t_7 = NULL;
12439 int __pyx_t_8;
12440 PyObject *__pyx_t_9 = NULL;
12441 size_t __pyx_t_10;
12442 int __pyx_t_11;
12443 int __pyx_lineno = 0;
12444 const char *__pyx_filename = NULL;
12445 int __pyx_clineno = 0;
12446 __Pyx_RefNannySetupContext("convert_item_to_object", 0);
12447
12448 /* "View.MemoryView":488
12449 * """Only used if instantiated manually by the user, or if Cython doesn't
12450 * know how to convert the type"""
12451 * import struct # <<<<<<<<<<<<<<
12452 * cdef bytes bytesitem
12453 *
12454 */
12455 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
12456 __Pyx_GOTREF(__pyx_t_1);
12457 __pyx_v_struct = __pyx_t_1;
12458 __pyx_t_1 = 0;
12459
12460 /* "View.MemoryView":491
12461 * cdef bytes bytesitem
12462 *
12463 * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
12464 * try:
12465 * result = struct.unpack(self.view.format, bytesitem)
12466 */
12467 __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)
12468 __Pyx_GOTREF(__pyx_t_1);
12469 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
12470 __pyx_t_1 = 0;
12471
12472 /* "View.MemoryView":492
12473 *
12474 * bytesitem = itemp[:self.view.itemsize]
12475 * try: # <<<<<<<<<<<<<<
12476 * result = struct.unpack(self.view.format, bytesitem)
12477 * except struct.error:
12478 */
12479 {
12480 __Pyx_PyThreadState_declare
12481 __Pyx_PyThreadState_assign
12482 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
12483 __Pyx_XGOTREF(__pyx_t_2);
12484 __Pyx_XGOTREF(__pyx_t_3);
12485 __Pyx_XGOTREF(__pyx_t_4);
12486 /*try:*/ {
12487
12488 /* "View.MemoryView":493
12489 * bytesitem = itemp[:self.view.itemsize]
12490 * try:
12491 * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
12492 * except struct.error:
12493 * raise ValueError("Unable to convert item to object")
12494 */
12495 __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)
12496 __Pyx_GOTREF(__pyx_t_5);
12497 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
12498 __Pyx_GOTREF(__pyx_t_6);
12499 __pyx_t_7 = NULL;
12500 __pyx_t_8 = 0;
12501 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
12502 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
12503 if (likely(__pyx_t_7)) {
12504 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
12505 __Pyx_INCREF(__pyx_t_7);
12506 __Pyx_INCREF(function);
12507 __Pyx_DECREF_SET(__pyx_t_5, function);
12508 __pyx_t_8 = 1;
12509 }
12510 }
12511 #if CYTHON_FAST_PYCALL
12512 if (PyFunction_Check(__pyx_t_5)) {
12513 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
12514 __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)
12515 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12516 __Pyx_GOTREF(__pyx_t_1);
12517 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12518 } else
12519 #endif
12520 #if CYTHON_FAST_PYCCALL
12521 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
12522 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
12523 __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)
12524 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12525 __Pyx_GOTREF(__pyx_t_1);
12526 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12527 } else
12528 #endif
12529 {
12530 __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
12531 __Pyx_GOTREF(__pyx_t_9);
12532 if (__pyx_t_7) {
12533 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
12534 }
12535 __Pyx_GIVEREF(__pyx_t_6);
12536 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
12537 __Pyx_INCREF(__pyx_v_bytesitem);
12538 __Pyx_GIVEREF(__pyx_v_bytesitem);
12539 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
12540 __pyx_t_6 = 0;
12541 __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)
12542 __Pyx_GOTREF(__pyx_t_1);
12543 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12544 }
12545 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12546 __pyx_v_result = __pyx_t_1;
12547 __pyx_t_1 = 0;
12548
12549 /* "View.MemoryView":492
12550 *
12551 * bytesitem = itemp[:self.view.itemsize]
12552 * try: # <<<<<<<<<<<<<<
12553 * result = struct.unpack(self.view.format, bytesitem)
12554 * except struct.error:
12555 */
12556 }
12557
12558 /* "View.MemoryView":497
12559 * raise ValueError("Unable to convert item to object")
12560 * else:
12561 * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
12562 * return result[0]
12563 * return result
12564 */
12565 /*else:*/ {
12566 __pyx_t_10 = strlen(__pyx_v_self->view.format);
12567 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
12568 if (__pyx_t_11) {
12569
12570 /* "View.MemoryView":498
12571 * else:
12572 * if len(self.view.format) == 1:
12573 * return result[0] # <<<<<<<<<<<<<<
12574 * return result
12575 *
12576 */
12577 __Pyx_XDECREF(__pyx_r);
12578 __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)
12579 __Pyx_GOTREF(__pyx_t_1);
12580 __pyx_r = __pyx_t_1;
12581 __pyx_t_1 = 0;
12582 goto __pyx_L6_except_return;
12583
12584 /* "View.MemoryView":497
12585 * raise ValueError("Unable to convert item to object")
12586 * else:
12587 * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
12588 * return result[0]
12589 * return result
12590 */
12591 }
12592
12593 /* "View.MemoryView":499
12594 * if len(self.view.format) == 1:
12595 * return result[0]
12596 * return result # <<<<<<<<<<<<<<
12597 *
12598 * cdef assign_item_from_object(self, char *itemp, object value):
12599 */
12600 __Pyx_XDECREF(__pyx_r);
12601 __Pyx_INCREF(__pyx_v_result);
12602 __pyx_r = __pyx_v_result;
12603 goto __pyx_L6_except_return;
12604 }
12605 __pyx_L3_error:;
12606 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12607 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12608 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
12609 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12610 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
12611
12612 /* "View.MemoryView":494
12613 * try:
12614 * result = struct.unpack(self.view.format, bytesitem)
12615 * except struct.error: # <<<<<<<<<<<<<<
12616 * raise ValueError("Unable to convert item to object")
12617 * else:
12618 */
12619 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
12620 __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)
12621 __Pyx_GOTREF(__pyx_t_6);
12622 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
12623 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12624 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
12625 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
12626 if (__pyx_t_8) {
12627 __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12628 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
12629 __Pyx_GOTREF(__pyx_t_9);
12630 __Pyx_GOTREF(__pyx_t_5);
12631 __Pyx_GOTREF(__pyx_t_1);
12632
12633 /* "View.MemoryView":495
12634 * result = struct.unpack(self.view.format, bytesitem)
12635 * except struct.error:
12636 * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
12637 * else:
12638 * if len(self.view.format) == 1:
12639 */
12640 __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)
12641 __Pyx_GOTREF(__pyx_t_6);
12642 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
12643 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12644 __PYX_ERR(2, 495, __pyx_L5_except_error)
12645 }
12646 goto __pyx_L5_except_error;
12647 __pyx_L5_except_error:;
12648
12649 /* "View.MemoryView":492
12650 *
12651 * bytesitem = itemp[:self.view.itemsize]
12652 * try: # <<<<<<<<<<<<<<
12653 * result = struct.unpack(self.view.format, bytesitem)
12654 * except struct.error:
12655 */
12656 __Pyx_XGIVEREF(__pyx_t_2);
12657 __Pyx_XGIVEREF(__pyx_t_3);
12658 __Pyx_XGIVEREF(__pyx_t_4);
12659 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
12660 goto __pyx_L1_error;
12661 __pyx_L6_except_return:;
12662 __Pyx_XGIVEREF(__pyx_t_2);
12663 __Pyx_XGIVEREF(__pyx_t_3);
12664 __Pyx_XGIVEREF(__pyx_t_4);
12665 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
12666 goto __pyx_L0;
12667 }
12668
12669 /* "View.MemoryView":485
12670 * self.assign_item_from_object(itemp, value)
12671 *
12672 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
12673 * """Only used if instantiated manually by the user, or if Cython doesn't
12674 * know how to convert the type"""
12675 */
12676
12677 /* function exit code */
12678 __pyx_L1_error:;
12679 __Pyx_XDECREF(__pyx_t_1);
12680 __Pyx_XDECREF(__pyx_t_5);
12681 __Pyx_XDECREF(__pyx_t_6);
12682 __Pyx_XDECREF(__pyx_t_7);
12683 __Pyx_XDECREF(__pyx_t_9);
12684 __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12685 __pyx_r = 0;
12686 __pyx_L0:;
12687 __Pyx_XDECREF(__pyx_v_struct);
12688 __Pyx_XDECREF(__pyx_v_bytesitem);
12689 __Pyx_XDECREF(__pyx_v_result);
12690 __Pyx_XGIVEREF(__pyx_r);
12691 __Pyx_RefNannyFinishContext();
12692 return __pyx_r;
12693}
12694
12695/* "View.MemoryView":501
12696 * return result
12697 *
12698 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
12699 * """Only used if instantiated manually by the user, or if Cython doesn't
12700 * know how to convert the type"""
12701 */
12702
12703static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
12704 PyObject *__pyx_v_struct = NULL;
12705 char __pyx_v_c;
12706 PyObject *__pyx_v_bytesvalue = 0;
12707 Py_ssize_t __pyx_v_i;
12708 PyObject *__pyx_r = NULL;
12709 __Pyx_RefNannyDeclarations
12710 PyObject *__pyx_t_1 = NULL;
12711 int __pyx_t_2;
12712 int __pyx_t_3;
12713 PyObject *__pyx_t_4 = NULL;
12714 PyObject *__pyx_t_5 = NULL;
12715 PyObject *__pyx_t_6 = NULL;
12716 int __pyx_t_7;
12717 PyObject *__pyx_t_8 = NULL;
12718 Py_ssize_t __pyx_t_9;
12719 PyObject *__pyx_t_10 = NULL;
12720 char *__pyx_t_11;
12721 char *__pyx_t_12;
12722 char *__pyx_t_13;
12723 char *__pyx_t_14;
12724 int __pyx_lineno = 0;
12725 const char *__pyx_filename = NULL;
12726 int __pyx_clineno = 0;
12727 __Pyx_RefNannySetupContext("assign_item_from_object", 0);
12728
12729 /* "View.MemoryView":504
12730 * """Only used if instantiated manually by the user, or if Cython doesn't
12731 * know how to convert the type"""
12732 * import struct # <<<<<<<<<<<<<<
12733 * cdef char c
12734 * cdef bytes bytesvalue
12735 */
12736 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
12737 __Pyx_GOTREF(__pyx_t_1);
12738 __pyx_v_struct = __pyx_t_1;
12739 __pyx_t_1 = 0;
12740
12741 /* "View.MemoryView":509
12742 * cdef Py_ssize_t i
12743 *
12744 * if isinstance(value, tuple): # <<<<<<<<<<<<<<
12745 * bytesvalue = struct.pack(self.view.format, *value)
12746 * else:
12747 */
12748 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
12749 __pyx_t_3 = (__pyx_t_2 != 0);
12750 if (__pyx_t_3) {
12751
12752 /* "View.MemoryView":510
12753 *
12754 * if isinstance(value, tuple):
12755 * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
12756 * else:
12757 * bytesvalue = struct.pack(self.view.format, value)
12758 */
12759 __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)
12760 __Pyx_GOTREF(__pyx_t_1);
12761 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
12762 __Pyx_GOTREF(__pyx_t_4);
12763 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
12764 __Pyx_GOTREF(__pyx_t_5);
12765 __Pyx_GIVEREF(__pyx_t_4);
12766 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
12767 __pyx_t_4 = 0;
12768 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
12769 __Pyx_GOTREF(__pyx_t_4);
12770 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
12771 __Pyx_GOTREF(__pyx_t_6);
12772 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12773 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12774 __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)
12775 __Pyx_GOTREF(__pyx_t_4);
12776 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12777 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12778 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)
12779 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
12780 __pyx_t_4 = 0;
12781
12782 /* "View.MemoryView":509
12783 * cdef Py_ssize_t i
12784 *
12785 * if isinstance(value, tuple): # <<<<<<<<<<<<<<
12786 * bytesvalue = struct.pack(self.view.format, *value)
12787 * else:
12788 */
12789 goto __pyx_L3;
12790 }
12791
12792 /* "View.MemoryView":512
12793 * bytesvalue = struct.pack(self.view.format, *value)
12794 * else:
12795 * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
12796 *
12797 * for i, c in enumerate(bytesvalue):
12798 */
12799 /*else*/ {
12800 __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)
12801 __Pyx_GOTREF(__pyx_t_6);
12802 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
12803 __Pyx_GOTREF(__pyx_t_1);
12804 __pyx_t_5 = NULL;
12805 __pyx_t_7 = 0;
12806 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
12807 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
12808 if (likely(__pyx_t_5)) {
12809 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
12810 __Pyx_INCREF(__pyx_t_5);
12811 __Pyx_INCREF(function);
12812 __Pyx_DECREF_SET(__pyx_t_6, function);
12813 __pyx_t_7 = 1;
12814 }
12815 }
12816 #if CYTHON_FAST_PYCALL
12817 if (PyFunction_Check(__pyx_t_6)) {
12818 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
12819 __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)
12820 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12821 __Pyx_GOTREF(__pyx_t_4);
12822 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12823 } else
12824 #endif
12825 #if CYTHON_FAST_PYCCALL
12826 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
12827 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
12828 __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)
12829 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12830 __Pyx_GOTREF(__pyx_t_4);
12831 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12832 } else
12833 #endif
12834 {
12835 __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
12836 __Pyx_GOTREF(__pyx_t_8);
12837 if (__pyx_t_5) {
12838 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
12839 }
12840 __Pyx_GIVEREF(__pyx_t_1);
12841 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
12842 __Pyx_INCREF(__pyx_v_value);
12843 __Pyx_GIVEREF(__pyx_v_value);
12844 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
12845 __pyx_t_1 = 0;
12846 __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)
12847 __Pyx_GOTREF(__pyx_t_4);
12848 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12849 }
12850 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12851 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)
12852 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
12853 __pyx_t_4 = 0;
12854 }
12855 __pyx_L3:;
12856
12857 /* "View.MemoryView":514
12858 * bytesvalue = struct.pack(self.view.format, value)
12859 *
12860 * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
12861 * itemp[i] = c
12862 *
12863 */
12864 __pyx_t_9 = 0;
12865 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
12866 PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
12867 __PYX_ERR(2, 514, __pyx_L1_error)
12868 }
12869 __Pyx_INCREF(__pyx_v_bytesvalue);
12870 __pyx_t_10 = __pyx_v_bytesvalue;
12871 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
12872 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
12873 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
12874 __pyx_t_11 = __pyx_t_14;
12875 __pyx_v_c = (__pyx_t_11[0]);
12876
12877 /* "View.MemoryView":515
12878 *
12879 * for i, c in enumerate(bytesvalue):
12880 * itemp[i] = c # <<<<<<<<<<<<<<
12881 *
12882 * @cname('getbuffer')
12883 */
12884 __pyx_v_i = __pyx_t_9;
12885
12886 /* "View.MemoryView":514
12887 * bytesvalue = struct.pack(self.view.format, value)
12888 *
12889 * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
12890 * itemp[i] = c
12891 *
12892 */
12893 __pyx_t_9 = (__pyx_t_9 + 1);
12894
12895 /* "View.MemoryView":515
12896 *
12897 * for i, c in enumerate(bytesvalue):
12898 * itemp[i] = c # <<<<<<<<<<<<<<
12899 *
12900 * @cname('getbuffer')
12901 */
12902 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
12903 }
12904 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12905
12906 /* "View.MemoryView":501
12907 * return result
12908 *
12909 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
12910 * """Only used if instantiated manually by the user, or if Cython doesn't
12911 * know how to convert the type"""
12912 */
12913
12914 /* function exit code */
12915 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12916 goto __pyx_L0;
12917 __pyx_L1_error:;
12918 __Pyx_XDECREF(__pyx_t_1);
12919 __Pyx_XDECREF(__pyx_t_4);
12920 __Pyx_XDECREF(__pyx_t_5);
12921 __Pyx_XDECREF(__pyx_t_6);
12922 __Pyx_XDECREF(__pyx_t_8);
12923 __Pyx_XDECREF(__pyx_t_10);
12924 __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12925 __pyx_r = 0;
12926 __pyx_L0:;
12927 __Pyx_XDECREF(__pyx_v_struct);
12928 __Pyx_XDECREF(__pyx_v_bytesvalue);
12929 __Pyx_XGIVEREF(__pyx_r);
12930 __Pyx_RefNannyFinishContext();
12931 return __pyx_r;
12932}
12933
12934/* "View.MemoryView":518
12935 *
12936 * @cname('getbuffer')
12937 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
12938 * if flags & PyBUF_WRITABLE and self.view.readonly:
12939 * raise ValueError("Cannot create writable memory view from read-only memoryview")
12940 */
12941
12942/* Python wrapper */
12943static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
12944static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
12945 int __pyx_r;
12946 __Pyx_RefNannyDeclarations
12947 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
12948 __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));
12949
12950 /* function exit code */
12951 __Pyx_RefNannyFinishContext();
12952 return __pyx_r;
12953}
12954
12955static 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) {
12956 int __pyx_r;
12957 __Pyx_RefNannyDeclarations
12958 int __pyx_t_1;
12959 int __pyx_t_2;
12960 PyObject *__pyx_t_3 = NULL;
12961 Py_ssize_t *__pyx_t_4;
12962 char *__pyx_t_5;
12963 void *__pyx_t_6;
12964 int __pyx_t_7;
12965 Py_ssize_t __pyx_t_8;
12966 int __pyx_lineno = 0;
12967 const char *__pyx_filename = NULL;
12968 int __pyx_clineno = 0;
12969 if (__pyx_v_info == NULL) {
12970 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
12971 return -1;
12972 }
12973 __Pyx_RefNannySetupContext("__getbuffer__", 0);
12974 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
12975 __Pyx_GIVEREF(__pyx_v_info->obj);
12976
12977 /* "View.MemoryView":519
12978 * @cname('getbuffer')
12979 * def __getbuffer__(self, Py_buffer *info, int flags):
12980 * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
12981 * raise ValueError("Cannot create writable memory view from read-only memoryview")
12982 *
12983 */
12984 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
12985 if (__pyx_t_2) {
12986 } else {
12987 __pyx_t_1 = __pyx_t_2;
12988 goto __pyx_L4_bool_binop_done;
12989 }
12990 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
12991 __pyx_t_1 = __pyx_t_2;
12992 __pyx_L4_bool_binop_done:;
12993 if (unlikely(__pyx_t_1)) {
12994
12995 /* "View.MemoryView":520
12996 * def __getbuffer__(self, Py_buffer *info, int flags):
12997 * if flags & PyBUF_WRITABLE and self.view.readonly:
12998 * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
12999 *
13000 * if flags & PyBUF_ND:
13001 */
13002 __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)
13003 __Pyx_GOTREF(__pyx_t_3);
13004 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
13005 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13006 __PYX_ERR(2, 520, __pyx_L1_error)
13007
13008 /* "View.MemoryView":519
13009 * @cname('getbuffer')
13010 * def __getbuffer__(self, Py_buffer *info, int flags):
13011 * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
13012 * raise ValueError("Cannot create writable memory view from read-only memoryview")
13013 *
13014 */
13015 }
13016
13017 /* "View.MemoryView":522
13018 * raise ValueError("Cannot create writable memory view from read-only memoryview")
13019 *
13020 * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
13021 * info.shape = self.view.shape
13022 * else:
13023 */
13024 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
13025 if (__pyx_t_1) {
13026
13027 /* "View.MemoryView":523
13028 *
13029 * if flags & PyBUF_ND:
13030 * info.shape = self.view.shape # <<<<<<<<<<<<<<
13031 * else:
13032 * info.shape = NULL
13033 */
13034 __pyx_t_4 = __pyx_v_self->view.shape;
13035 __pyx_v_info->shape = __pyx_t_4;
13036
13037 /* "View.MemoryView":522
13038 * raise ValueError("Cannot create writable memory view from read-only memoryview")
13039 *
13040 * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
13041 * info.shape = self.view.shape
13042 * else:
13043 */
13044 goto __pyx_L6;
13045 }
13046
13047 /* "View.MemoryView":525
13048 * info.shape = self.view.shape
13049 * else:
13050 * info.shape = NULL # <<<<<<<<<<<<<<
13051 *
13052 * if flags & PyBUF_STRIDES:
13053 */
13054 /*else*/ {
13055 __pyx_v_info->shape = NULL;
13056 }
13057 __pyx_L6:;
13058
13059 /* "View.MemoryView":527
13060 * info.shape = NULL
13061 *
13062 * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
13063 * info.strides = self.view.strides
13064 * else:
13065 */
13066 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
13067 if (__pyx_t_1) {
13068
13069 /* "View.MemoryView":528
13070 *
13071 * if flags & PyBUF_STRIDES:
13072 * info.strides = self.view.strides # <<<<<<<<<<<<<<
13073 * else:
13074 * info.strides = NULL
13075 */
13076 __pyx_t_4 = __pyx_v_self->view.strides;
13077 __pyx_v_info->strides = __pyx_t_4;
13078
13079 /* "View.MemoryView":527
13080 * info.shape = NULL
13081 *
13082 * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
13083 * info.strides = self.view.strides
13084 * else:
13085 */
13086 goto __pyx_L7;
13087 }
13088
13089 /* "View.MemoryView":530
13090 * info.strides = self.view.strides
13091 * else:
13092 * info.strides = NULL # <<<<<<<<<<<<<<
13093 *
13094 * if flags & PyBUF_INDIRECT:
13095 */
13096 /*else*/ {
13097 __pyx_v_info->strides = NULL;
13098 }
13099 __pyx_L7:;
13100
13101 /* "View.MemoryView":532
13102 * info.strides = NULL
13103 *
13104 * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
13105 * info.suboffsets = self.view.suboffsets
13106 * else:
13107 */
13108 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
13109 if (__pyx_t_1) {
13110
13111 /* "View.MemoryView":533
13112 *
13113 * if flags & PyBUF_INDIRECT:
13114 * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
13115 * else:
13116 * info.suboffsets = NULL
13117 */
13118 __pyx_t_4 = __pyx_v_self->view.suboffsets;
13119 __pyx_v_info->suboffsets = __pyx_t_4;
13120
13121 /* "View.MemoryView":532
13122 * info.strides = NULL
13123 *
13124 * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
13125 * info.suboffsets = self.view.suboffsets
13126 * else:
13127 */
13128 goto __pyx_L8;
13129 }
13130
13131 /* "View.MemoryView":535
13132 * info.suboffsets = self.view.suboffsets
13133 * else:
13134 * info.suboffsets = NULL # <<<<<<<<<<<<<<
13135 *
13136 * if flags & PyBUF_FORMAT:
13137 */
13138 /*else*/ {
13139 __pyx_v_info->suboffsets = NULL;
13140 }
13141 __pyx_L8:;
13142
13143 /* "View.MemoryView":537
13144 * info.suboffsets = NULL
13145 *
13146 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
13147 * info.format = self.view.format
13148 * else:
13149 */
13150 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
13151 if (__pyx_t_1) {
13152
13153 /* "View.MemoryView":538
13154 *
13155 * if flags & PyBUF_FORMAT:
13156 * info.format = self.view.format # <<<<<<<<<<<<<<
13157 * else:
13158 * info.format = NULL
13159 */
13160 __pyx_t_5 = __pyx_v_self->view.format;
13161 __pyx_v_info->format = __pyx_t_5;
13162
13163 /* "View.MemoryView":537
13164 * info.suboffsets = NULL
13165 *
13166 * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
13167 * info.format = self.view.format
13168 * else:
13169 */
13170 goto __pyx_L9;
13171 }
13172
13173 /* "View.MemoryView":540
13174 * info.format = self.view.format
13175 * else:
13176 * info.format = NULL # <<<<<<<<<<<<<<
13177 *
13178 * info.buf = self.view.buf
13179 */
13180 /*else*/ {
13181 __pyx_v_info->format = NULL;
13182 }
13183 __pyx_L9:;
13184
13185 /* "View.MemoryView":542
13186 * info.format = NULL
13187 *
13188 * info.buf = self.view.buf # <<<<<<<<<<<<<<
13189 * info.ndim = self.view.ndim
13190 * info.itemsize = self.view.itemsize
13191 */
13192 __pyx_t_6 = __pyx_v_self->view.buf;
13193 __pyx_v_info->buf = __pyx_t_6;
13194
13195 /* "View.MemoryView":543
13196 *
13197 * info.buf = self.view.buf
13198 * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
13199 * info.itemsize = self.view.itemsize
13200 * info.len = self.view.len
13201 */
13202 __pyx_t_7 = __pyx_v_self->view.ndim;
13203 __pyx_v_info->ndim = __pyx_t_7;
13204
13205 /* "View.MemoryView":544
13206 * info.buf = self.view.buf
13207 * info.ndim = self.view.ndim
13208 * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
13209 * info.len = self.view.len
13210 * info.readonly = self.view.readonly
13211 */
13212 __pyx_t_8 = __pyx_v_self->view.itemsize;
13213 __pyx_v_info->itemsize = __pyx_t_8;
13214
13215 /* "View.MemoryView":545
13216 * info.ndim = self.view.ndim
13217 * info.itemsize = self.view.itemsize
13218 * info.len = self.view.len # <<<<<<<<<<<<<<
13219 * info.readonly = self.view.readonly
13220 * info.obj = self
13221 */
13222 __pyx_t_8 = __pyx_v_self->view.len;
13223 __pyx_v_info->len = __pyx_t_8;
13224
13225 /* "View.MemoryView":546
13226 * info.itemsize = self.view.itemsize
13227 * info.len = self.view.len
13228 * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
13229 * info.obj = self
13230 *
13231 */
13232 __pyx_t_1 = __pyx_v_self->view.readonly;
13233 __pyx_v_info->readonly = __pyx_t_1;
13234
13235 /* "View.MemoryView":547
13236 * info.len = self.view.len
13237 * info.readonly = self.view.readonly
13238 * info.obj = self # <<<<<<<<<<<<<<
13239 *
13240 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
13241 */
13242 __Pyx_INCREF(((PyObject *)__pyx_v_self));
13243 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
13244 __Pyx_GOTREF(__pyx_v_info->obj);
13245 __Pyx_DECREF(__pyx_v_info->obj);
13246 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
13247
13248 /* "View.MemoryView":518
13249 *
13250 * @cname('getbuffer')
13251 * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
13252 * if flags & PyBUF_WRITABLE and self.view.readonly:
13253 * raise ValueError("Cannot create writable memory view from read-only memoryview")
13254 */
13255
13256 /* function exit code */
13257 __pyx_r = 0;
13258 goto __pyx_L0;
13259 __pyx_L1_error:;
13260 __Pyx_XDECREF(__pyx_t_3);
13261 __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13262 __pyx_r = -1;
13263 if (__pyx_v_info->obj != NULL) {
13264 __Pyx_GOTREF(__pyx_v_info->obj);
13265 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
13266 }
13267 goto __pyx_L2;
13268 __pyx_L0:;
13269 if (__pyx_v_info->obj == Py_None) {
13270 __Pyx_GOTREF(__pyx_v_info->obj);
13271 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
13272 }
13273 __pyx_L2:;
13274 __Pyx_RefNannyFinishContext();
13275 return __pyx_r;
13276}
13277
13278/* "View.MemoryView":553
13279 *
13280 * @property
13281 * def T(self): # <<<<<<<<<<<<<<
13282 * cdef _memoryviewslice result = memoryview_copy(self)
13283 * transpose_memslice(&result.from_slice)
13284 */
13285
13286/* Python wrapper */
13287static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
13288static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
13289 PyObject *__pyx_r = 0;
13290 __Pyx_RefNannyDeclarations
13291 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13292 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13293
13294 /* function exit code */
13295 __Pyx_RefNannyFinishContext();
13296 return __pyx_r;
13297}
13298
13299static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13300 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
13301 PyObject *__pyx_r = NULL;
13302 __Pyx_RefNannyDeclarations
13303 PyObject *__pyx_t_1 = NULL;
13304 int __pyx_t_2;
13305 int __pyx_lineno = 0;
13306 const char *__pyx_filename = NULL;
13307 int __pyx_clineno = 0;
13308 __Pyx_RefNannySetupContext("__get__", 0);
13309
13310 /* "View.MemoryView":554
13311 * @property
13312 * def T(self):
13313 * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
13314 * transpose_memslice(&result.from_slice)
13315 * return result
13316 */
13317 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
13318 __Pyx_GOTREF(__pyx_t_1);
13319 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
13320 __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
13321 __pyx_t_1 = 0;
13322
13323 /* "View.MemoryView":555
13324 * def T(self):
13325 * cdef _memoryviewslice result = memoryview_copy(self)
13326 * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
13327 * return result
13328 *
13329 */
13330 __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)
13331
13332 /* "View.MemoryView":556
13333 * cdef _memoryviewslice result = memoryview_copy(self)
13334 * transpose_memslice(&result.from_slice)
13335 * return result # <<<<<<<<<<<<<<
13336 *
13337 * @property
13338 */
13339 __Pyx_XDECREF(__pyx_r);
13340 __Pyx_INCREF(((PyObject *)__pyx_v_result));
13341 __pyx_r = ((PyObject *)__pyx_v_result);
13342 goto __pyx_L0;
13343
13344 /* "View.MemoryView":553
13345 *
13346 * @property
13347 * def T(self): # <<<<<<<<<<<<<<
13348 * cdef _memoryviewslice result = memoryview_copy(self)
13349 * transpose_memslice(&result.from_slice)
13350 */
13351
13352 /* function exit code */
13353 __pyx_L1_error:;
13354 __Pyx_XDECREF(__pyx_t_1);
13355 __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13356 __pyx_r = NULL;
13357 __pyx_L0:;
13358 __Pyx_XDECREF((PyObject *)__pyx_v_result);
13359 __Pyx_XGIVEREF(__pyx_r);
13360 __Pyx_RefNannyFinishContext();
13361 return __pyx_r;
13362}
13363
13364/* "View.MemoryView":559
13365 *
13366 * @property
13367 * def base(self): # <<<<<<<<<<<<<<
13368 * return self.obj
13369 *
13370 */
13371
13372/* Python wrapper */
13373static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
13374static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
13375 PyObject *__pyx_r = 0;
13376 __Pyx_RefNannyDeclarations
13377 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13378 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13379
13380 /* function exit code */
13381 __Pyx_RefNannyFinishContext();
13382 return __pyx_r;
13383}
13384
13385static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13386 PyObject *__pyx_r = NULL;
13387 __Pyx_RefNannyDeclarations
13388 __Pyx_RefNannySetupContext("__get__", 0);
13389
13390 /* "View.MemoryView":560
13391 * @property
13392 * def base(self):
13393 * return self.obj # <<<<<<<<<<<<<<
13394 *
13395 * @property
13396 */
13397 __Pyx_XDECREF(__pyx_r);
13398 __Pyx_INCREF(__pyx_v_self->obj);
13399 __pyx_r = __pyx_v_self->obj;
13400 goto __pyx_L0;
13401
13402 /* "View.MemoryView":559
13403 *
13404 * @property
13405 * def base(self): # <<<<<<<<<<<<<<
13406 * return self.obj
13407 *
13408 */
13409
13410 /* function exit code */
13411 __pyx_L0:;
13412 __Pyx_XGIVEREF(__pyx_r);
13413 __Pyx_RefNannyFinishContext();
13414 return __pyx_r;
13415}
13416
13417/* "View.MemoryView":563
13418 *
13419 * @property
13420 * def shape(self): # <<<<<<<<<<<<<<
13421 * return tuple([length for length in self.view.shape[:self.view.ndim]])
13422 *
13423 */
13424
13425/* Python wrapper */
13426static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
13427static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
13428 PyObject *__pyx_r = 0;
13429 __Pyx_RefNannyDeclarations
13430 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13431 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13432
13433 /* function exit code */
13434 __Pyx_RefNannyFinishContext();
13435 return __pyx_r;
13436}
13437
13438static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13439 Py_ssize_t __pyx_v_length;
13440 PyObject *__pyx_r = NULL;
13441 __Pyx_RefNannyDeclarations
13442 PyObject *__pyx_t_1 = NULL;
13443 Py_ssize_t *__pyx_t_2;
13444 Py_ssize_t *__pyx_t_3;
13445 Py_ssize_t *__pyx_t_4;
13446 PyObject *__pyx_t_5 = NULL;
13447 int __pyx_lineno = 0;
13448 const char *__pyx_filename = NULL;
13449 int __pyx_clineno = 0;
13450 __Pyx_RefNannySetupContext("__get__", 0);
13451
13452 /* "View.MemoryView":564
13453 * @property
13454 * def shape(self):
13455 * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
13456 *
13457 * @property
13458 */
13459 __Pyx_XDECREF(__pyx_r);
13460 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
13461 __Pyx_GOTREF(__pyx_t_1);
13462 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
13463 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
13464 __pyx_t_2 = __pyx_t_4;
13465 __pyx_v_length = (__pyx_t_2[0]);
13466 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
13467 __Pyx_GOTREF(__pyx_t_5);
13468 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
13469 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13470 }
13471 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
13472 __Pyx_GOTREF(__pyx_t_5);
13473 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13474 __pyx_r = __pyx_t_5;
13475 __pyx_t_5 = 0;
13476 goto __pyx_L0;
13477
13478 /* "View.MemoryView":563
13479 *
13480 * @property
13481 * def shape(self): # <<<<<<<<<<<<<<
13482 * return tuple([length for length in self.view.shape[:self.view.ndim]])
13483 *
13484 */
13485
13486 /* function exit code */
13487 __pyx_L1_error:;
13488 __Pyx_XDECREF(__pyx_t_1);
13489 __Pyx_XDECREF(__pyx_t_5);
13490 __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13491 __pyx_r = NULL;
13492 __pyx_L0:;
13493 __Pyx_XGIVEREF(__pyx_r);
13494 __Pyx_RefNannyFinishContext();
13495 return __pyx_r;
13496}
13497
13498/* "View.MemoryView":567
13499 *
13500 * @property
13501 * def strides(self): # <<<<<<<<<<<<<<
13502 * if self.view.strides == NULL:
13503 *
13504 */
13505
13506/* Python wrapper */
13507static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
13508static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
13509 PyObject *__pyx_r = 0;
13510 __Pyx_RefNannyDeclarations
13511 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13512 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13513
13514 /* function exit code */
13515 __Pyx_RefNannyFinishContext();
13516 return __pyx_r;
13517}
13518
13519static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13520 Py_ssize_t __pyx_v_stride;
13521 PyObject *__pyx_r = NULL;
13522 __Pyx_RefNannyDeclarations
13523 int __pyx_t_1;
13524 PyObject *__pyx_t_2 = NULL;
13525 Py_ssize_t *__pyx_t_3;
13526 Py_ssize_t *__pyx_t_4;
13527 Py_ssize_t *__pyx_t_5;
13528 PyObject *__pyx_t_6 = NULL;
13529 int __pyx_lineno = 0;
13530 const char *__pyx_filename = NULL;
13531 int __pyx_clineno = 0;
13532 __Pyx_RefNannySetupContext("__get__", 0);
13533
13534 /* "View.MemoryView":568
13535 * @property
13536 * def strides(self):
13537 * if self.view.strides == NULL: # <<<<<<<<<<<<<<
13538 *
13539 * raise ValueError("Buffer view does not expose strides")
13540 */
13541 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
13542 if (unlikely(__pyx_t_1)) {
13543
13544 /* "View.MemoryView":570
13545 * if self.view.strides == NULL:
13546 *
13547 * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
13548 *
13549 * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
13550 */
13551 __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)
13552 __Pyx_GOTREF(__pyx_t_2);
13553 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13554 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13555 __PYX_ERR(2, 570, __pyx_L1_error)
13556
13557 /* "View.MemoryView":568
13558 * @property
13559 * def strides(self):
13560 * if self.view.strides == NULL: # <<<<<<<<<<<<<<
13561 *
13562 * raise ValueError("Buffer view does not expose strides")
13563 */
13564 }
13565
13566 /* "View.MemoryView":572
13567 * raise ValueError("Buffer view does not expose strides")
13568 *
13569 * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
13570 *
13571 * @property
13572 */
13573 __Pyx_XDECREF(__pyx_r);
13574 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
13575 __Pyx_GOTREF(__pyx_t_2);
13576 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
13577 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
13578 __pyx_t_3 = __pyx_t_5;
13579 __pyx_v_stride = (__pyx_t_3[0]);
13580 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
13581 __Pyx_GOTREF(__pyx_t_6);
13582 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
13583 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13584 }
13585 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
13586 __Pyx_GOTREF(__pyx_t_6);
13587 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13588 __pyx_r = __pyx_t_6;
13589 __pyx_t_6 = 0;
13590 goto __pyx_L0;
13591
13592 /* "View.MemoryView":567
13593 *
13594 * @property
13595 * def strides(self): # <<<<<<<<<<<<<<
13596 * if self.view.strides == NULL:
13597 *
13598 */
13599
13600 /* function exit code */
13601 __pyx_L1_error:;
13602 __Pyx_XDECREF(__pyx_t_2);
13603 __Pyx_XDECREF(__pyx_t_6);
13604 __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13605 __pyx_r = NULL;
13606 __pyx_L0:;
13607 __Pyx_XGIVEREF(__pyx_r);
13608 __Pyx_RefNannyFinishContext();
13609 return __pyx_r;
13610}
13611
13612/* "View.MemoryView":575
13613 *
13614 * @property
13615 * def suboffsets(self): # <<<<<<<<<<<<<<
13616 * if self.view.suboffsets == NULL:
13617 * return (-1,) * self.view.ndim
13618 */
13619
13620/* Python wrapper */
13621static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
13622static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
13623 PyObject *__pyx_r = 0;
13624 __Pyx_RefNannyDeclarations
13625 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13626 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13627
13628 /* function exit code */
13629 __Pyx_RefNannyFinishContext();
13630 return __pyx_r;
13631}
13632
13633static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13634 Py_ssize_t __pyx_v_suboffset;
13635 PyObject *__pyx_r = NULL;
13636 __Pyx_RefNannyDeclarations
13637 int __pyx_t_1;
13638 PyObject *__pyx_t_2 = NULL;
13639 PyObject *__pyx_t_3 = NULL;
13640 Py_ssize_t *__pyx_t_4;
13641 Py_ssize_t *__pyx_t_5;
13642 Py_ssize_t *__pyx_t_6;
13643 int __pyx_lineno = 0;
13644 const char *__pyx_filename = NULL;
13645 int __pyx_clineno = 0;
13646 __Pyx_RefNannySetupContext("__get__", 0);
13647
13648 /* "View.MemoryView":576
13649 * @property
13650 * def suboffsets(self):
13651 * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
13652 * return (-1,) * self.view.ndim
13653 *
13654 */
13655 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
13656 if (__pyx_t_1) {
13657
13658 /* "View.MemoryView":577
13659 * def suboffsets(self):
13660 * if self.view.suboffsets == NULL:
13661 * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
13662 *
13663 * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
13664 */
13665 __Pyx_XDECREF(__pyx_r);
13666 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
13667 __Pyx_GOTREF(__pyx_t_2);
13668 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
13669 __Pyx_GOTREF(__pyx_t_3);
13670 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13671 __pyx_r = __pyx_t_3;
13672 __pyx_t_3 = 0;
13673 goto __pyx_L0;
13674
13675 /* "View.MemoryView":576
13676 * @property
13677 * def suboffsets(self):
13678 * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
13679 * return (-1,) * self.view.ndim
13680 *
13681 */
13682 }
13683
13684 /* "View.MemoryView":579
13685 * return (-1,) * self.view.ndim
13686 *
13687 * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
13688 *
13689 * @property
13690 */
13691 __Pyx_XDECREF(__pyx_r);
13692 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
13693 __Pyx_GOTREF(__pyx_t_3);
13694 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
13695 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
13696 __pyx_t_4 = __pyx_t_6;
13697 __pyx_v_suboffset = (__pyx_t_4[0]);
13698 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
13699 __Pyx_GOTREF(__pyx_t_2);
13700 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
13701 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13702 }
13703 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
13704 __Pyx_GOTREF(__pyx_t_2);
13705 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13706 __pyx_r = __pyx_t_2;
13707 __pyx_t_2 = 0;
13708 goto __pyx_L0;
13709
13710 /* "View.MemoryView":575
13711 *
13712 * @property
13713 * def suboffsets(self): # <<<<<<<<<<<<<<
13714 * if self.view.suboffsets == NULL:
13715 * return (-1,) * self.view.ndim
13716 */
13717
13718 /* function exit code */
13719 __pyx_L1_error:;
13720 __Pyx_XDECREF(__pyx_t_2);
13721 __Pyx_XDECREF(__pyx_t_3);
13722 __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13723 __pyx_r = NULL;
13724 __pyx_L0:;
13725 __Pyx_XGIVEREF(__pyx_r);
13726 __Pyx_RefNannyFinishContext();
13727 return __pyx_r;
13728}
13729
13730/* "View.MemoryView":582
13731 *
13732 * @property
13733 * def ndim(self): # <<<<<<<<<<<<<<
13734 * return self.view.ndim
13735 *
13736 */
13737
13738/* Python wrapper */
13739static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
13740static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
13741 PyObject *__pyx_r = 0;
13742 __Pyx_RefNannyDeclarations
13743 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13744 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13745
13746 /* function exit code */
13747 __Pyx_RefNannyFinishContext();
13748 return __pyx_r;
13749}
13750
13751static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13752 PyObject *__pyx_r = NULL;
13753 __Pyx_RefNannyDeclarations
13754 PyObject *__pyx_t_1 = NULL;
13755 int __pyx_lineno = 0;
13756 const char *__pyx_filename = NULL;
13757 int __pyx_clineno = 0;
13758 __Pyx_RefNannySetupContext("__get__", 0);
13759
13760 /* "View.MemoryView":583
13761 * @property
13762 * def ndim(self):
13763 * return self.view.ndim # <<<<<<<<<<<<<<
13764 *
13765 * @property
13766 */
13767 __Pyx_XDECREF(__pyx_r);
13768 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
13769 __Pyx_GOTREF(__pyx_t_1);
13770 __pyx_r = __pyx_t_1;
13771 __pyx_t_1 = 0;
13772 goto __pyx_L0;
13773
13774 /* "View.MemoryView":582
13775 *
13776 * @property
13777 * def ndim(self): # <<<<<<<<<<<<<<
13778 * return self.view.ndim
13779 *
13780 */
13781
13782 /* function exit code */
13783 __pyx_L1_error:;
13784 __Pyx_XDECREF(__pyx_t_1);
13785 __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13786 __pyx_r = NULL;
13787 __pyx_L0:;
13788 __Pyx_XGIVEREF(__pyx_r);
13789 __Pyx_RefNannyFinishContext();
13790 return __pyx_r;
13791}
13792
13793/* "View.MemoryView":586
13794 *
13795 * @property
13796 * def itemsize(self): # <<<<<<<<<<<<<<
13797 * return self.view.itemsize
13798 *
13799 */
13800
13801/* Python wrapper */
13802static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
13803static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
13804 PyObject *__pyx_r = 0;
13805 __Pyx_RefNannyDeclarations
13806 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13807 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13808
13809 /* function exit code */
13810 __Pyx_RefNannyFinishContext();
13811 return __pyx_r;
13812}
13813
13814static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13815 PyObject *__pyx_r = NULL;
13816 __Pyx_RefNannyDeclarations
13817 PyObject *__pyx_t_1 = NULL;
13818 int __pyx_lineno = 0;
13819 const char *__pyx_filename = NULL;
13820 int __pyx_clineno = 0;
13821 __Pyx_RefNannySetupContext("__get__", 0);
13822
13823 /* "View.MemoryView":587
13824 * @property
13825 * def itemsize(self):
13826 * return self.view.itemsize # <<<<<<<<<<<<<<
13827 *
13828 * @property
13829 */
13830 __Pyx_XDECREF(__pyx_r);
13831 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
13832 __Pyx_GOTREF(__pyx_t_1);
13833 __pyx_r = __pyx_t_1;
13834 __pyx_t_1 = 0;
13835 goto __pyx_L0;
13836
13837 /* "View.MemoryView":586
13838 *
13839 * @property
13840 * def itemsize(self): # <<<<<<<<<<<<<<
13841 * return self.view.itemsize
13842 *
13843 */
13844
13845 /* function exit code */
13846 __pyx_L1_error:;
13847 __Pyx_XDECREF(__pyx_t_1);
13848 __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13849 __pyx_r = NULL;
13850 __pyx_L0:;
13851 __Pyx_XGIVEREF(__pyx_r);
13852 __Pyx_RefNannyFinishContext();
13853 return __pyx_r;
13854}
13855
13856/* "View.MemoryView":590
13857 *
13858 * @property
13859 * def nbytes(self): # <<<<<<<<<<<<<<
13860 * return self.size * self.view.itemsize
13861 *
13862 */
13863
13864/* Python wrapper */
13865static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
13866static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
13867 PyObject *__pyx_r = 0;
13868 __Pyx_RefNannyDeclarations
13869 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13870 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13871
13872 /* function exit code */
13873 __Pyx_RefNannyFinishContext();
13874 return __pyx_r;
13875}
13876
13877static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13878 PyObject *__pyx_r = NULL;
13879 __Pyx_RefNannyDeclarations
13880 PyObject *__pyx_t_1 = NULL;
13881 PyObject *__pyx_t_2 = NULL;
13882 PyObject *__pyx_t_3 = NULL;
13883 int __pyx_lineno = 0;
13884 const char *__pyx_filename = NULL;
13885 int __pyx_clineno = 0;
13886 __Pyx_RefNannySetupContext("__get__", 0);
13887
13888 /* "View.MemoryView":591
13889 * @property
13890 * def nbytes(self):
13891 * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
13892 *
13893 * @property
13894 */
13895 __Pyx_XDECREF(__pyx_r);
13896 __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)
13897 __Pyx_GOTREF(__pyx_t_1);
13898 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
13899 __Pyx_GOTREF(__pyx_t_2);
13900 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
13901 __Pyx_GOTREF(__pyx_t_3);
13902 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13903 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13904 __pyx_r = __pyx_t_3;
13905 __pyx_t_3 = 0;
13906 goto __pyx_L0;
13907
13908 /* "View.MemoryView":590
13909 *
13910 * @property
13911 * def nbytes(self): # <<<<<<<<<<<<<<
13912 * return self.size * self.view.itemsize
13913 *
13914 */
13915
13916 /* function exit code */
13917 __pyx_L1_error:;
13918 __Pyx_XDECREF(__pyx_t_1);
13919 __Pyx_XDECREF(__pyx_t_2);
13920 __Pyx_XDECREF(__pyx_t_3);
13921 __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13922 __pyx_r = NULL;
13923 __pyx_L0:;
13924 __Pyx_XGIVEREF(__pyx_r);
13925 __Pyx_RefNannyFinishContext();
13926 return __pyx_r;
13927}
13928
13929/* "View.MemoryView":594
13930 *
13931 * @property
13932 * def size(self): # <<<<<<<<<<<<<<
13933 * if self._size is None:
13934 * result = 1
13935 */
13936
13937/* Python wrapper */
13938static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
13939static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
13940 PyObject *__pyx_r = 0;
13941 __Pyx_RefNannyDeclarations
13942 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13943 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13944
13945 /* function exit code */
13946 __Pyx_RefNannyFinishContext();
13947 return __pyx_r;
13948}
13949
13950static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13951 PyObject *__pyx_v_result = NULL;
13952 PyObject *__pyx_v_length = NULL;
13953 PyObject *__pyx_r = NULL;
13954 __Pyx_RefNannyDeclarations
13955 int __pyx_t_1;
13956 int __pyx_t_2;
13957 Py_ssize_t *__pyx_t_3;
13958 Py_ssize_t *__pyx_t_4;
13959 Py_ssize_t *__pyx_t_5;
13960 PyObject *__pyx_t_6 = NULL;
13961 int __pyx_lineno = 0;
13962 const char *__pyx_filename = NULL;
13963 int __pyx_clineno = 0;
13964 __Pyx_RefNannySetupContext("__get__", 0);
13965
13966 /* "View.MemoryView":595
13967 * @property
13968 * def size(self):
13969 * if self._size is None: # <<<<<<<<<<<<<<
13970 * result = 1
13971 *
13972 */
13973 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
13974 __pyx_t_2 = (__pyx_t_1 != 0);
13975 if (__pyx_t_2) {
13976
13977 /* "View.MemoryView":596
13978 * def size(self):
13979 * if self._size is None:
13980 * result = 1 # <<<<<<<<<<<<<<
13981 *
13982 * for length in self.view.shape[:self.view.ndim]:
13983 */
13984 __Pyx_INCREF(__pyx_int_1);
13985 __pyx_v_result = __pyx_int_1;
13986
13987 /* "View.MemoryView":598
13988 * result = 1
13989 *
13990 * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
13991 * result *= length
13992 *
13993 */
13994 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
13995 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
13996 __pyx_t_3 = __pyx_t_5;
13997 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
13998 __Pyx_GOTREF(__pyx_t_6);
13999 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
14000 __pyx_t_6 = 0;
14001
14002 /* "View.MemoryView":599
14003 *
14004 * for length in self.view.shape[:self.view.ndim]:
14005 * result *= length # <<<<<<<<<<<<<<
14006 *
14007 * self._size = result
14008 */
14009 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
14010 __Pyx_GOTREF(__pyx_t_6);
14011 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
14012 __pyx_t_6 = 0;
14013 }
14014
14015 /* "View.MemoryView":601
14016 * result *= length
14017 *
14018 * self._size = result # <<<<<<<<<<<<<<
14019 *
14020 * return self._size
14021 */
14022 __Pyx_INCREF(__pyx_v_result);
14023 __Pyx_GIVEREF(__pyx_v_result);
14024 __Pyx_GOTREF(__pyx_v_self->_size);
14025 __Pyx_DECREF(__pyx_v_self->_size);
14026 __pyx_v_self->_size = __pyx_v_result;
14027
14028 /* "View.MemoryView":595
14029 * @property
14030 * def size(self):
14031 * if self._size is None: # <<<<<<<<<<<<<<
14032 * result = 1
14033 *
14034 */
14035 }
14036
14037 /* "View.MemoryView":603
14038 * self._size = result
14039 *
14040 * return self._size # <<<<<<<<<<<<<<
14041 *
14042 * def __len__(self):
14043 */
14044 __Pyx_XDECREF(__pyx_r);
14045 __Pyx_INCREF(__pyx_v_self->_size);
14046 __pyx_r = __pyx_v_self->_size;
14047 goto __pyx_L0;
14048
14049 /* "View.MemoryView":594
14050 *
14051 * @property
14052 * def size(self): # <<<<<<<<<<<<<<
14053 * if self._size is None:
14054 * result = 1
14055 */
14056
14057 /* function exit code */
14058 __pyx_L1_error:;
14059 __Pyx_XDECREF(__pyx_t_6);
14060 __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14061 __pyx_r = NULL;
14062 __pyx_L0:;
14063 __Pyx_XDECREF(__pyx_v_result);
14064 __Pyx_XDECREF(__pyx_v_length);
14065 __Pyx_XGIVEREF(__pyx_r);
14066 __Pyx_RefNannyFinishContext();
14067 return __pyx_r;
14068}
14069
14070/* "View.MemoryView":605
14071 * return self._size
14072 *
14073 * def __len__(self): # <<<<<<<<<<<<<<
14074 * if self.view.ndim >= 1:
14075 * return self.view.shape[0]
14076 */
14077
14078/* Python wrapper */
14079static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
14080static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
14081 Py_ssize_t __pyx_r;
14082 __Pyx_RefNannyDeclarations
14083 __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
14084 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14085
14086 /* function exit code */
14087 __Pyx_RefNannyFinishContext();
14088 return __pyx_r;
14089}
14090
14091static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
14092 Py_ssize_t __pyx_r;
14093 __Pyx_RefNannyDeclarations
14094 int __pyx_t_1;
14095 __Pyx_RefNannySetupContext("__len__", 0);
14096
14097 /* "View.MemoryView":606
14098 *
14099 * def __len__(self):
14100 * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
14101 * return self.view.shape[0]
14102 *
14103 */
14104 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
14105 if (__pyx_t_1) {
14106
14107 /* "View.MemoryView":607
14108 * def __len__(self):
14109 * if self.view.ndim >= 1:
14110 * return self.view.shape[0] # <<<<<<<<<<<<<<
14111 *
14112 * return 0
14113 */
14114 __pyx_r = (__pyx_v_self->view.shape[0]);
14115 goto __pyx_L0;
14116
14117 /* "View.MemoryView":606
14118 *
14119 * def __len__(self):
14120 * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
14121 * return self.view.shape[0]
14122 *
14123 */
14124 }
14125
14126 /* "View.MemoryView":609
14127 * return self.view.shape[0]
14128 *
14129 * return 0 # <<<<<<<<<<<<<<
14130 *
14131 * def __repr__(self):
14132 */
14133 __pyx_r = 0;
14134 goto __pyx_L0;
14135
14136 /* "View.MemoryView":605
14137 * return self._size
14138 *
14139 * def __len__(self): # <<<<<<<<<<<<<<
14140 * if self.view.ndim >= 1:
14141 * return self.view.shape[0]
14142 */
14143
14144 /* function exit code */
14145 __pyx_L0:;
14146 __Pyx_RefNannyFinishContext();
14147 return __pyx_r;
14148}
14149
14150/* "View.MemoryView":611
14151 * return 0
14152 *
14153 * def __repr__(self): # <<<<<<<<<<<<<<
14154 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
14155 * id(self))
14156 */
14157
14158/* Python wrapper */
14159static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
14160static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
14161 PyObject *__pyx_r = 0;
14162 __Pyx_RefNannyDeclarations
14163 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
14164 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14165
14166 /* function exit code */
14167 __Pyx_RefNannyFinishContext();
14168 return __pyx_r;
14169}
14170
14171static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
14172 PyObject *__pyx_r = NULL;
14173 __Pyx_RefNannyDeclarations
14174 PyObject *__pyx_t_1 = NULL;
14175 PyObject *__pyx_t_2 = NULL;
14176 PyObject *__pyx_t_3 = NULL;
14177 int __pyx_lineno = 0;
14178 const char *__pyx_filename = NULL;
14179 int __pyx_clineno = 0;
14180 __Pyx_RefNannySetupContext("__repr__", 0);
14181
14182 /* "View.MemoryView":612
14183 *
14184 * def __repr__(self):
14185 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
14186 * id(self))
14187 *
14188 */
14189 __Pyx_XDECREF(__pyx_r);
14190 __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)
14191 __Pyx_GOTREF(__pyx_t_1);
14192 __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)
14193 __Pyx_GOTREF(__pyx_t_2);
14194 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14195 __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)
14196 __Pyx_GOTREF(__pyx_t_1);
14197 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14198
14199 /* "View.MemoryView":613
14200 * def __repr__(self):
14201 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
14202 * id(self)) # <<<<<<<<<<<<<<
14203 *
14204 * def __str__(self):
14205 */
14206 __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)
14207 __Pyx_GOTREF(__pyx_t_2);
14208
14209 /* "View.MemoryView":612
14210 *
14211 * def __repr__(self):
14212 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
14213 * id(self))
14214 *
14215 */
14216 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
14217 __Pyx_GOTREF(__pyx_t_3);
14218 __Pyx_GIVEREF(__pyx_t_1);
14219 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
14220 __Pyx_GIVEREF(__pyx_t_2);
14221 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
14222 __pyx_t_1 = 0;
14223 __pyx_t_2 = 0;
14224 __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)
14225 __Pyx_GOTREF(__pyx_t_2);
14226 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14227 __pyx_r = __pyx_t_2;
14228 __pyx_t_2 = 0;
14229 goto __pyx_L0;
14230
14231 /* "View.MemoryView":611
14232 * return 0
14233 *
14234 * def __repr__(self): # <<<<<<<<<<<<<<
14235 * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
14236 * id(self))
14237 */
14238
14239 /* function exit code */
14240 __pyx_L1_error:;
14241 __Pyx_XDECREF(__pyx_t_1);
14242 __Pyx_XDECREF(__pyx_t_2);
14243 __Pyx_XDECREF(__pyx_t_3);
14244 __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14245 __pyx_r = NULL;
14246 __pyx_L0:;
14247 __Pyx_XGIVEREF(__pyx_r);
14248 __Pyx_RefNannyFinishContext();
14249 return __pyx_r;
14250}
14251
14252/* "View.MemoryView":615
14253 * id(self))
14254 *
14255 * def __str__(self): # <<<<<<<<<<<<<<
14256 * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
14257 *
14258 */
14259
14260/* Python wrapper */
14261static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
14262static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
14263 PyObject *__pyx_r = 0;
14264 __Pyx_RefNannyDeclarations
14265 __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
14266 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14267
14268 /* function exit code */
14269 __Pyx_RefNannyFinishContext();
14270 return __pyx_r;
14271}
14272
14273static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
14274 PyObject *__pyx_r = NULL;
14275 __Pyx_RefNannyDeclarations
14276 PyObject *__pyx_t_1 = NULL;
14277 PyObject *__pyx_t_2 = NULL;
14278 int __pyx_lineno = 0;
14279 const char *__pyx_filename = NULL;
14280 int __pyx_clineno = 0;
14281 __Pyx_RefNannySetupContext("__str__", 0);
14282
14283 /* "View.MemoryView":616
14284 *
14285 * def __str__(self):
14286 * return "<MemoryView of %r object>" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
14287 *
14288 *
14289 */
14290 __Pyx_XDECREF(__pyx_r);
14291 __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)
14292 __Pyx_GOTREF(__pyx_t_1);
14293 __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)
14294 __Pyx_GOTREF(__pyx_t_2);
14295 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14296 __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)
14297 __Pyx_GOTREF(__pyx_t_1);
14298 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14299 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
14300 __Pyx_GOTREF(__pyx_t_2);
14301 __Pyx_GIVEREF(__pyx_t_1);
14302 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
14303 __pyx_t_1 = 0;
14304 __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)
14305 __Pyx_GOTREF(__pyx_t_1);
14306 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14307 __pyx_r = __pyx_t_1;
14308 __pyx_t_1 = 0;
14309 goto __pyx_L0;
14310
14311 /* "View.MemoryView":615
14312 * id(self))
14313 *
14314 * def __str__(self): # <<<<<<<<<<<<<<
14315 * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
14316 *
14317 */
14318
14319 /* function exit code */
14320 __pyx_L1_error:;
14321 __Pyx_XDECREF(__pyx_t_1);
14322 __Pyx_XDECREF(__pyx_t_2);
14323 __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14324 __pyx_r = NULL;
14325 __pyx_L0:;
14326 __Pyx_XGIVEREF(__pyx_r);
14327 __Pyx_RefNannyFinishContext();
14328 return __pyx_r;
14329}
14330
14331/* "View.MemoryView":619
14332 *
14333 *
14334 * def is_c_contig(self): # <<<<<<<<<<<<<<
14335 * cdef __Pyx_memviewslice *mslice
14336 * cdef __Pyx_memviewslice tmp
14337 */
14338
14339/* Python wrapper */
14340static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
14341static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14342 PyObject *__pyx_r = 0;
14343 __Pyx_RefNannyDeclarations
14344 __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
14345 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
14346
14347 /* function exit code */
14348 __Pyx_RefNannyFinishContext();
14349 return __pyx_r;
14350}
14351
14352static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
14353 __Pyx_memviewslice *__pyx_v_mslice;
14354 __Pyx_memviewslice __pyx_v_tmp;
14355 PyObject *__pyx_r = NULL;
14356 __Pyx_RefNannyDeclarations
14357 __Pyx_memviewslice *__pyx_t_1;
14358 PyObject *__pyx_t_2 = NULL;
14359 int __pyx_lineno = 0;
14360 const char *__pyx_filename = NULL;
14361 int __pyx_clineno = 0;
14362 __Pyx_RefNannySetupContext("is_c_contig", 0);
14363
14364 /* "View.MemoryView":622
14365 * cdef __Pyx_memviewslice *mslice
14366 * cdef __Pyx_memviewslice tmp
14367 * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
14368 * return slice_is_contig(mslice[0], 'C', self.view.ndim)
14369 *
14370 */
14371 __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)
14372 __pyx_v_mslice = __pyx_t_1;
14373
14374 /* "View.MemoryView":623
14375 * cdef __Pyx_memviewslice tmp
14376 * mslice = get_slice_from_memview(self, &tmp)
14377 * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
14378 *
14379 * def is_f_contig(self):
14380 */
14381 __Pyx_XDECREF(__pyx_r);
14382 __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)
14383 __Pyx_GOTREF(__pyx_t_2);
14384 __pyx_r = __pyx_t_2;
14385 __pyx_t_2 = 0;
14386 goto __pyx_L0;
14387
14388 /* "View.MemoryView":619
14389 *
14390 *
14391 * def is_c_contig(self): # <<<<<<<<<<<<<<
14392 * cdef __Pyx_memviewslice *mslice
14393 * cdef __Pyx_memviewslice tmp
14394 */
14395
14396 /* function exit code */
14397 __pyx_L1_error:;
14398 __Pyx_XDECREF(__pyx_t_2);
14399 __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
14400 __pyx_r = NULL;
14401 __pyx_L0:;
14402 __Pyx_XGIVEREF(__pyx_r);
14403 __Pyx_RefNannyFinishContext();
14404 return __pyx_r;
14405}
14406
14407/* "View.MemoryView":625
14408 * return slice_is_contig(mslice[0], 'C', self.view.ndim)
14409 *
14410 * def is_f_contig(self): # <<<<<<<<<<<<<<
14411 * cdef __Pyx_memviewslice *mslice
14412 * cdef __Pyx_memviewslice tmp
14413 */
14414
14415/* Python wrapper */
14416static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
14417static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14418 PyObject *__pyx_r = 0;
14419 __Pyx_RefNannyDeclarations
14420 __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
14421 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
14422
14423 /* function exit code */
14424 __Pyx_RefNannyFinishContext();
14425 return __pyx_r;
14426}
14427
14428static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
14429 __Pyx_memviewslice *__pyx_v_mslice;
14430 __Pyx_memviewslice __pyx_v_tmp;
14431 PyObject *__pyx_r = NULL;
14432 __Pyx_RefNannyDeclarations
14433 __Pyx_memviewslice *__pyx_t_1;
14434 PyObject *__pyx_t_2 = NULL;
14435 int __pyx_lineno = 0;
14436 const char *__pyx_filename = NULL;
14437 int __pyx_clineno = 0;
14438 __Pyx_RefNannySetupContext("is_f_contig", 0);
14439
14440 /* "View.MemoryView":628
14441 * cdef __Pyx_memviewslice *mslice
14442 * cdef __Pyx_memviewslice tmp
14443 * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
14444 * return slice_is_contig(mslice[0], 'F', self.view.ndim)
14445 *
14446 */
14447 __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)
14448 __pyx_v_mslice = __pyx_t_1;
14449
14450 /* "View.MemoryView":629
14451 * cdef __Pyx_memviewslice tmp
14452 * mslice = get_slice_from_memview(self, &tmp)
14453 * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
14454 *
14455 * def copy(self):
14456 */
14457 __Pyx_XDECREF(__pyx_r);
14458 __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)
14459 __Pyx_GOTREF(__pyx_t_2);
14460 __pyx_r = __pyx_t_2;
14461 __pyx_t_2 = 0;
14462 goto __pyx_L0;
14463
14464 /* "View.MemoryView":625
14465 * return slice_is_contig(mslice[0], 'C', self.view.ndim)
14466 *
14467 * def is_f_contig(self): # <<<<<<<<<<<<<<
14468 * cdef __Pyx_memviewslice *mslice
14469 * cdef __Pyx_memviewslice tmp
14470 */
14471
14472 /* function exit code */
14473 __pyx_L1_error:;
14474 __Pyx_XDECREF(__pyx_t_2);
14475 __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
14476 __pyx_r = NULL;
14477 __pyx_L0:;
14478 __Pyx_XGIVEREF(__pyx_r);
14479 __Pyx_RefNannyFinishContext();
14480 return __pyx_r;
14481}
14482
14483/* "View.MemoryView":631
14484 * return slice_is_contig(mslice[0], 'F', self.view.ndim)
14485 *
14486 * def copy(self): # <<<<<<<<<<<<<<
14487 * cdef __Pyx_memviewslice mslice
14488 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
14489 */
14490
14491/* Python wrapper */
14492static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
14493static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14494 PyObject *__pyx_r = 0;
14495 __Pyx_RefNannyDeclarations
14496 __Pyx_RefNannySetupContext("copy (wrapper)", 0);
14497 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
14498
14499 /* function exit code */
14500 __Pyx_RefNannyFinishContext();
14501 return __pyx_r;
14502}
14503
14504static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
14505 __Pyx_memviewslice __pyx_v_mslice;
14506 int __pyx_v_flags;
14507 PyObject *__pyx_r = NULL;
14508 __Pyx_RefNannyDeclarations
14509 __Pyx_memviewslice __pyx_t_1;
14510 PyObject *__pyx_t_2 = NULL;
14511 int __pyx_lineno = 0;
14512 const char *__pyx_filename = NULL;
14513 int __pyx_clineno = 0;
14514 __Pyx_RefNannySetupContext("copy", 0);
14515
14516 /* "View.MemoryView":633
14517 * def copy(self):
14518 * cdef __Pyx_memviewslice mslice
14519 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
14520 *
14521 * slice_copy(self, &mslice)
14522 */
14523 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
14524
14525 /* "View.MemoryView":635
14526 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
14527 *
14528 * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
14529 * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
14530 * self.view.itemsize,
14531 */
14532 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
14533
14534 /* "View.MemoryView":636
14535 *
14536 * slice_copy(self, &mslice)
14537 * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
14538 * self.view.itemsize,
14539 * flags|PyBUF_C_CONTIGUOUS,
14540 */
14541 __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)
14542 __pyx_v_mslice = __pyx_t_1;
14543
14544 /* "View.MemoryView":641
14545 * self.dtype_is_object)
14546 *
14547 * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
14548 *
14549 * def copy_fortran(self):
14550 */
14551 __Pyx_XDECREF(__pyx_r);
14552 __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)
14553 __Pyx_GOTREF(__pyx_t_2);
14554 __pyx_r = __pyx_t_2;
14555 __pyx_t_2 = 0;
14556 goto __pyx_L0;
14557
14558 /* "View.MemoryView":631
14559 * return slice_is_contig(mslice[0], 'F', self.view.ndim)
14560 *
14561 * def copy(self): # <<<<<<<<<<<<<<
14562 * cdef __Pyx_memviewslice mslice
14563 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
14564 */
14565
14566 /* function exit code */
14567 __pyx_L1_error:;
14568 __Pyx_XDECREF(__pyx_t_2);
14569 __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
14570 __pyx_r = NULL;
14571 __pyx_L0:;
14572 __Pyx_XGIVEREF(__pyx_r);
14573 __Pyx_RefNannyFinishContext();
14574 return __pyx_r;
14575}
14576
14577/* "View.MemoryView":643
14578 * return memoryview_copy_from_slice(self, &mslice)
14579 *
14580 * def copy_fortran(self): # <<<<<<<<<<<<<<
14581 * cdef __Pyx_memviewslice src, dst
14582 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
14583 */
14584
14585/* Python wrapper */
14586static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
14587static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14588 PyObject *__pyx_r = 0;
14589 __Pyx_RefNannyDeclarations
14590 __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
14591 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
14592
14593 /* function exit code */
14594 __Pyx_RefNannyFinishContext();
14595 return __pyx_r;
14596}
14597
14598static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
14599 __Pyx_memviewslice __pyx_v_src;
14600 __Pyx_memviewslice __pyx_v_dst;
14601 int __pyx_v_flags;
14602 PyObject *__pyx_r = NULL;
14603 __Pyx_RefNannyDeclarations
14604 __Pyx_memviewslice __pyx_t_1;
14605 PyObject *__pyx_t_2 = NULL;
14606 int __pyx_lineno = 0;
14607 const char *__pyx_filename = NULL;
14608 int __pyx_clineno = 0;
14609 __Pyx_RefNannySetupContext("copy_fortran", 0);
14610
14611 /* "View.MemoryView":645
14612 * def copy_fortran(self):
14613 * cdef __Pyx_memviewslice src, dst
14614 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
14615 *
14616 * slice_copy(self, &src)
14617 */
14618 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
14619
14620 /* "View.MemoryView":647
14621 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
14622 *
14623 * slice_copy(self, &src) # <<<<<<<<<<<<<<
14624 * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
14625 * self.view.itemsize,
14626 */
14627 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
14628
14629 /* "View.MemoryView":648
14630 *
14631 * slice_copy(self, &src)
14632 * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
14633 * self.view.itemsize,
14634 * flags|PyBUF_F_CONTIGUOUS,
14635 */
14636 __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)
14637 __pyx_v_dst = __pyx_t_1;
14638
14639 /* "View.MemoryView":653
14640 * self.dtype_is_object)
14641 *
14642 * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
14643 *
14644 *
14645 */
14646 __Pyx_XDECREF(__pyx_r);
14647 __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)
14648 __Pyx_GOTREF(__pyx_t_2);
14649 __pyx_r = __pyx_t_2;
14650 __pyx_t_2 = 0;
14651 goto __pyx_L0;
14652
14653 /* "View.MemoryView":643
14654 * return memoryview_copy_from_slice(self, &mslice)
14655 *
14656 * def copy_fortran(self): # <<<<<<<<<<<<<<
14657 * cdef __Pyx_memviewslice src, dst
14658 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
14659 */
14660
14661 /* function exit code */
14662 __pyx_L1_error:;
14663 __Pyx_XDECREF(__pyx_t_2);
14664 __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
14665 __pyx_r = NULL;
14666 __pyx_L0:;
14667 __Pyx_XGIVEREF(__pyx_r);
14668 __Pyx_RefNannyFinishContext();
14669 return __pyx_r;
14670}
14671
14672/* "(tree fragment)":1
14673 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
14674 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14675 * def __setstate_cython__(self, __pyx_state):
14676 */
14677
14678/* Python wrapper */
14679static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
14680static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14681 PyObject *__pyx_r = 0;
14682 __Pyx_RefNannyDeclarations
14683 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
14684 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14685
14686 /* function exit code */
14687 __Pyx_RefNannyFinishContext();
14688 return __pyx_r;
14689}
14690
14691static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
14692 PyObject *__pyx_r = NULL;
14693 __Pyx_RefNannyDeclarations
14694 PyObject *__pyx_t_1 = NULL;
14695 int __pyx_lineno = 0;
14696 const char *__pyx_filename = NULL;
14697 int __pyx_clineno = 0;
14698 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
14699
14700 /* "(tree fragment)":2
14701 * def __reduce_cython__(self):
14702 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
14703 * def __setstate_cython__(self, __pyx_state):
14704 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14705 */
14706 __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)
14707 __Pyx_GOTREF(__pyx_t_1);
14708 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14709 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14710 __PYX_ERR(2, 2, __pyx_L1_error)
14711
14712 /* "(tree fragment)":1
14713 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
14714 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14715 * def __setstate_cython__(self, __pyx_state):
14716 */
14717
14718 /* function exit code */
14719 __pyx_L1_error:;
14720 __Pyx_XDECREF(__pyx_t_1);
14721 __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14722 __pyx_r = NULL;
14723 __Pyx_XGIVEREF(__pyx_r);
14724 __Pyx_RefNannyFinishContext();
14725 return __pyx_r;
14726}
14727
14728/* "(tree fragment)":3
14729 * def __reduce_cython__(self):
14730 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14731 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
14732 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14733 */
14734
14735/* Python wrapper */
14736static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
14737static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14738 PyObject *__pyx_r = 0;
14739 __Pyx_RefNannyDeclarations
14740 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
14741 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14742
14743 /* function exit code */
14744 __Pyx_RefNannyFinishContext();
14745 return __pyx_r;
14746}
14747
14748static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
14749 PyObject *__pyx_r = NULL;
14750 __Pyx_RefNannyDeclarations
14751 PyObject *__pyx_t_1 = NULL;
14752 int __pyx_lineno = 0;
14753 const char *__pyx_filename = NULL;
14754 int __pyx_clineno = 0;
14755 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
14756
14757 /* "(tree fragment)":4
14758 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14759 * def __setstate_cython__(self, __pyx_state):
14760 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
14761 */
14762 __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)
14763 __Pyx_GOTREF(__pyx_t_1);
14764 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14765 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14766 __PYX_ERR(2, 4, __pyx_L1_error)
14767
14768 /* "(tree fragment)":3
14769 * def __reduce_cython__(self):
14770 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14771 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
14772 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
14773 */
14774
14775 /* function exit code */
14776 __pyx_L1_error:;
14777 __Pyx_XDECREF(__pyx_t_1);
14778 __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14779 __pyx_r = NULL;
14780 __Pyx_XGIVEREF(__pyx_r);
14781 __Pyx_RefNannyFinishContext();
14782 return __pyx_r;
14783}
14784
14785/* "View.MemoryView":657
14786 *
14787 * @cname('__pyx_memoryview_new')
14788 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
14789 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
14790 * result.typeinfo = typeinfo
14791 */
14792
14793static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
14794 struct __pyx_memoryview_obj *__pyx_v_result = 0;
14795 PyObject *__pyx_r = NULL;
14796 __Pyx_RefNannyDeclarations
14797 PyObject *__pyx_t_1 = NULL;
14798 PyObject *__pyx_t_2 = NULL;
14799 PyObject *__pyx_t_3 = NULL;
14800 int __pyx_lineno = 0;
14801 const char *__pyx_filename = NULL;
14802 int __pyx_clineno = 0;
14803 __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
14804
14805 /* "View.MemoryView":658
14806 * @cname('__pyx_memoryview_new')
14807 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
14808 * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
14809 * result.typeinfo = typeinfo
14810 * return result
14811 */
14812 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
14813 __Pyx_GOTREF(__pyx_t_1);
14814 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
14815 __Pyx_GOTREF(__pyx_t_2);
14816 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
14817 __Pyx_GOTREF(__pyx_t_3);
14818 __Pyx_INCREF(__pyx_v_o);
14819 __Pyx_GIVEREF(__pyx_v_o);
14820 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
14821 __Pyx_GIVEREF(__pyx_t_1);
14822 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
14823 __Pyx_GIVEREF(__pyx_t_2);
14824 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
14825 __pyx_t_1 = 0;
14826 __pyx_t_2 = 0;
14827 __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)
14828 __Pyx_GOTREF(__pyx_t_2);
14829 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14830 __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
14831 __pyx_t_2 = 0;
14832
14833 /* "View.MemoryView":659
14834 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
14835 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
14836 * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
14837 * return result
14838 *
14839 */
14840 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
14841
14842 /* "View.MemoryView":660
14843 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
14844 * result.typeinfo = typeinfo
14845 * return result # <<<<<<<<<<<<<<
14846 *
14847 * @cname('__pyx_memoryview_check')
14848 */
14849 __Pyx_XDECREF(__pyx_r);
14850 __Pyx_INCREF(((PyObject *)__pyx_v_result));
14851 __pyx_r = ((PyObject *)__pyx_v_result);
14852 goto __pyx_L0;
14853
14854 /* "View.MemoryView":657
14855 *
14856 * @cname('__pyx_memoryview_new')
14857 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
14858 * cdef memoryview result = memoryview(o, flags, dtype_is_object)
14859 * result.typeinfo = typeinfo
14860 */
14861
14862 /* function exit code */
14863 __pyx_L1_error:;
14864 __Pyx_XDECREF(__pyx_t_1);
14865 __Pyx_XDECREF(__pyx_t_2);
14866 __Pyx_XDECREF(__pyx_t_3);
14867 __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
14868 __pyx_r = 0;
14869 __pyx_L0:;
14870 __Pyx_XDECREF((PyObject *)__pyx_v_result);
14871 __Pyx_XGIVEREF(__pyx_r);
14872 __Pyx_RefNannyFinishContext();
14873 return __pyx_r;
14874}
14875
14876/* "View.MemoryView":663
14877 *
14878 * @cname('__pyx_memoryview_check')
14879 * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
14880 * return isinstance(o, memoryview)
14881 *
14882 */
14883
14884static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
14885 int __pyx_r;
14886 __Pyx_RefNannyDeclarations
14887 int __pyx_t_1;
14888 __Pyx_RefNannySetupContext("memoryview_check", 0);
14889
14890 /* "View.MemoryView":664
14891 * @cname('__pyx_memoryview_check')
14892 * cdef inline bint memoryview_check(object o):
14893 * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
14894 *
14895 * cdef tuple _unellipsify(object index, int ndim):
14896 */
14897 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
14898 __pyx_r = __pyx_t_1;
14899 goto __pyx_L0;
14900
14901 /* "View.MemoryView":663
14902 *
14903 * @cname('__pyx_memoryview_check')
14904 * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
14905 * return isinstance(o, memoryview)
14906 *
14907 */
14908
14909 /* function exit code */
14910 __pyx_L0:;
14911 __Pyx_RefNannyFinishContext();
14912 return __pyx_r;
14913}
14914
14915/* "View.MemoryView":666
14916 * return isinstance(o, memoryview)
14917 *
14918 * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
14919 * """
14920 * Replace all ellipses with full slices and fill incomplete indices with
14921 */
14922
14923static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
14924 PyObject *__pyx_v_tup = NULL;
14925 PyObject *__pyx_v_result = NULL;
14926 int __pyx_v_have_slices;
14927 int __pyx_v_seen_ellipsis;
14928 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
14929 PyObject *__pyx_v_item = NULL;
14930 Py_ssize_t __pyx_v_nslices;
14931 PyObject *__pyx_r = NULL;
14932 __Pyx_RefNannyDeclarations
14933 int __pyx_t_1;
14934 int __pyx_t_2;
14935 PyObject *__pyx_t_3 = NULL;
14936 PyObject *__pyx_t_4 = NULL;
14937 Py_ssize_t __pyx_t_5;
14938 PyObject *(*__pyx_t_6)(PyObject *);
14939 PyObject *__pyx_t_7 = NULL;
14940 Py_ssize_t __pyx_t_8;
14941 int __pyx_t_9;
14942 int __pyx_t_10;
14943 PyObject *__pyx_t_11 = NULL;
14944 int __pyx_lineno = 0;
14945 const char *__pyx_filename = NULL;
14946 int __pyx_clineno = 0;
14947 __Pyx_RefNannySetupContext("_unellipsify", 0);
14948
14949 /* "View.MemoryView":671
14950 * full slices.
14951 * """
14952 * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
14953 * tup = (index,)
14954 * else:
14955 */
14956 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
14957 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14958 if (__pyx_t_2) {
14959
14960 /* "View.MemoryView":672
14961 * """
14962 * if not isinstance(index, tuple):
14963 * tup = (index,) # <<<<<<<<<<<<<<
14964 * else:
14965 * tup = index
14966 */
14967 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
14968 __Pyx_GOTREF(__pyx_t_3);
14969 __Pyx_INCREF(__pyx_v_index);
14970 __Pyx_GIVEREF(__pyx_v_index);
14971 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
14972 __pyx_v_tup = __pyx_t_3;
14973 __pyx_t_3 = 0;
14974
14975 /* "View.MemoryView":671
14976 * full slices.
14977 * """
14978 * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
14979 * tup = (index,)
14980 * else:
14981 */
14982 goto __pyx_L3;
14983 }
14984
14985 /* "View.MemoryView":674
14986 * tup = (index,)
14987 * else:
14988 * tup = index # <<<<<<<<<<<<<<
14989 *
14990 * result = []
14991 */
14992 /*else*/ {
14993 __Pyx_INCREF(__pyx_v_index);
14994 __pyx_v_tup = __pyx_v_index;
14995 }
14996 __pyx_L3:;
14997
14998 /* "View.MemoryView":676
14999 * tup = index
15000 *
15001 * result = [] # <<<<<<<<<<<<<<
15002 * have_slices = False
15003 * seen_ellipsis = False
15004 */
15005 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
15006 __Pyx_GOTREF(__pyx_t_3);
15007 __pyx_v_result = ((PyObject*)__pyx_t_3);
15008 __pyx_t_3 = 0;
15009
15010 /* "View.MemoryView":677
15011 *
15012 * result = []
15013 * have_slices = False # <<<<<<<<<<<<<<
15014 * seen_ellipsis = False
15015 * for idx, item in enumerate(tup):
15016 */
15017 __pyx_v_have_slices = 0;
15018
15019 /* "View.MemoryView":678
15020 * result = []
15021 * have_slices = False
15022 * seen_ellipsis = False # <<<<<<<<<<<<<<
15023 * for idx, item in enumerate(tup):
15024 * if item is Ellipsis:
15025 */
15026 __pyx_v_seen_ellipsis = 0;
15027
15028 /* "View.MemoryView":679
15029 * have_slices = False
15030 * seen_ellipsis = False
15031 * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
15032 * if item is Ellipsis:
15033 * if not seen_ellipsis:
15034 */
15035 __Pyx_INCREF(__pyx_int_0);
15036 __pyx_t_3 = __pyx_int_0;
15037 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
15038 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
15039 __pyx_t_6 = NULL;
15040 } else {
15041 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
15042 __Pyx_GOTREF(__pyx_t_4);
15043 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
15044 }
15045 for (;;) {
15046 if (likely(!__pyx_t_6)) {
15047 if (likely(PyList_CheckExact(__pyx_t_4))) {
15048 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
15049 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15050 __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)
15051 #else
15052 __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)
15053 __Pyx_GOTREF(__pyx_t_7);
15054 #endif
15055 } else {
15056 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
15057 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15058 __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)
15059 #else
15060 __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)
15061 __Pyx_GOTREF(__pyx_t_7);
15062 #endif
15063 }
15064 } else {
15065 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
15066 if (unlikely(!__pyx_t_7)) {
15067 PyObject* exc_type = PyErr_Occurred();
15068 if (exc_type) {
15069 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15070 else __PYX_ERR(2, 679, __pyx_L1_error)
15071 }
15072 break;
15073 }
15074 __Pyx_GOTREF(__pyx_t_7);
15075 }
15076 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
15077 __pyx_t_7 = 0;
15078 __Pyx_INCREF(__pyx_t_3);
15079 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
15080 __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)
15081 __Pyx_GOTREF(__pyx_t_7);
15082 __Pyx_DECREF(__pyx_t_3);
15083 __pyx_t_3 = __pyx_t_7;
15084 __pyx_t_7 = 0;
15085
15086 /* "View.MemoryView":680
15087 * seen_ellipsis = False
15088 * for idx, item in enumerate(tup):
15089 * if item is Ellipsis: # <<<<<<<<<<<<<<
15090 * if not seen_ellipsis:
15091 * result.extend([slice(None)] * (ndim - len(tup) + 1))
15092 */
15093 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
15094 __pyx_t_1 = (__pyx_t_2 != 0);
15095 if (__pyx_t_1) {
15096
15097 /* "View.MemoryView":681
15098 * for idx, item in enumerate(tup):
15099 * if item is Ellipsis:
15100 * if not seen_ellipsis: # <<<<<<<<<<<<<<
15101 * result.extend([slice(None)] * (ndim - len(tup) + 1))
15102 * seen_ellipsis = True
15103 */
15104 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
15105 if (__pyx_t_1) {
15106
15107 /* "View.MemoryView":682
15108 * if item is Ellipsis:
15109 * if not seen_ellipsis:
15110 * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
15111 * seen_ellipsis = True
15112 * else:
15113 */
15114 __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
15115 __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)
15116 __Pyx_GOTREF(__pyx_t_7);
15117 { Py_ssize_t __pyx_temp;
15118 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
15119 __Pyx_INCREF(__pyx_slice_);
15120 __Pyx_GIVEREF(__pyx_slice_);
15121 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice_);
15122 }
15123 }
15124 __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)
15125 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15126
15127 /* "View.MemoryView":683
15128 * if not seen_ellipsis:
15129 * result.extend([slice(None)] * (ndim - len(tup) + 1))
15130 * seen_ellipsis = True # <<<<<<<<<<<<<<
15131 * else:
15132 * result.append(slice(None))
15133 */
15134 __pyx_v_seen_ellipsis = 1;
15135
15136 /* "View.MemoryView":681
15137 * for idx, item in enumerate(tup):
15138 * if item is Ellipsis:
15139 * if not seen_ellipsis: # <<<<<<<<<<<<<<
15140 * result.extend([slice(None)] * (ndim - len(tup) + 1))
15141 * seen_ellipsis = True
15142 */
15143 goto __pyx_L7;
15144 }
15145
15146 /* "View.MemoryView":685
15147 * seen_ellipsis = True
15148 * else:
15149 * result.append(slice(None)) # <<<<<<<<<<<<<<
15150 * have_slices = True
15151 * else:
15152 */
15153 /*else*/ {
15154 __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)
15155 }
15156 __pyx_L7:;
15157
15158 /* "View.MemoryView":686
15159 * else:
15160 * result.append(slice(None))
15161 * have_slices = True # <<<<<<<<<<<<<<
15162 * else:
15163 * if not isinstance(item, slice) and not PyIndex_Check(item):
15164 */
15165 __pyx_v_have_slices = 1;
15166
15167 /* "View.MemoryView":680
15168 * seen_ellipsis = False
15169 * for idx, item in enumerate(tup):
15170 * if item is Ellipsis: # <<<<<<<<<<<<<<
15171 * if not seen_ellipsis:
15172 * result.extend([slice(None)] * (ndim - len(tup) + 1))
15173 */
15174 goto __pyx_L6;
15175 }
15176
15177 /* "View.MemoryView":688
15178 * have_slices = True
15179 * else:
15180 * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
15181 * raise TypeError("Cannot index with type '%s'" % type(item))
15182 *
15183 */
15184 /*else*/ {
15185 __pyx_t_2 = PySlice_Check(__pyx_v_item);
15186 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
15187 if (__pyx_t_10) {
15188 } else {
15189 __pyx_t_1 = __pyx_t_10;
15190 goto __pyx_L9_bool_binop_done;
15191 }
15192 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
15193 __pyx_t_1 = __pyx_t_10;
15194 __pyx_L9_bool_binop_done:;
15195 if (unlikely(__pyx_t_1)) {
15196
15197 /* "View.MemoryView":689
15198 * else:
15199 * if not isinstance(item, slice) and not PyIndex_Check(item):
15200 * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<<
15201 *
15202 * have_slices = have_slices or isinstance(item, slice)
15203 */
15204 __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)
15205 __Pyx_GOTREF(__pyx_t_7);
15206 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
15207 __Pyx_GOTREF(__pyx_t_11);
15208 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15209 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
15210 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15211 __PYX_ERR(2, 689, __pyx_L1_error)
15212
15213 /* "View.MemoryView":688
15214 * have_slices = True
15215 * else:
15216 * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
15217 * raise TypeError("Cannot index with type '%s'" % type(item))
15218 *
15219 */
15220 }
15221
15222 /* "View.MemoryView":691
15223 * raise TypeError("Cannot index with type '%s'" % type(item))
15224 *
15225 * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
15226 * result.append(item)
15227 *
15228 */
15229 __pyx_t_10 = (__pyx_v_have_slices != 0);
15230 if (!__pyx_t_10) {
15231 } else {
15232 __pyx_t_1 = __pyx_t_10;
15233 goto __pyx_L11_bool_binop_done;
15234 }
15235 __pyx_t_10 = PySlice_Check(__pyx_v_item);
15236 __pyx_t_2 = (__pyx_t_10 != 0);
15237 __pyx_t_1 = __pyx_t_2;
15238 __pyx_L11_bool_binop_done:;
15239 __pyx_v_have_slices = __pyx_t_1;
15240
15241 /* "View.MemoryView":692
15242 *
15243 * have_slices = have_slices or isinstance(item, slice)
15244 * result.append(item) # <<<<<<<<<<<<<<
15245 *
15246 * nslices = ndim - len(result)
15247 */
15248 __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)
15249 }
15250 __pyx_L6:;
15251
15252 /* "View.MemoryView":679
15253 * have_slices = False
15254 * seen_ellipsis = False
15255 * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
15256 * if item is Ellipsis:
15257 * if not seen_ellipsis:
15258 */
15259 }
15260 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15261 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15262
15263 /* "View.MemoryView":694
15264 * result.append(item)
15265 *
15266 * nslices = ndim - len(result) # <<<<<<<<<<<<<<
15267 * if nslices:
15268 * result.extend([slice(None)] * nslices)
15269 */
15270 __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)
15271 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
15272
15273 /* "View.MemoryView":695
15274 *
15275 * nslices = ndim - len(result)
15276 * if nslices: # <<<<<<<<<<<<<<
15277 * result.extend([slice(None)] * nslices)
15278 *
15279 */
15280 __pyx_t_1 = (__pyx_v_nslices != 0);
15281 if (__pyx_t_1) {
15282
15283 /* "View.MemoryView":696
15284 * nslices = ndim - len(result)
15285 * if nslices:
15286 * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
15287 *
15288 * return have_slices or nslices, tuple(result)
15289 */
15290 __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)
15291 __Pyx_GOTREF(__pyx_t_3);
15292 { Py_ssize_t __pyx_temp;
15293 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
15294 __Pyx_INCREF(__pyx_slice_);
15295 __Pyx_GIVEREF(__pyx_slice_);
15296 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice_);
15297 }
15298 }
15299 __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)
15300 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15301
15302 /* "View.MemoryView":695
15303 *
15304 * nslices = ndim - len(result)
15305 * if nslices: # <<<<<<<<<<<<<<
15306 * result.extend([slice(None)] * nslices)
15307 *
15308 */
15309 }
15310
15311 /* "View.MemoryView":698
15312 * result.extend([slice(None)] * nslices)
15313 *
15314 * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
15315 *
15316 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
15317 */
15318 __Pyx_XDECREF(__pyx_r);
15319 if (!__pyx_v_have_slices) {
15320 } else {
15321 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
15322 __Pyx_GOTREF(__pyx_t_4);
15323 __pyx_t_3 = __pyx_t_4;
15324 __pyx_t_4 = 0;
15325 goto __pyx_L14_bool_binop_done;
15326 }
15327 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
15328 __Pyx_GOTREF(__pyx_t_4);
15329 __pyx_t_3 = __pyx_t_4;
15330 __pyx_t_4 = 0;
15331 __pyx_L14_bool_binop_done:;
15332 __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
15333 __Pyx_GOTREF(__pyx_t_4);
15334 __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
15335 __Pyx_GOTREF(__pyx_t_11);
15336 __Pyx_GIVEREF(__pyx_t_3);
15337 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
15338 __Pyx_GIVEREF(__pyx_t_4);
15339 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
15340 __pyx_t_3 = 0;
15341 __pyx_t_4 = 0;
15342 __pyx_r = ((PyObject*)__pyx_t_11);
15343 __pyx_t_11 = 0;
15344 goto __pyx_L0;
15345
15346 /* "View.MemoryView":666
15347 * return isinstance(o, memoryview)
15348 *
15349 * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
15350 * """
15351 * Replace all ellipses with full slices and fill incomplete indices with
15352 */
15353
15354 /* function exit code */
15355 __pyx_L1_error:;
15356 __Pyx_XDECREF(__pyx_t_3);
15357 __Pyx_XDECREF(__pyx_t_4);
15358 __Pyx_XDECREF(__pyx_t_7);
15359 __Pyx_XDECREF(__pyx_t_11);
15360 __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
15361 __pyx_r = 0;
15362 __pyx_L0:;
15363 __Pyx_XDECREF(__pyx_v_tup);
15364 __Pyx_XDECREF(__pyx_v_result);
15365 __Pyx_XDECREF(__pyx_v_idx);
15366 __Pyx_XDECREF(__pyx_v_item);
15367 __Pyx_XGIVEREF(__pyx_r);
15368 __Pyx_RefNannyFinishContext();
15369 return __pyx_r;
15370}
15371
15372/* "View.MemoryView":700
15373 * return have_slices or nslices, tuple(result)
15374 *
15375 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
15376 * for suboffset in suboffsets[:ndim]:
15377 * if suboffset >= 0:
15378 */
15379
15380static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
15381 Py_ssize_t __pyx_v_suboffset;
15382 PyObject *__pyx_r = NULL;
15383 __Pyx_RefNannyDeclarations
15384 Py_ssize_t *__pyx_t_1;
15385 Py_ssize_t *__pyx_t_2;
15386 Py_ssize_t *__pyx_t_3;
15387 int __pyx_t_4;
15388 PyObject *__pyx_t_5 = NULL;
15389 int __pyx_lineno = 0;
15390 const char *__pyx_filename = NULL;
15391 int __pyx_clineno = 0;
15392 __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
15393
15394 /* "View.MemoryView":701
15395 *
15396 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
15397 * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
15398 * if suboffset >= 0:
15399 * raise ValueError("Indirect dimensions not supported")
15400 */
15401 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
15402 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
15403 __pyx_t_1 = __pyx_t_3;
15404 __pyx_v_suboffset = (__pyx_t_1[0]);
15405
15406 /* "View.MemoryView":702
15407 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
15408 * for suboffset in suboffsets[:ndim]:
15409 * if suboffset >= 0: # <<<<<<<<<<<<<<
15410 * raise ValueError("Indirect dimensions not supported")
15411 *
15412 */
15413 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
15414 if (unlikely(__pyx_t_4)) {
15415
15416 /* "View.MemoryView":703
15417 * for suboffset in suboffsets[:ndim]:
15418 * if suboffset >= 0:
15419 * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
15420 *
15421 *
15422 */
15423 __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)
15424 __Pyx_GOTREF(__pyx_t_5);
15425 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
15426 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15427 __PYX_ERR(2, 703, __pyx_L1_error)
15428
15429 /* "View.MemoryView":702
15430 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
15431 * for suboffset in suboffsets[:ndim]:
15432 * if suboffset >= 0: # <<<<<<<<<<<<<<
15433 * raise ValueError("Indirect dimensions not supported")
15434 *
15435 */
15436 }
15437 }
15438
15439 /* "View.MemoryView":700
15440 * return have_slices or nslices, tuple(result)
15441 *
15442 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
15443 * for suboffset in suboffsets[:ndim]:
15444 * if suboffset >= 0:
15445 */
15446
15447 /* function exit code */
15448 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15449 goto __pyx_L0;
15450 __pyx_L1_error:;
15451 __Pyx_XDECREF(__pyx_t_5);
15452 __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
15453 __pyx_r = 0;
15454 __pyx_L0:;
15455 __Pyx_XGIVEREF(__pyx_r);
15456 __Pyx_RefNannyFinishContext();
15457 return __pyx_r;
15458}
15459
15460/* "View.MemoryView":710
15461 *
15462 * @cname('__pyx_memview_slice')
15463 * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
15464 * cdef int new_ndim = 0, suboffset_dim = -1, dim
15465 * cdef bint negative_step
15466 */
15467
15468static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
15469 int __pyx_v_new_ndim;
15470 int __pyx_v_suboffset_dim;
15471 int __pyx_v_dim;
15472 __Pyx_memviewslice __pyx_v_src;
15473 __Pyx_memviewslice __pyx_v_dst;
15474 __Pyx_memviewslice *__pyx_v_p_src;
15475 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
15476 __Pyx_memviewslice *__pyx_v_p_dst;
15477 int *__pyx_v_p_suboffset_dim;
15478 Py_ssize_t __pyx_v_start;
15479 Py_ssize_t __pyx_v_stop;
15480 Py_ssize_t __pyx_v_step;
15481 int __pyx_v_have_start;
15482 int __pyx_v_have_stop;
15483 int __pyx_v_have_step;
15484 PyObject *__pyx_v_index = NULL;
15485 struct __pyx_memoryview_obj *__pyx_r = NULL;
15486 __Pyx_RefNannyDeclarations
15487 int __pyx_t_1;
15488 int __pyx_t_2;
15489 PyObject *__pyx_t_3 = NULL;
15490 struct __pyx_memoryview_obj *__pyx_t_4;
15491 char *__pyx_t_5;
15492 int __pyx_t_6;
15493 Py_ssize_t __pyx_t_7;
15494 PyObject *(*__pyx_t_8)(PyObject *);
15495 PyObject *__pyx_t_9 = NULL;
15496 Py_ssize_t __pyx_t_10;
15497 int __pyx_t_11;
15498 Py_ssize_t __pyx_t_12;
15499 int __pyx_lineno = 0;
15500 const char *__pyx_filename = NULL;
15501 int __pyx_clineno = 0;
15502 __Pyx_RefNannySetupContext("memview_slice", 0);
15503
15504 /* "View.MemoryView":711
15505 * @cname('__pyx_memview_slice')
15506 * cdef memoryview memview_slice(memoryview memview, object indices):
15507 * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
15508 * cdef bint negative_step
15509 * cdef __Pyx_memviewslice src, dst
15510 */
15511 __pyx_v_new_ndim = 0;
15512 __pyx_v_suboffset_dim = -1;
15513
15514 /* "View.MemoryView":718
15515 *
15516 *
15517 * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
15518 *
15519 * cdef _memoryviewslice memviewsliceobj
15520 */
15521 (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
15522
15523 /* "View.MemoryView":722
15524 * cdef _memoryviewslice memviewsliceobj
15525 *
15526 * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
15527 *
15528 * if isinstance(memview, _memoryviewslice):
15529 */
15530 #ifndef CYTHON_WITHOUT_ASSERTIONS
15531 if (unlikely(!Py_OptimizeFlag)) {
15532 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
15533 PyErr_SetNone(PyExc_AssertionError);
15534 __PYX_ERR(2, 722, __pyx_L1_error)
15535 }
15536 }
15537 #endif
15538
15539 /* "View.MemoryView":724
15540 * assert memview.view.ndim > 0
15541 *
15542 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
15543 * memviewsliceobj = memview
15544 * p_src = &memviewsliceobj.from_slice
15545 */
15546 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15547 __pyx_t_2 = (__pyx_t_1 != 0);
15548 if (__pyx_t_2) {
15549
15550 /* "View.MemoryView":725
15551 *
15552 * if isinstance(memview, _memoryviewslice):
15553 * memviewsliceobj = memview # <<<<<<<<<<<<<<
15554 * p_src = &memviewsliceobj.from_slice
15555 * else:
15556 */
15557 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)
15558 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
15559 __Pyx_INCREF(__pyx_t_3);
15560 __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
15561 __pyx_t_3 = 0;
15562
15563 /* "View.MemoryView":726
15564 * if isinstance(memview, _memoryviewslice):
15565 * memviewsliceobj = memview
15566 * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
15567 * else:
15568 * slice_copy(memview, &src)
15569 */
15570 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
15571
15572 /* "View.MemoryView":724
15573 * assert memview.view.ndim > 0
15574 *
15575 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
15576 * memviewsliceobj = memview
15577 * p_src = &memviewsliceobj.from_slice
15578 */
15579 goto __pyx_L3;
15580 }
15581
15582 /* "View.MemoryView":728
15583 * p_src = &memviewsliceobj.from_slice
15584 * else:
15585 * slice_copy(memview, &src) # <<<<<<<<<<<<<<
15586 * p_src = &src
15587 *
15588 */
15589 /*else*/ {
15590 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
15591
15592 /* "View.MemoryView":729
15593 * else:
15594 * slice_copy(memview, &src)
15595 * p_src = &src # <<<<<<<<<<<<<<
15596 *
15597 *
15598 */
15599 __pyx_v_p_src = (&__pyx_v_src);
15600 }
15601 __pyx_L3:;
15602
15603 /* "View.MemoryView":735
15604 *
15605 *
15606 * dst.memview = p_src.memview # <<<<<<<<<<<<<<
15607 * dst.data = p_src.data
15608 *
15609 */
15610 __pyx_t_4 = __pyx_v_p_src->memview;
15611 __pyx_v_dst.memview = __pyx_t_4;
15612
15613 /* "View.MemoryView":736
15614 *
15615 * dst.memview = p_src.memview
15616 * dst.data = p_src.data # <<<<<<<<<<<<<<
15617 *
15618 *
15619 */
15620 __pyx_t_5 = __pyx_v_p_src->data;
15621 __pyx_v_dst.data = __pyx_t_5;
15622
15623 /* "View.MemoryView":741
15624 *
15625 *
15626 * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
15627 * cdef int *p_suboffset_dim = &suboffset_dim
15628 * cdef Py_ssize_t start, stop, step
15629 */
15630 __pyx_v_p_dst = (&__pyx_v_dst);
15631
15632 /* "View.MemoryView":742
15633 *
15634 * cdef __Pyx_memviewslice *p_dst = &dst
15635 * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
15636 * cdef Py_ssize_t start, stop, step
15637 * cdef bint have_start, have_stop, have_step
15638 */
15639 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
15640
15641 /* "View.MemoryView":746
15642 * cdef bint have_start, have_stop, have_step
15643 *
15644 * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
15645 * if PyIndex_Check(index):
15646 * slice_memviewslice(
15647 */
15648 __pyx_t_6 = 0;
15649 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
15650 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
15651 __pyx_t_8 = NULL;
15652 } else {
15653 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
15654 __Pyx_GOTREF(__pyx_t_3);
15655 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
15656 }
15657 for (;;) {
15658 if (likely(!__pyx_t_8)) {
15659 if (likely(PyList_CheckExact(__pyx_t_3))) {
15660 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
15661 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15662 __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)
15663 #else
15664 __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)
15665 __Pyx_GOTREF(__pyx_t_9);
15666 #endif
15667 } else {
15668 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
15669 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15670 __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)
15671 #else
15672 __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)
15673 __Pyx_GOTREF(__pyx_t_9);
15674 #endif
15675 }
15676 } else {
15677 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
15678 if (unlikely(!__pyx_t_9)) {
15679 PyObject* exc_type = PyErr_Occurred();
15680 if (exc_type) {
15681 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15682 else __PYX_ERR(2, 746, __pyx_L1_error)
15683 }
15684 break;
15685 }
15686 __Pyx_GOTREF(__pyx_t_9);
15687 }
15688 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
15689 __pyx_t_9 = 0;
15690 __pyx_v_dim = __pyx_t_6;
15691 __pyx_t_6 = (__pyx_t_6 + 1);
15692
15693 /* "View.MemoryView":747
15694 *
15695 * for dim, index in enumerate(indices):
15696 * if PyIndex_Check(index): # <<<<<<<<<<<<<<
15697 * slice_memviewslice(
15698 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
15699 */
15700 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
15701 if (__pyx_t_2) {
15702
15703 /* "View.MemoryView":751
15704 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
15705 * dim, new_ndim, p_suboffset_dim,
15706 * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<<
15707 * 0, 0, 0, # have_{start,stop,step}
15708 * False)
15709 */
15710 __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)
15711
15712 /* "View.MemoryView":748
15713 * for dim, index in enumerate(indices):
15714 * if PyIndex_Check(index):
15715 * slice_memviewslice( # <<<<<<<<<<<<<<
15716 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
15717 * dim, new_ndim, p_suboffset_dim,
15718 */
15719 __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)
15720
15721 /* "View.MemoryView":747
15722 *
15723 * for dim, index in enumerate(indices):
15724 * if PyIndex_Check(index): # <<<<<<<<<<<<<<
15725 * slice_memviewslice(
15726 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
15727 */
15728 goto __pyx_L6;
15729 }
15730
15731 /* "View.MemoryView":754
15732 * 0, 0, 0, # have_{start,stop,step}
15733 * False)
15734 * elif index is None: # <<<<<<<<<<<<<<
15735 * p_dst.shape[new_ndim] = 1
15736 * p_dst.strides[new_ndim] = 0
15737 */
15738 __pyx_t_2 = (__pyx_v_index == Py_None);
15739 __pyx_t_1 = (__pyx_t_2 != 0);
15740 if (__pyx_t_1) {
15741
15742 /* "View.MemoryView":755
15743 * False)
15744 * elif index is None:
15745 * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
15746 * p_dst.strides[new_ndim] = 0
15747 * p_dst.suboffsets[new_ndim] = -1
15748 */
15749 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
15750
15751 /* "View.MemoryView":756
15752 * elif index is None:
15753 * p_dst.shape[new_ndim] = 1
15754 * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
15755 * p_dst.suboffsets[new_ndim] = -1
15756 * new_ndim += 1
15757 */
15758 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
15759
15760 /* "View.MemoryView":757
15761 * p_dst.shape[new_ndim] = 1
15762 * p_dst.strides[new_ndim] = 0
15763 * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
15764 * new_ndim += 1
15765 * else:
15766 */
15767 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
15768
15769 /* "View.MemoryView":758
15770 * p_dst.strides[new_ndim] = 0
15771 * p_dst.suboffsets[new_ndim] = -1
15772 * new_ndim += 1 # <<<<<<<<<<<<<<
15773 * else:
15774 * start = index.start or 0
15775 */
15776 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
15777
15778 /* "View.MemoryView":754
15779 * 0, 0, 0, # have_{start,stop,step}
15780 * False)
15781 * elif index is None: # <<<<<<<<<<<<<<
15782 * p_dst.shape[new_ndim] = 1
15783 * p_dst.strides[new_ndim] = 0
15784 */
15785 goto __pyx_L6;
15786 }
15787
15788 /* "View.MemoryView":760
15789 * new_ndim += 1
15790 * else:
15791 * start = index.start or 0 # <<<<<<<<<<<<<<
15792 * stop = index.stop or 0
15793 * step = index.step or 0
15794 */
15795 /*else*/ {
15796 __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)
15797 __Pyx_GOTREF(__pyx_t_9);
15798 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
15799 if (!__pyx_t_1) {
15800 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15801 } else {
15802 __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)
15803 __pyx_t_10 = __pyx_t_12;
15804 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15805 goto __pyx_L7_bool_binop_done;
15806 }
15807 __pyx_t_10 = 0;
15808 __pyx_L7_bool_binop_done:;
15809 __pyx_v_start = __pyx_t_10;
15810
15811 /* "View.MemoryView":761
15812 * else:
15813 * start = index.start or 0
15814 * stop = index.stop or 0 # <<<<<<<<<<<<<<
15815 * step = index.step or 0
15816 *
15817 */
15818 __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)
15819 __Pyx_GOTREF(__pyx_t_9);
15820 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
15821 if (!__pyx_t_1) {
15822 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15823 } else {
15824 __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)
15825 __pyx_t_10 = __pyx_t_12;
15826 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15827 goto __pyx_L9_bool_binop_done;
15828 }
15829 __pyx_t_10 = 0;
15830 __pyx_L9_bool_binop_done:;
15831 __pyx_v_stop = __pyx_t_10;
15832
15833 /* "View.MemoryView":762
15834 * start = index.start or 0
15835 * stop = index.stop or 0
15836 * step = index.step or 0 # <<<<<<<<<<<<<<
15837 *
15838 * have_start = index.start is not None
15839 */
15840 __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)
15841 __Pyx_GOTREF(__pyx_t_9);
15842 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
15843 if (!__pyx_t_1) {
15844 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15845 } else {
15846 __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)
15847 __pyx_t_10 = __pyx_t_12;
15848 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15849 goto __pyx_L11_bool_binop_done;
15850 }
15851 __pyx_t_10 = 0;
15852 __pyx_L11_bool_binop_done:;
15853 __pyx_v_step = __pyx_t_10;
15854
15855 /* "View.MemoryView":764
15856 * step = index.step or 0
15857 *
15858 * have_start = index.start is not None # <<<<<<<<<<<<<<
15859 * have_stop = index.stop is not None
15860 * have_step = index.step is not None
15861 */
15862 __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)
15863 __Pyx_GOTREF(__pyx_t_9);
15864 __pyx_t_1 = (__pyx_t_9 != Py_None);
15865 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15866 __pyx_v_have_start = __pyx_t_1;
15867
15868 /* "View.MemoryView":765
15869 *
15870 * have_start = index.start is not None
15871 * have_stop = index.stop is not None # <<<<<<<<<<<<<<
15872 * have_step = index.step is not None
15873 *
15874 */
15875 __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)
15876 __Pyx_GOTREF(__pyx_t_9);
15877 __pyx_t_1 = (__pyx_t_9 != Py_None);
15878 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15879 __pyx_v_have_stop = __pyx_t_1;
15880
15881 /* "View.MemoryView":766
15882 * have_start = index.start is not None
15883 * have_stop = index.stop is not None
15884 * have_step = index.step is not None # <<<<<<<<<<<<<<
15885 *
15886 * slice_memviewslice(
15887 */
15888 __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)
15889 __Pyx_GOTREF(__pyx_t_9);
15890 __pyx_t_1 = (__pyx_t_9 != Py_None);
15891 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15892 __pyx_v_have_step = __pyx_t_1;
15893
15894 /* "View.MemoryView":768
15895 * have_step = index.step is not None
15896 *
15897 * slice_memviewslice( # <<<<<<<<<<<<<<
15898 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
15899 * dim, new_ndim, p_suboffset_dim,
15900 */
15901 __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)
15902
15903 /* "View.MemoryView":774
15904 * have_start, have_stop, have_step,
15905 * True)
15906 * new_ndim += 1 # <<<<<<<<<<<<<<
15907 *
15908 * if isinstance(memview, _memoryviewslice):
15909 */
15910 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
15911 }
15912 __pyx_L6:;
15913
15914 /* "View.MemoryView":746
15915 * cdef bint have_start, have_stop, have_step
15916 *
15917 * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
15918 * if PyIndex_Check(index):
15919 * slice_memviewslice(
15920 */
15921 }
15922 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15923
15924 /* "View.MemoryView":776
15925 * new_ndim += 1
15926 *
15927 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
15928 * return memoryview_fromslice(dst, new_ndim,
15929 * memviewsliceobj.to_object_func,
15930 */
15931 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15932 __pyx_t_2 = (__pyx_t_1 != 0);
15933 if (__pyx_t_2) {
15934
15935 /* "View.MemoryView":777
15936 *
15937 * if isinstance(memview, _memoryviewslice):
15938 * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
15939 * memviewsliceobj.to_object_func,
15940 * memviewsliceobj.to_dtype_func,
15941 */
15942 __Pyx_XDECREF(((PyObject *)__pyx_r));
15943
15944 /* "View.MemoryView":778
15945 * if isinstance(memview, _memoryviewslice):
15946 * return memoryview_fromslice(dst, new_ndim,
15947 * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
15948 * memviewsliceobj.to_dtype_func,
15949 * memview.dtype_is_object)
15950 */
15951 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
15952
15953 /* "View.MemoryView":779
15954 * return memoryview_fromslice(dst, new_ndim,
15955 * memviewsliceobj.to_object_func,
15956 * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
15957 * memview.dtype_is_object)
15958 * else:
15959 */
15960 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
15961
15962 /* "View.MemoryView":777
15963 *
15964 * if isinstance(memview, _memoryviewslice):
15965 * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
15966 * memviewsliceobj.to_object_func,
15967 * memviewsliceobj.to_dtype_func,
15968 */
15969 __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)
15970 __Pyx_GOTREF(__pyx_t_3);
15971 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
15972 __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
15973 __pyx_t_3 = 0;
15974 goto __pyx_L0;
15975
15976 /* "View.MemoryView":776
15977 * new_ndim += 1
15978 *
15979 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
15980 * return memoryview_fromslice(dst, new_ndim,
15981 * memviewsliceobj.to_object_func,
15982 */
15983 }
15984
15985 /* "View.MemoryView":782
15986 * memview.dtype_is_object)
15987 * else:
15988 * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
15989 * memview.dtype_is_object)
15990 *
15991 */
15992 /*else*/ {
15993 __Pyx_XDECREF(((PyObject *)__pyx_r));
15994
15995 /* "View.MemoryView":783
15996 * else:
15997 * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
15998 * memview.dtype_is_object) # <<<<<<<<<<<<<<
15999 *
16000 *
16001 */
16002 __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)
16003 __Pyx_GOTREF(__pyx_t_3);
16004
16005 /* "View.MemoryView":782
16006 * memview.dtype_is_object)
16007 * else:
16008 * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
16009 * memview.dtype_is_object)
16010 *
16011 */
16012 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
16013 __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
16014 __pyx_t_3 = 0;
16015 goto __pyx_L0;
16016 }
16017
16018 /* "View.MemoryView":710
16019 *
16020 * @cname('__pyx_memview_slice')
16021 * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
16022 * cdef int new_ndim = 0, suboffset_dim = -1, dim
16023 * cdef bint negative_step
16024 */
16025
16026 /* function exit code */
16027 __pyx_L1_error:;
16028 __Pyx_XDECREF(__pyx_t_3);
16029 __Pyx_XDECREF(__pyx_t_9);
16030 __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16031 __pyx_r = 0;
16032 __pyx_L0:;
16033 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
16034 __Pyx_XDECREF(__pyx_v_index);
16035 __Pyx_XGIVEREF((PyObject *)__pyx_r);
16036 __Pyx_RefNannyFinishContext();
16037 return __pyx_r;
16038}
16039
16040/* "View.MemoryView":807
16041 *
16042 * @cname('__pyx_memoryview_slice_memviewslice')
16043 * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
16044 * __Pyx_memviewslice *dst,
16045 * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
16046 */
16047
16048static 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) {
16049 Py_ssize_t __pyx_v_new_shape;
16050 int __pyx_v_negative_step;
16051 int __pyx_r;
16052 int __pyx_t_1;
16053 int __pyx_t_2;
16054 int __pyx_t_3;
16055 int __pyx_lineno = 0;
16056 const char *__pyx_filename = NULL;
16057 int __pyx_clineno = 0;
16058
16059 /* "View.MemoryView":827
16060 * cdef bint negative_step
16061 *
16062 * if not is_slice: # <<<<<<<<<<<<<<
16063 *
16064 * if start < 0:
16065 */
16066 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
16067 if (__pyx_t_1) {
16068
16069 /* "View.MemoryView":829
16070 * if not is_slice:
16071 *
16072 * if start < 0: # <<<<<<<<<<<<<<
16073 * start += shape
16074 * if not 0 <= start < shape:
16075 */
16076 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
16077 if (__pyx_t_1) {
16078
16079 /* "View.MemoryView":830
16080 *
16081 * if start < 0:
16082 * start += shape # <<<<<<<<<<<<<<
16083 * if not 0 <= start < shape:
16084 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
16085 */
16086 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
16087
16088 /* "View.MemoryView":829
16089 * if not is_slice:
16090 *
16091 * if start < 0: # <<<<<<<<<<<<<<
16092 * start += shape
16093 * if not 0 <= start < shape:
16094 */
16095 }
16096
16097 /* "View.MemoryView":831
16098 * if start < 0:
16099 * start += shape
16100 * if not 0 <= start < shape: # <<<<<<<<<<<<<<
16101 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
16102 * else:
16103 */
16104 __pyx_t_1 = (0 <= __pyx_v_start);
16105 if (__pyx_t_1) {
16106 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
16107 }
16108 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
16109 if (__pyx_t_2) {
16110
16111 /* "View.MemoryView":832
16112 * start += shape
16113 * if not 0 <= start < shape:
16114 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
16115 * else:
16116 *
16117 */
16118 __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)
16119
16120 /* "View.MemoryView":831
16121 * if start < 0:
16122 * start += shape
16123 * if not 0 <= start < shape: # <<<<<<<<<<<<<<
16124 * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
16125 * else:
16126 */
16127 }
16128
16129 /* "View.MemoryView":827
16130 * cdef bint negative_step
16131 *
16132 * if not is_slice: # <<<<<<<<<<<<<<
16133 *
16134 * if start < 0:
16135 */
16136 goto __pyx_L3;
16137 }
16138
16139 /* "View.MemoryView":835
16140 * else:
16141 *
16142 * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
16143 *
16144 * if have_step and step == 0:
16145 */
16146 /*else*/ {
16147 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
16148 if (__pyx_t_1) {
16149 } else {
16150 __pyx_t_2 = __pyx_t_1;
16151 goto __pyx_L6_bool_binop_done;
16152 }
16153 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
16154 __pyx_t_2 = __pyx_t_1;
16155 __pyx_L6_bool_binop_done:;
16156 __pyx_v_negative_step = __pyx_t_2;
16157
16158 /* "View.MemoryView":837
16159 * negative_step = have_step != 0 and step < 0
16160 *
16161 * if have_step and step == 0: # <<<<<<<<<<<<<<
16162 * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
16163 *
16164 */
16165 __pyx_t_1 = (__pyx_v_have_step != 0);
16166 if (__pyx_t_1) {
16167 } else {
16168 __pyx_t_2 = __pyx_t_1;
16169 goto __pyx_L9_bool_binop_done;
16170 }
16171 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
16172 __pyx_t_2 = __pyx_t_1;
16173 __pyx_L9_bool_binop_done:;
16174 if (__pyx_t_2) {
16175
16176 /* "View.MemoryView":838
16177 *
16178 * if have_step and step == 0:
16179 * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
16180 *
16181 *
16182 */
16183 __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)
16184
16185 /* "View.MemoryView":837
16186 * negative_step = have_step != 0 and step < 0
16187 *
16188 * if have_step and step == 0: # <<<<<<<<<<<<<<
16189 * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
16190 *
16191 */
16192 }
16193
16194 /* "View.MemoryView":841
16195 *
16196 *
16197 * if have_start: # <<<<<<<<<<<<<<
16198 * if start < 0:
16199 * start += shape
16200 */
16201 __pyx_t_2 = (__pyx_v_have_start != 0);
16202 if (__pyx_t_2) {
16203
16204 /* "View.MemoryView":842
16205 *
16206 * if have_start:
16207 * if start < 0: # <<<<<<<<<<<<<<
16208 * start += shape
16209 * if start < 0:
16210 */
16211 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
16212 if (__pyx_t_2) {
16213
16214 /* "View.MemoryView":843
16215 * if have_start:
16216 * if start < 0:
16217 * start += shape # <<<<<<<<<<<<<<
16218 * if start < 0:
16219 * start = 0
16220 */
16221 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
16222
16223 /* "View.MemoryView":844
16224 * if start < 0:
16225 * start += shape
16226 * if start < 0: # <<<<<<<<<<<<<<
16227 * start = 0
16228 * elif start >= shape:
16229 */
16230 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
16231 if (__pyx_t_2) {
16232
16233 /* "View.MemoryView":845
16234 * start += shape
16235 * if start < 0:
16236 * start = 0 # <<<<<<<<<<<<<<
16237 * elif start >= shape:
16238 * if negative_step:
16239 */
16240 __pyx_v_start = 0;
16241
16242 /* "View.MemoryView":844
16243 * if start < 0:
16244 * start += shape
16245 * if start < 0: # <<<<<<<<<<<<<<
16246 * start = 0
16247 * elif start >= shape:
16248 */
16249 }
16250
16251 /* "View.MemoryView":842
16252 *
16253 * if have_start:
16254 * if start < 0: # <<<<<<<<<<<<<<
16255 * start += shape
16256 * if start < 0:
16257 */
16258 goto __pyx_L12;
16259 }
16260
16261 /* "View.MemoryView":846
16262 * if start < 0:
16263 * start = 0
16264 * elif start >= shape: # <<<<<<<<<<<<<<
16265 * if negative_step:
16266 * start = shape - 1
16267 */
16268 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
16269 if (__pyx_t_2) {
16270
16271 /* "View.MemoryView":847
16272 * start = 0
16273 * elif start >= shape:
16274 * if negative_step: # <<<<<<<<<<<<<<
16275 * start = shape - 1
16276 * else:
16277 */
16278 __pyx_t_2 = (__pyx_v_negative_step != 0);
16279 if (__pyx_t_2) {
16280
16281 /* "View.MemoryView":848
16282 * elif start >= shape:
16283 * if negative_step:
16284 * start = shape - 1 # <<<<<<<<<<<<<<
16285 * else:
16286 * start = shape
16287 */
16288 __pyx_v_start = (__pyx_v_shape - 1);
16289
16290 /* "View.MemoryView":847
16291 * start = 0
16292 * elif start >= shape:
16293 * if negative_step: # <<<<<<<<<<<<<<
16294 * start = shape - 1
16295 * else:
16296 */
16297 goto __pyx_L14;
16298 }
16299
16300 /* "View.MemoryView":850
16301 * start = shape - 1
16302 * else:
16303 * start = shape # <<<<<<<<<<<<<<
16304 * else:
16305 * if negative_step:
16306 */
16307 /*else*/ {
16308 __pyx_v_start = __pyx_v_shape;
16309 }
16310 __pyx_L14:;
16311
16312 /* "View.MemoryView":846
16313 * if start < 0:
16314 * start = 0
16315 * elif start >= shape: # <<<<<<<<<<<<<<
16316 * if negative_step:
16317 * start = shape - 1
16318 */
16319 }
16320 __pyx_L12:;
16321
16322 /* "View.MemoryView":841
16323 *
16324 *
16325 * if have_start: # <<<<<<<<<<<<<<
16326 * if start < 0:
16327 * start += shape
16328 */
16329 goto __pyx_L11;
16330 }
16331
16332 /* "View.MemoryView":852
16333 * start = shape
16334 * else:
16335 * if negative_step: # <<<<<<<<<<<<<<
16336 * start = shape - 1
16337 * else:
16338 */
16339 /*else*/ {
16340 __pyx_t_2 = (__pyx_v_negative_step != 0);
16341 if (__pyx_t_2) {
16342
16343 /* "View.MemoryView":853
16344 * else:
16345 * if negative_step:
16346 * start = shape - 1 # <<<<<<<<<<<<<<
16347 * else:
16348 * start = 0
16349 */
16350 __pyx_v_start = (__pyx_v_shape - 1);
16351
16352 /* "View.MemoryView":852
16353 * start = shape
16354 * else:
16355 * if negative_step: # <<<<<<<<<<<<<<
16356 * start = shape - 1
16357 * else:
16358 */
16359 goto __pyx_L15;
16360 }
16361
16362 /* "View.MemoryView":855
16363 * start = shape - 1
16364 * else:
16365 * start = 0 # <<<<<<<<<<<<<<
16366 *
16367 * if have_stop:
16368 */
16369 /*else*/ {
16370 __pyx_v_start = 0;
16371 }
16372 __pyx_L15:;
16373 }
16374 __pyx_L11:;
16375
16376 /* "View.MemoryView":857
16377 * start = 0
16378 *
16379 * if have_stop: # <<<<<<<<<<<<<<
16380 * if stop < 0:
16381 * stop += shape
16382 */
16383 __pyx_t_2 = (__pyx_v_have_stop != 0);
16384 if (__pyx_t_2) {
16385
16386 /* "View.MemoryView":858
16387 *
16388 * if have_stop:
16389 * if stop < 0: # <<<<<<<<<<<<<<
16390 * stop += shape
16391 * if stop < 0:
16392 */
16393 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
16394 if (__pyx_t_2) {
16395
16396 /* "View.MemoryView":859
16397 * if have_stop:
16398 * if stop < 0:
16399 * stop += shape # <<<<<<<<<<<<<<
16400 * if stop < 0:
16401 * stop = 0
16402 */
16403 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
16404
16405 /* "View.MemoryView":860
16406 * if stop < 0:
16407 * stop += shape
16408 * if stop < 0: # <<<<<<<<<<<<<<
16409 * stop = 0
16410 * elif stop > shape:
16411 */
16412 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
16413 if (__pyx_t_2) {
16414
16415 /* "View.MemoryView":861
16416 * stop += shape
16417 * if stop < 0:
16418 * stop = 0 # <<<<<<<<<<<<<<
16419 * elif stop > shape:
16420 * stop = shape
16421 */
16422 __pyx_v_stop = 0;
16423
16424 /* "View.MemoryView":860
16425 * if stop < 0:
16426 * stop += shape
16427 * if stop < 0: # <<<<<<<<<<<<<<
16428 * stop = 0
16429 * elif stop > shape:
16430 */
16431 }
16432
16433 /* "View.MemoryView":858
16434 *
16435 * if have_stop:
16436 * if stop < 0: # <<<<<<<<<<<<<<
16437 * stop += shape
16438 * if stop < 0:
16439 */
16440 goto __pyx_L17;
16441 }
16442
16443 /* "View.MemoryView":862
16444 * if stop < 0:
16445 * stop = 0
16446 * elif stop > shape: # <<<<<<<<<<<<<<
16447 * stop = shape
16448 * else:
16449 */
16450 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
16451 if (__pyx_t_2) {
16452
16453 /* "View.MemoryView":863
16454 * stop = 0
16455 * elif stop > shape:
16456 * stop = shape # <<<<<<<<<<<<<<
16457 * else:
16458 * if negative_step:
16459 */
16460 __pyx_v_stop = __pyx_v_shape;
16461
16462 /* "View.MemoryView":862
16463 * if stop < 0:
16464 * stop = 0
16465 * elif stop > shape: # <<<<<<<<<<<<<<
16466 * stop = shape
16467 * else:
16468 */
16469 }
16470 __pyx_L17:;
16471
16472 /* "View.MemoryView":857
16473 * start = 0
16474 *
16475 * if have_stop: # <<<<<<<<<<<<<<
16476 * if stop < 0:
16477 * stop += shape
16478 */
16479 goto __pyx_L16;
16480 }
16481
16482 /* "View.MemoryView":865
16483 * stop = shape
16484 * else:
16485 * if negative_step: # <<<<<<<<<<<<<<
16486 * stop = -1
16487 * else:
16488 */
16489 /*else*/ {
16490 __pyx_t_2 = (__pyx_v_negative_step != 0);
16491 if (__pyx_t_2) {
16492
16493 /* "View.MemoryView":866
16494 * else:
16495 * if negative_step:
16496 * stop = -1 # <<<<<<<<<<<<<<
16497 * else:
16498 * stop = shape
16499 */
16500 __pyx_v_stop = -1L;
16501
16502 /* "View.MemoryView":865
16503 * stop = shape
16504 * else:
16505 * if negative_step: # <<<<<<<<<<<<<<
16506 * stop = -1
16507 * else:
16508 */
16509 goto __pyx_L19;
16510 }
16511
16512 /* "View.MemoryView":868
16513 * stop = -1
16514 * else:
16515 * stop = shape # <<<<<<<<<<<<<<
16516 *
16517 * if not have_step:
16518 */
16519 /*else*/ {
16520 __pyx_v_stop = __pyx_v_shape;
16521 }
16522 __pyx_L19:;
16523 }
16524 __pyx_L16:;
16525
16526 /* "View.MemoryView":870
16527 * stop = shape
16528 *
16529 * if not have_step: # <<<<<<<<<<<<<<
16530 * step = 1
16531 *
16532 */
16533 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
16534 if (__pyx_t_2) {
16535
16536 /* "View.MemoryView":871
16537 *
16538 * if not have_step:
16539 * step = 1 # <<<<<<<<<<<<<<
16540 *
16541 *
16542 */
16543 __pyx_v_step = 1;
16544
16545 /* "View.MemoryView":870
16546 * stop = shape
16547 *
16548 * if not have_step: # <<<<<<<<<<<<<<
16549 * step = 1
16550 *
16551 */
16552 }
16553
16554 /* "View.MemoryView":875
16555 *
16556 * with cython.cdivision(True):
16557 * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
16558 *
16559 * if (stop - start) - step * new_shape:
16560 */
16561 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
16562
16563 /* "View.MemoryView":877
16564 * new_shape = (stop - start) // step
16565 *
16566 * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
16567 * new_shape += 1
16568 *
16569 */
16570 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
16571 if (__pyx_t_2) {
16572
16573 /* "View.MemoryView":878
16574 *
16575 * if (stop - start) - step * new_shape:
16576 * new_shape += 1 # <<<<<<<<<<<<<<
16577 *
16578 * if new_shape < 0:
16579 */
16580 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
16581
16582 /* "View.MemoryView":877
16583 * new_shape = (stop - start) // step
16584 *
16585 * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
16586 * new_shape += 1
16587 *
16588 */
16589 }
16590
16591 /* "View.MemoryView":880
16592 * new_shape += 1
16593 *
16594 * if new_shape < 0: # <<<<<<<<<<<<<<
16595 * new_shape = 0
16596 *
16597 */
16598 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
16599 if (__pyx_t_2) {
16600
16601 /* "View.MemoryView":881
16602 *
16603 * if new_shape < 0:
16604 * new_shape = 0 # <<<<<<<<<<<<<<
16605 *
16606 *
16607 */
16608 __pyx_v_new_shape = 0;
16609
16610 /* "View.MemoryView":880
16611 * new_shape += 1
16612 *
16613 * if new_shape < 0: # <<<<<<<<<<<<<<
16614 * new_shape = 0
16615 *
16616 */
16617 }
16618
16619 /* "View.MemoryView":884
16620 *
16621 *
16622 * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
16623 * dst.shape[new_ndim] = new_shape
16624 * dst.suboffsets[new_ndim] = suboffset
16625 */
16626 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
16627
16628 /* "View.MemoryView":885
16629 *
16630 * dst.strides[new_ndim] = stride * step
16631 * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
16632 * dst.suboffsets[new_ndim] = suboffset
16633 *
16634 */
16635 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
16636
16637 /* "View.MemoryView":886
16638 * dst.strides[new_ndim] = stride * step
16639 * dst.shape[new_ndim] = new_shape
16640 * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
16641 *
16642 *
16643 */
16644 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
16645 }
16646 __pyx_L3:;
16647
16648 /* "View.MemoryView":889
16649 *
16650 *
16651 * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
16652 * dst.data += start * stride
16653 * else:
16654 */
16655 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
16656 if (__pyx_t_2) {
16657
16658 /* "View.MemoryView":890
16659 *
16660 * if suboffset_dim[0] < 0:
16661 * dst.data += start * stride # <<<<<<<<<<<<<<
16662 * else:
16663 * dst.suboffsets[suboffset_dim[0]] += start * stride
16664 */
16665 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
16666
16667 /* "View.MemoryView":889
16668 *
16669 *
16670 * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
16671 * dst.data += start * stride
16672 * else:
16673 */
16674 goto __pyx_L23;
16675 }
16676
16677 /* "View.MemoryView":892
16678 * dst.data += start * stride
16679 * else:
16680 * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
16681 *
16682 * if suboffset >= 0:
16683 */
16684 /*else*/ {
16685 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
16686 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
16687 }
16688 __pyx_L23:;
16689
16690 /* "View.MemoryView":894
16691 * dst.suboffsets[suboffset_dim[0]] += start * stride
16692 *
16693 * if suboffset >= 0: # <<<<<<<<<<<<<<
16694 * if not is_slice:
16695 * if new_ndim == 0:
16696 */
16697 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
16698 if (__pyx_t_2) {
16699
16700 /* "View.MemoryView":895
16701 *
16702 * if suboffset >= 0:
16703 * if not is_slice: # <<<<<<<<<<<<<<
16704 * if new_ndim == 0:
16705 * dst.data = (<char **> dst.data)[0] + suboffset
16706 */
16707 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
16708 if (__pyx_t_2) {
16709
16710 /* "View.MemoryView":896
16711 * if suboffset >= 0:
16712 * if not is_slice:
16713 * if new_ndim == 0: # <<<<<<<<<<<<<<
16714 * dst.data = (<char **> dst.data)[0] + suboffset
16715 * else:
16716 */
16717 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
16718 if (__pyx_t_2) {
16719
16720 /* "View.MemoryView":897
16721 * if not is_slice:
16722 * if new_ndim == 0:
16723 * dst.data = (<char **> dst.data)[0] + suboffset # <<<<<<<<<<<<<<
16724 * else:
16725 * _err_dim(IndexError, "All dimensions preceding dimension %d "
16726 */
16727 __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
16728
16729 /* "View.MemoryView":896
16730 * if suboffset >= 0:
16731 * if not is_slice:
16732 * if new_ndim == 0: # <<<<<<<<<<<<<<
16733 * dst.data = (<char **> dst.data)[0] + suboffset
16734 * else:
16735 */
16736 goto __pyx_L26;
16737 }
16738
16739 /* "View.MemoryView":899
16740 * dst.data = (<char **> dst.data)[0] + suboffset
16741 * else:
16742 * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
16743 * "must be indexed and not sliced", dim)
16744 * else:
16745 */
16746 /*else*/ {
16747
16748 /* "View.MemoryView":900
16749 * else:
16750 * _err_dim(IndexError, "All dimensions preceding dimension %d "
16751 * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
16752 * else:
16753 * suboffset_dim[0] = new_ndim
16754 */
16755 __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)
16756 }
16757 __pyx_L26:;
16758
16759 /* "View.MemoryView":895
16760 *
16761 * if suboffset >= 0:
16762 * if not is_slice: # <<<<<<<<<<<<<<
16763 * if new_ndim == 0:
16764 * dst.data = (<char **> dst.data)[0] + suboffset
16765 */
16766 goto __pyx_L25;
16767 }
16768
16769 /* "View.MemoryView":902
16770 * "must be indexed and not sliced", dim)
16771 * else:
16772 * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
16773 *
16774 * return 0
16775 */
16776 /*else*/ {
16777 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
16778 }
16779 __pyx_L25:;
16780
16781 /* "View.MemoryView":894
16782 * dst.suboffsets[suboffset_dim[0]] += start * stride
16783 *
16784 * if suboffset >= 0: # <<<<<<<<<<<<<<
16785 * if not is_slice:
16786 * if new_ndim == 0:
16787 */
16788 }
16789
16790 /* "View.MemoryView":904
16791 * suboffset_dim[0] = new_ndim
16792 *
16793 * return 0 # <<<<<<<<<<<<<<
16794 *
16795 *
16796 */
16797 __pyx_r = 0;
16798 goto __pyx_L0;
16799
16800 /* "View.MemoryView":807
16801 *
16802 * @cname('__pyx_memoryview_slice_memviewslice')
16803 * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
16804 * __Pyx_memviewslice *dst,
16805 * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
16806 */
16807
16808 /* function exit code */
16809 __pyx_L1_error:;
16810 {
16811 #ifdef WITH_THREAD
16812 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16813 #endif
16814 __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16815 #ifdef WITH_THREAD
16816 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16817 #endif
16818 }
16819 __pyx_r = -1;
16820 __pyx_L0:;
16821 return __pyx_r;
16822}
16823
16824/* "View.MemoryView":910
16825 *
16826 * @cname('__pyx_pybuffer_index')
16827 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
16828 * Py_ssize_t dim) except NULL:
16829 * cdef Py_ssize_t shape, stride, suboffset = -1
16830 */
16831
16832static 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) {
16833 Py_ssize_t __pyx_v_shape;
16834 Py_ssize_t __pyx_v_stride;
16835 Py_ssize_t __pyx_v_suboffset;
16836 Py_ssize_t __pyx_v_itemsize;
16837 char *__pyx_v_resultp;
16838 char *__pyx_r;
16839 __Pyx_RefNannyDeclarations
16840 Py_ssize_t __pyx_t_1;
16841 int __pyx_t_2;
16842 PyObject *__pyx_t_3 = NULL;
16843 PyObject *__pyx_t_4 = NULL;
16844 int __pyx_lineno = 0;
16845 const char *__pyx_filename = NULL;
16846 int __pyx_clineno = 0;
16847 __Pyx_RefNannySetupContext("pybuffer_index", 0);
16848
16849 /* "View.MemoryView":912
16850 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
16851 * Py_ssize_t dim) except NULL:
16852 * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
16853 * cdef Py_ssize_t itemsize = view.itemsize
16854 * cdef char *resultp
16855 */
16856 __pyx_v_suboffset = -1L;
16857
16858 /* "View.MemoryView":913
16859 * Py_ssize_t dim) except NULL:
16860 * cdef Py_ssize_t shape, stride, suboffset = -1
16861 * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
16862 * cdef char *resultp
16863 *
16864 */
16865 __pyx_t_1 = __pyx_v_view->itemsize;
16866 __pyx_v_itemsize = __pyx_t_1;
16867
16868 /* "View.MemoryView":916
16869 * cdef char *resultp
16870 *
16871 * if view.ndim == 0: # <<<<<<<<<<<<<<
16872 * shape = view.len / itemsize
16873 * stride = itemsize
16874 */
16875 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
16876 if (__pyx_t_2) {
16877
16878 /* "View.MemoryView":917
16879 *
16880 * if view.ndim == 0:
16881 * shape = view.len / itemsize # <<<<<<<<<<<<<<
16882 * stride = itemsize
16883 * else:
16884 */
16885 if (unlikely(__pyx_v_itemsize == 0)) {
16886 PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
16887 __PYX_ERR(2, 917, __pyx_L1_error)
16888 }
16889 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))) {
16890 PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
16891 __PYX_ERR(2, 917, __pyx_L1_error)
16892 }
16893 __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
16894
16895 /* "View.MemoryView":918
16896 * if view.ndim == 0:
16897 * shape = view.len / itemsize
16898 * stride = itemsize # <<<<<<<<<<<<<<
16899 * else:
16900 * shape = view.shape[dim]
16901 */
16902 __pyx_v_stride = __pyx_v_itemsize;
16903
16904 /* "View.MemoryView":916
16905 * cdef char *resultp
16906 *
16907 * if view.ndim == 0: # <<<<<<<<<<<<<<
16908 * shape = view.len / itemsize
16909 * stride = itemsize
16910 */
16911 goto __pyx_L3;
16912 }
16913
16914 /* "View.MemoryView":920
16915 * stride = itemsize
16916 * else:
16917 * shape = view.shape[dim] # <<<<<<<<<<<<<<
16918 * stride = view.strides[dim]
16919 * if view.suboffsets != NULL:
16920 */
16921 /*else*/ {
16922 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
16923
16924 /* "View.MemoryView":921
16925 * else:
16926 * shape = view.shape[dim]
16927 * stride = view.strides[dim] # <<<<<<<<<<<<<<
16928 * if view.suboffsets != NULL:
16929 * suboffset = view.suboffsets[dim]
16930 */
16931 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
16932
16933 /* "View.MemoryView":922
16934 * shape = view.shape[dim]
16935 * stride = view.strides[dim]
16936 * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
16937 * suboffset = view.suboffsets[dim]
16938 *
16939 */
16940 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
16941 if (__pyx_t_2) {
16942
16943 /* "View.MemoryView":923
16944 * stride = view.strides[dim]
16945 * if view.suboffsets != NULL:
16946 * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
16947 *
16948 * if index < 0:
16949 */
16950 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
16951
16952 /* "View.MemoryView":922
16953 * shape = view.shape[dim]
16954 * stride = view.strides[dim]
16955 * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
16956 * suboffset = view.suboffsets[dim]
16957 *
16958 */
16959 }
16960 }
16961 __pyx_L3:;
16962
16963 /* "View.MemoryView":925
16964 * suboffset = view.suboffsets[dim]
16965 *
16966 * if index < 0: # <<<<<<<<<<<<<<
16967 * index += view.shape[dim]
16968 * if index < 0:
16969 */
16970 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
16971 if (__pyx_t_2) {
16972
16973 /* "View.MemoryView":926
16974 *
16975 * if index < 0:
16976 * index += view.shape[dim] # <<<<<<<<<<<<<<
16977 * if index < 0:
16978 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16979 */
16980 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
16981
16982 /* "View.MemoryView":927
16983 * if index < 0:
16984 * index += view.shape[dim]
16985 * if index < 0: # <<<<<<<<<<<<<<
16986 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16987 *
16988 */
16989 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
16990 if (unlikely(__pyx_t_2)) {
16991
16992 /* "View.MemoryView":928
16993 * index += view.shape[dim]
16994 * if index < 0:
16995 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
16996 *
16997 * if index >= shape:
16998 */
16999 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
17000 __Pyx_GOTREF(__pyx_t_3);
17001 __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)
17002 __Pyx_GOTREF(__pyx_t_4);
17003 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17004 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
17005 __Pyx_GOTREF(__pyx_t_3);
17006 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17007 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17008 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17009 __PYX_ERR(2, 928, __pyx_L1_error)
17010
17011 /* "View.MemoryView":927
17012 * if index < 0:
17013 * index += view.shape[dim]
17014 * if index < 0: # <<<<<<<<<<<<<<
17015 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17016 *
17017 */
17018 }
17019
17020 /* "View.MemoryView":925
17021 * suboffset = view.suboffsets[dim]
17022 *
17023 * if index < 0: # <<<<<<<<<<<<<<
17024 * index += view.shape[dim]
17025 * if index < 0:
17026 */
17027 }
17028
17029 /* "View.MemoryView":930
17030 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17031 *
17032 * if index >= shape: # <<<<<<<<<<<<<<
17033 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17034 *
17035 */
17036 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
17037 if (unlikely(__pyx_t_2)) {
17038
17039 /* "View.MemoryView":931
17040 *
17041 * if index >= shape:
17042 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
17043 *
17044 * resultp = bufp + index * stride
17045 */
17046 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
17047 __Pyx_GOTREF(__pyx_t_3);
17048 __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)
17049 __Pyx_GOTREF(__pyx_t_4);
17050 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17051 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
17052 __Pyx_GOTREF(__pyx_t_3);
17053 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17054 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17055 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17056 __PYX_ERR(2, 931, __pyx_L1_error)
17057
17058 /* "View.MemoryView":930
17059 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17060 *
17061 * if index >= shape: # <<<<<<<<<<<<<<
17062 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17063 *
17064 */
17065 }
17066
17067 /* "View.MemoryView":933
17068 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17069 *
17070 * resultp = bufp + index * stride # <<<<<<<<<<<<<<
17071 * if suboffset >= 0:
17072 * resultp = (<char **> resultp)[0] + suboffset
17073 */
17074 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
17075
17076 /* "View.MemoryView":934
17077 *
17078 * resultp = bufp + index * stride
17079 * if suboffset >= 0: # <<<<<<<<<<<<<<
17080 * resultp = (<char **> resultp)[0] + suboffset
17081 *
17082 */
17083 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
17084 if (__pyx_t_2) {
17085
17086 /* "View.MemoryView":935
17087 * resultp = bufp + index * stride
17088 * if suboffset >= 0:
17089 * resultp = (<char **> resultp)[0] + suboffset # <<<<<<<<<<<<<<
17090 *
17091 * return resultp
17092 */
17093 __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
17094
17095 /* "View.MemoryView":934
17096 *
17097 * resultp = bufp + index * stride
17098 * if suboffset >= 0: # <<<<<<<<<<<<<<
17099 * resultp = (<char **> resultp)[0] + suboffset
17100 *
17101 */
17102 }
17103
17104 /* "View.MemoryView":937
17105 * resultp = (<char **> resultp)[0] + suboffset
17106 *
17107 * return resultp # <<<<<<<<<<<<<<
17108 *
17109 *
17110 */
17111 __pyx_r = __pyx_v_resultp;
17112 goto __pyx_L0;
17113
17114 /* "View.MemoryView":910
17115 *
17116 * @cname('__pyx_pybuffer_index')
17117 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
17118 * Py_ssize_t dim) except NULL:
17119 * cdef Py_ssize_t shape, stride, suboffset = -1
17120 */
17121
17122 /* function exit code */
17123 __pyx_L1_error:;
17124 __Pyx_XDECREF(__pyx_t_3);
17125 __Pyx_XDECREF(__pyx_t_4);
17126 __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
17127 __pyx_r = NULL;
17128 __pyx_L0:;
17129 __Pyx_RefNannyFinishContext();
17130 return __pyx_r;
17131}
17132
17133/* "View.MemoryView":943
17134 *
17135 * @cname('__pyx_memslice_transpose')
17136 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
17137 * cdef int ndim = memslice.memview.view.ndim
17138 *
17139 */
17140
17141static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
17142 int __pyx_v_ndim;
17143 Py_ssize_t *__pyx_v_shape;
17144 Py_ssize_t *__pyx_v_strides;
17145 int __pyx_v_i;
17146 int __pyx_v_j;
17147 int __pyx_r;
17148 int __pyx_t_1;
17149 Py_ssize_t *__pyx_t_2;
17150 long __pyx_t_3;
17151 long __pyx_t_4;
17152 Py_ssize_t __pyx_t_5;
17153 Py_ssize_t __pyx_t_6;
17154 int __pyx_t_7;
17155 int __pyx_t_8;
17156 int __pyx_t_9;
17157 int __pyx_lineno = 0;
17158 const char *__pyx_filename = NULL;
17159 int __pyx_clineno = 0;
17160
17161 /* "View.MemoryView":944
17162 * @cname('__pyx_memslice_transpose')
17163 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
17164 * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
17165 *
17166 * cdef Py_ssize_t *shape = memslice.shape
17167 */
17168 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
17169 __pyx_v_ndim = __pyx_t_1;
17170
17171 /* "View.MemoryView":946
17172 * cdef int ndim = memslice.memview.view.ndim
17173 *
17174 * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
17175 * cdef Py_ssize_t *strides = memslice.strides
17176 *
17177 */
17178 __pyx_t_2 = __pyx_v_memslice->shape;
17179 __pyx_v_shape = __pyx_t_2;
17180
17181 /* "View.MemoryView":947
17182 *
17183 * cdef Py_ssize_t *shape = memslice.shape
17184 * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
17185 *
17186 *
17187 */
17188 __pyx_t_2 = __pyx_v_memslice->strides;
17189 __pyx_v_strides = __pyx_t_2;
17190
17191 /* "View.MemoryView":951
17192 *
17193 * cdef int i, j
17194 * for i in range(ndim / 2): # <<<<<<<<<<<<<<
17195 * j = ndim - 1 - i
17196 * strides[i], strides[j] = strides[j], strides[i]
17197 */
17198 __pyx_t_3 = (__pyx_v_ndim / 2);
17199 __pyx_t_4 = __pyx_t_3;
17200 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
17201 __pyx_v_i = __pyx_t_1;
17202
17203 /* "View.MemoryView":952
17204 * cdef int i, j
17205 * for i in range(ndim / 2):
17206 * j = ndim - 1 - i # <<<<<<<<<<<<<<
17207 * strides[i], strides[j] = strides[j], strides[i]
17208 * shape[i], shape[j] = shape[j], shape[i]
17209 */
17210 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
17211
17212 /* "View.MemoryView":953
17213 * for i in range(ndim / 2):
17214 * j = ndim - 1 - i
17215 * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
17216 * shape[i], shape[j] = shape[j], shape[i]
17217 *
17218 */
17219 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
17220 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
17221 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
17222 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
17223
17224 /* "View.MemoryView":954
17225 * j = ndim - 1 - i
17226 * strides[i], strides[j] = strides[j], strides[i]
17227 * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
17228 *
17229 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
17230 */
17231 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
17232 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
17233 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
17234 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
17235
17236 /* "View.MemoryView":956
17237 * shape[i], shape[j] = shape[j], shape[i]
17238 *
17239 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
17240 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
17241 *
17242 */
17243 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
17244 if (!__pyx_t_8) {
17245 } else {
17246 __pyx_t_7 = __pyx_t_8;
17247 goto __pyx_L6_bool_binop_done;
17248 }
17249 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
17250 __pyx_t_7 = __pyx_t_8;
17251 __pyx_L6_bool_binop_done:;
17252 if (__pyx_t_7) {
17253
17254 /* "View.MemoryView":957
17255 *
17256 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
17257 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
17258 *
17259 * return 1
17260 */
17261 __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)
17262
17263 /* "View.MemoryView":956
17264 * shape[i], shape[j] = shape[j], shape[i]
17265 *
17266 * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
17267 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
17268 *
17269 */
17270 }
17271 }
17272
17273 /* "View.MemoryView":959
17274 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
17275 *
17276 * return 1 # <<<<<<<<<<<<<<
17277 *
17278 *
17279 */
17280 __pyx_r = 1;
17281 goto __pyx_L0;
17282
17283 /* "View.MemoryView":943
17284 *
17285 * @cname('__pyx_memslice_transpose')
17286 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
17287 * cdef int ndim = memslice.memview.view.ndim
17288 *
17289 */
17290
17291 /* function exit code */
17292 __pyx_L1_error:;
17293 {
17294 #ifdef WITH_THREAD
17295 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17296 #endif
17297 __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17298 #ifdef WITH_THREAD
17299 __Pyx_PyGILState_Release(__pyx_gilstate_save);
17300 #endif
17301 }
17302 __pyx_r = 0;
17303 __pyx_L0:;
17304 return __pyx_r;
17305}
17306
17307/* "View.MemoryView":976
17308 * cdef int (*to_dtype_func)(char *, object) except 0
17309 *
17310 * def __dealloc__(self): # <<<<<<<<<<<<<<
17311 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
17312 *
17313 */
17314
17315/* Python wrapper */
17316static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
17317static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
17318 __Pyx_RefNannyDeclarations
17319 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
17320 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17321
17322 /* function exit code */
17323 __Pyx_RefNannyFinishContext();
17324}
17325
17326static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17327 __Pyx_RefNannyDeclarations
17328 __Pyx_RefNannySetupContext("__dealloc__", 0);
17329
17330 /* "View.MemoryView":977
17331 *
17332 * def __dealloc__(self):
17333 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
17334 *
17335 * cdef convert_item_to_object(self, char *itemp):
17336 */
17337 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
17338
17339 /* "View.MemoryView":976
17340 * cdef int (*to_dtype_func)(char *, object) except 0
17341 *
17342 * def __dealloc__(self): # <<<<<<<<<<<<<<
17343 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
17344 *
17345 */
17346
17347 /* function exit code */
17348 __Pyx_RefNannyFinishContext();
17349}
17350
17351/* "View.MemoryView":979
17352 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
17353 *
17354 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
17355 * if self.to_object_func != NULL:
17356 * return self.to_object_func(itemp)
17357 */
17358
17359static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
17360 PyObject *__pyx_r = NULL;
17361 __Pyx_RefNannyDeclarations
17362 int __pyx_t_1;
17363 PyObject *__pyx_t_2 = NULL;
17364 int __pyx_lineno = 0;
17365 const char *__pyx_filename = NULL;
17366 int __pyx_clineno = 0;
17367 __Pyx_RefNannySetupContext("convert_item_to_object", 0);
17368
17369 /* "View.MemoryView":980
17370 *
17371 * cdef convert_item_to_object(self, char *itemp):
17372 * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
17373 * return self.to_object_func(itemp)
17374 * else:
17375 */
17376 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
17377 if (__pyx_t_1) {
17378
17379 /* "View.MemoryView":981
17380 * cdef convert_item_to_object(self, char *itemp):
17381 * if self.to_object_func != NULL:
17382 * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
17383 * else:
17384 * return memoryview.convert_item_to_object(self, itemp)
17385 */
17386 __Pyx_XDECREF(__pyx_r);
17387 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
17388 __Pyx_GOTREF(__pyx_t_2);
17389 __pyx_r = __pyx_t_2;
17390 __pyx_t_2 = 0;
17391 goto __pyx_L0;
17392
17393 /* "View.MemoryView":980
17394 *
17395 * cdef convert_item_to_object(self, char *itemp):
17396 * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
17397 * return self.to_object_func(itemp)
17398 * else:
17399 */
17400 }
17401
17402 /* "View.MemoryView":983
17403 * return self.to_object_func(itemp)
17404 * else:
17405 * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
17406 *
17407 * cdef assign_item_from_object(self, char *itemp, object value):
17408 */
17409 /*else*/ {
17410 __Pyx_XDECREF(__pyx_r);
17411 __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)
17412 __Pyx_GOTREF(__pyx_t_2);
17413 __pyx_r = __pyx_t_2;
17414 __pyx_t_2 = 0;
17415 goto __pyx_L0;
17416 }
17417
17418 /* "View.MemoryView":979
17419 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
17420 *
17421 * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
17422 * if self.to_object_func != NULL:
17423 * return self.to_object_func(itemp)
17424 */
17425
17426 /* function exit code */
17427 __pyx_L1_error:;
17428 __Pyx_XDECREF(__pyx_t_2);
17429 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
17430 __pyx_r = 0;
17431 __pyx_L0:;
17432 __Pyx_XGIVEREF(__pyx_r);
17433 __Pyx_RefNannyFinishContext();
17434 return __pyx_r;
17435}
17436
17437/* "View.MemoryView":985
17438 * return memoryview.convert_item_to_object(self, itemp)
17439 *
17440 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
17441 * if self.to_dtype_func != NULL:
17442 * self.to_dtype_func(itemp, value)
17443 */
17444
17445static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
17446 PyObject *__pyx_r = NULL;
17447 __Pyx_RefNannyDeclarations
17448 int __pyx_t_1;
17449 int __pyx_t_2;
17450 PyObject *__pyx_t_3 = NULL;
17451 int __pyx_lineno = 0;
17452 const char *__pyx_filename = NULL;
17453 int __pyx_clineno = 0;
17454 __Pyx_RefNannySetupContext("assign_item_from_object", 0);
17455
17456 /* "View.MemoryView":986
17457 *
17458 * cdef assign_item_from_object(self, char *itemp, object value):
17459 * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
17460 * self.to_dtype_func(itemp, value)
17461 * else:
17462 */
17463 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
17464 if (__pyx_t_1) {
17465
17466 /* "View.MemoryView":987
17467 * cdef assign_item_from_object(self, char *itemp, object value):
17468 * if self.to_dtype_func != NULL:
17469 * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
17470 * else:
17471 * memoryview.assign_item_from_object(self, itemp, value)
17472 */
17473 __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)
17474
17475 /* "View.MemoryView":986
17476 *
17477 * cdef assign_item_from_object(self, char *itemp, object value):
17478 * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
17479 * self.to_dtype_func(itemp, value)
17480 * else:
17481 */
17482 goto __pyx_L3;
17483 }
17484
17485 /* "View.MemoryView":989
17486 * self.to_dtype_func(itemp, value)
17487 * else:
17488 * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
17489 *
17490 * @property
17491 */
17492 /*else*/ {
17493 __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)
17494 __Pyx_GOTREF(__pyx_t_3);
17495 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17496 }
17497 __pyx_L3:;
17498
17499 /* "View.MemoryView":985
17500 * return memoryview.convert_item_to_object(self, itemp)
17501 *
17502 * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
17503 * if self.to_dtype_func != NULL:
17504 * self.to_dtype_func(itemp, value)
17505 */
17506
17507 /* function exit code */
17508 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17509 goto __pyx_L0;
17510 __pyx_L1_error:;
17511 __Pyx_XDECREF(__pyx_t_3);
17512 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
17513 __pyx_r = 0;
17514 __pyx_L0:;
17515 __Pyx_XGIVEREF(__pyx_r);
17516 __Pyx_RefNannyFinishContext();
17517 return __pyx_r;
17518}
17519
17520/* "View.MemoryView":992
17521 *
17522 * @property
17523 * def base(self): # <<<<<<<<<<<<<<
17524 * return self.from_object
17525 *
17526 */
17527
17528/* Python wrapper */
17529static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
17530static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
17531 PyObject *__pyx_r = 0;
17532 __Pyx_RefNannyDeclarations
17533 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
17534 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17535
17536 /* function exit code */
17537 __Pyx_RefNannyFinishContext();
17538 return __pyx_r;
17539}
17540
17541static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17542 PyObject *__pyx_r = NULL;
17543 __Pyx_RefNannyDeclarations
17544 __Pyx_RefNannySetupContext("__get__", 0);
17545
17546 /* "View.MemoryView":993
17547 * @property
17548 * def base(self):
17549 * return self.from_object # <<<<<<<<<<<<<<
17550 *
17551 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
17552 */
17553 __Pyx_XDECREF(__pyx_r);
17554 __Pyx_INCREF(__pyx_v_self->from_object);
17555 __pyx_r = __pyx_v_self->from_object;
17556 goto __pyx_L0;
17557
17558 /* "View.MemoryView":992
17559 *
17560 * @property
17561 * def base(self): # <<<<<<<<<<<<<<
17562 * return self.from_object
17563 *
17564 */
17565
17566 /* function exit code */
17567 __pyx_L0:;
17568 __Pyx_XGIVEREF(__pyx_r);
17569 __Pyx_RefNannyFinishContext();
17570 return __pyx_r;
17571}
17572
17573/* "(tree fragment)":1
17574 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
17575 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17576 * def __setstate_cython__(self, __pyx_state):
17577 */
17578
17579/* Python wrapper */
17580static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
17581static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
17582 PyObject *__pyx_r = 0;
17583 __Pyx_RefNannyDeclarations
17584 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
17585 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17586
17587 /* function exit code */
17588 __Pyx_RefNannyFinishContext();
17589 return __pyx_r;
17590}
17591
17592static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17593 PyObject *__pyx_r = NULL;
17594 __Pyx_RefNannyDeclarations
17595 PyObject *__pyx_t_1 = NULL;
17596 int __pyx_lineno = 0;
17597 const char *__pyx_filename = NULL;
17598 int __pyx_clineno = 0;
17599 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
17600
17601 /* "(tree fragment)":2
17602 * def __reduce_cython__(self):
17603 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
17604 * def __setstate_cython__(self, __pyx_state):
17605 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17606 */
17607 __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)
17608 __Pyx_GOTREF(__pyx_t_1);
17609 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17610 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17611 __PYX_ERR(2, 2, __pyx_L1_error)
17612
17613 /* "(tree fragment)":1
17614 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
17615 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17616 * def __setstate_cython__(self, __pyx_state):
17617 */
17618
17619 /* function exit code */
17620 __pyx_L1_error:;
17621 __Pyx_XDECREF(__pyx_t_1);
17622 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17623 __pyx_r = NULL;
17624 __Pyx_XGIVEREF(__pyx_r);
17625 __Pyx_RefNannyFinishContext();
17626 return __pyx_r;
17627}
17628
17629/* "(tree fragment)":3
17630 * def __reduce_cython__(self):
17631 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17632 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
17633 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17634 */
17635
17636/* Python wrapper */
17637static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
17638static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
17639 PyObject *__pyx_r = 0;
17640 __Pyx_RefNannyDeclarations
17641 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
17642 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
17643
17644 /* function exit code */
17645 __Pyx_RefNannyFinishContext();
17646 return __pyx_r;
17647}
17648
17649static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
17650 PyObject *__pyx_r = NULL;
17651 __Pyx_RefNannyDeclarations
17652 PyObject *__pyx_t_1 = NULL;
17653 int __pyx_lineno = 0;
17654 const char *__pyx_filename = NULL;
17655 int __pyx_clineno = 0;
17656 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
17657
17658 /* "(tree fragment)":4
17659 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17660 * def __setstate_cython__(self, __pyx_state):
17661 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
17662 */
17663 __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)
17664 __Pyx_GOTREF(__pyx_t_1);
17665 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17666 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17667 __PYX_ERR(2, 4, __pyx_L1_error)
17668
17669 /* "(tree fragment)":3
17670 * def __reduce_cython__(self):
17671 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17672 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
17673 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
17674 */
17675
17676 /* function exit code */
17677 __pyx_L1_error:;
17678 __Pyx_XDECREF(__pyx_t_1);
17679 __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17680 __pyx_r = NULL;
17681 __Pyx_XGIVEREF(__pyx_r);
17682 __Pyx_RefNannyFinishContext();
17683 return __pyx_r;
17684}
17685
17686/* "View.MemoryView":999
17687 *
17688 * @cname('__pyx_memoryview_fromslice')
17689 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
17690 * int ndim,
17691 * object (*to_object_func)(char *),
17692 */
17693
17694static 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) {
17695 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
17696 Py_ssize_t __pyx_v_suboffset;
17697 PyObject *__pyx_v_length = NULL;
17698 PyObject *__pyx_r = NULL;
17699 __Pyx_RefNannyDeclarations
17700 int __pyx_t_1;
17701 PyObject *__pyx_t_2 = NULL;
17702 PyObject *__pyx_t_3 = NULL;
17703 __Pyx_TypeInfo *__pyx_t_4;
17704 Py_buffer __pyx_t_5;
17705 Py_ssize_t *__pyx_t_6;
17706 Py_ssize_t *__pyx_t_7;
17707 Py_ssize_t *__pyx_t_8;
17708 Py_ssize_t __pyx_t_9;
17709 int __pyx_lineno = 0;
17710 const char *__pyx_filename = NULL;
17711 int __pyx_clineno = 0;
17712 __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
17713
17714 /* "View.MemoryView":1007
17715 * cdef _memoryviewslice result
17716 *
17717 * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
17718 * return None
17719 *
17720 */
17721 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
17722 if (__pyx_t_1) {
17723
17724 /* "View.MemoryView":1008
17725 *
17726 * if <PyObject *> memviewslice.memview == Py_None:
17727 * return None # <<<<<<<<<<<<<<
17728 *
17729 *
17730 */
17731 __Pyx_XDECREF(__pyx_r);
17732 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17733 goto __pyx_L0;
17734
17735 /* "View.MemoryView":1007
17736 * cdef _memoryviewslice result
17737 *
17738 * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
17739 * return None
17740 *
17741 */
17742 }
17743
17744 /* "View.MemoryView":1013
17745 *
17746 *
17747 * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<<
17748 *
17749 * result.from_slice = memviewslice
17750 */
17751 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
17752 __Pyx_GOTREF(__pyx_t_2);
17753 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
17754 __Pyx_GOTREF(__pyx_t_3);
17755 __Pyx_INCREF(Py_None);
17756 __Pyx_GIVEREF(Py_None);
17757 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
17758 __Pyx_INCREF(__pyx_int_0);
17759 __Pyx_GIVEREF(__pyx_int_0);
17760 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
17761 __Pyx_GIVEREF(__pyx_t_2);
17762 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
17763 __pyx_t_2 = 0;
17764 __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)
17765 __Pyx_GOTREF(__pyx_t_2);
17766 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17767 __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
17768 __pyx_t_2 = 0;
17769
17770 /* "View.MemoryView":1015
17771 * result = _memoryviewslice(None, 0, dtype_is_object)
17772 *
17773 * result.from_slice = memviewslice # <<<<<<<<<<<<<<
17774 * __PYX_INC_MEMVIEW(&memviewslice, 1)
17775 *
17776 */
17777 __pyx_v_result->from_slice = __pyx_v_memviewslice;
17778
17779 /* "View.MemoryView":1016
17780 *
17781 * result.from_slice = memviewslice
17782 * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
17783 *
17784 * result.from_object = (<memoryview> memviewslice.memview).base
17785 */
17786 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
17787
17788 /* "View.MemoryView":1018
17789 * __PYX_INC_MEMVIEW(&memviewslice, 1)
17790 *
17791 * result.from_object = (<memoryview> memviewslice.memview).base # <<<<<<<<<<<<<<
17792 * result.typeinfo = memviewslice.memview.typeinfo
17793 *
17794 */
17795 __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)
17796 __Pyx_GOTREF(__pyx_t_2);
17797 __Pyx_GIVEREF(__pyx_t_2);
17798 __Pyx_GOTREF(__pyx_v_result->from_object);
17799 __Pyx_DECREF(__pyx_v_result->from_object);
17800 __pyx_v_result->from_object = __pyx_t_2;
17801 __pyx_t_2 = 0;
17802
17803 /* "View.MemoryView":1019
17804 *
17805 * result.from_object = (<memoryview> memviewslice.memview).base
17806 * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
17807 *
17808 * result.view = memviewslice.memview.view
17809 */
17810 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
17811 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
17812
17813 /* "View.MemoryView":1021
17814 * result.typeinfo = memviewslice.memview.typeinfo
17815 *
17816 * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
17817 * result.view.buf = <void *> memviewslice.data
17818 * result.view.ndim = ndim
17819 */
17820 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
17821 __pyx_v_result->__pyx_base.view = __pyx_t_5;
17822
17823 /* "View.MemoryView":1022
17824 *
17825 * result.view = memviewslice.memview.view
17826 * result.view.buf = <void *> memviewslice.data # <<<<<<<<<<<<<<
17827 * result.view.ndim = ndim
17828 * (<__pyx_buffer *> &result.view).obj = Py_None
17829 */
17830 __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
17831
17832 /* "View.MemoryView":1023
17833 * result.view = memviewslice.memview.view
17834 * result.view.buf = <void *> memviewslice.data
17835 * result.view.ndim = ndim # <<<<<<<<<<<<<<
17836 * (<__pyx_buffer *> &result.view).obj = Py_None
17837 * Py_INCREF(Py_None)
17838 */
17839 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
17840
17841 /* "View.MemoryView":1024
17842 * result.view.buf = <void *> memviewslice.data
17843 * result.view.ndim = ndim
17844 * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
17845 * Py_INCREF(Py_None)
17846 *
17847 */
17848 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
17849
17850 /* "View.MemoryView":1025
17851 * result.view.ndim = ndim
17852 * (<__pyx_buffer *> &result.view).obj = Py_None
17853 * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
17854 *
17855 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
17856 */
17857 Py_INCREF(Py_None);
17858
17859 /* "View.MemoryView":1027
17860 * Py_INCREF(Py_None)
17861 *
17862 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
17863 * result.flags = PyBUF_RECORDS
17864 * else:
17865 */
17866 __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
17867 if (__pyx_t_1) {
17868
17869 /* "View.MemoryView":1028
17870 *
17871 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
17872 * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
17873 * else:
17874 * result.flags = PyBUF_RECORDS_RO
17875 */
17876 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
17877
17878 /* "View.MemoryView":1027
17879 * Py_INCREF(Py_None)
17880 *
17881 * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
17882 * result.flags = PyBUF_RECORDS
17883 * else:
17884 */
17885 goto __pyx_L4;
17886 }
17887
17888 /* "View.MemoryView":1030
17889 * result.flags = PyBUF_RECORDS
17890 * else:
17891 * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
17892 *
17893 * result.view.shape = <Py_ssize_t *> result.from_slice.shape
17894 */
17895 /*else*/ {
17896 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
17897 }
17898 __pyx_L4:;
17899
17900 /* "View.MemoryView":1032
17901 * result.flags = PyBUF_RECORDS_RO
17902 *
17903 * result.view.shape = <Py_ssize_t *> result.from_slice.shape # <<<<<<<<<<<<<<
17904 * result.view.strides = <Py_ssize_t *> result.from_slice.strides
17905 *
17906 */
17907 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
17908
17909 /* "View.MemoryView":1033
17910 *
17911 * result.view.shape = <Py_ssize_t *> result.from_slice.shape
17912 * result.view.strides = <Py_ssize_t *> result.from_slice.strides # <<<<<<<<<<<<<<
17913 *
17914 *
17915 */
17916 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
17917
17918 /* "View.MemoryView":1036
17919 *
17920 *
17921 * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
17922 * for suboffset in result.from_slice.suboffsets[:ndim]:
17923 * if suboffset >= 0:
17924 */
17925 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
17926
17927 /* "View.MemoryView":1037
17928 *
17929 * result.view.suboffsets = NULL
17930 * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
17931 * if suboffset >= 0:
17932 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
17933 */
17934 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
17935 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
17936 __pyx_t_6 = __pyx_t_8;
17937 __pyx_v_suboffset = (__pyx_t_6[0]);
17938
17939 /* "View.MemoryView":1038
17940 * result.view.suboffsets = NULL
17941 * for suboffset in result.from_slice.suboffsets[:ndim]:
17942 * if suboffset >= 0: # <<<<<<<<<<<<<<
17943 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
17944 * break
17945 */
17946 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
17947 if (__pyx_t_1) {
17948
17949 /* "View.MemoryView":1039
17950 * for suboffset in result.from_slice.suboffsets[:ndim]:
17951 * if suboffset >= 0:
17952 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets # <<<<<<<<<<<<<<
17953 * break
17954 *
17955 */
17956 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
17957
17958 /* "View.MemoryView":1040
17959 * if suboffset >= 0:
17960 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
17961 * break # <<<<<<<<<<<<<<
17962 *
17963 * result.view.len = result.view.itemsize
17964 */
17965 goto __pyx_L6_break;
17966
17967 /* "View.MemoryView":1038
17968 * result.view.suboffsets = NULL
17969 * for suboffset in result.from_slice.suboffsets[:ndim]:
17970 * if suboffset >= 0: # <<<<<<<<<<<<<<
17971 * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
17972 * break
17973 */
17974 }
17975 }
17976 __pyx_L6_break:;
17977
17978 /* "View.MemoryView":1042
17979 * break
17980 *
17981 * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
17982 * for length in result.view.shape[:ndim]:
17983 * result.view.len *= length
17984 */
17985 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
17986 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
17987
17988 /* "View.MemoryView":1043
17989 *
17990 * result.view.len = result.view.itemsize
17991 * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
17992 * result.view.len *= length
17993 *
17994 */
17995 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
17996 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
17997 __pyx_t_6 = __pyx_t_8;
17998 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
17999 __Pyx_GOTREF(__pyx_t_2);
18000 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
18001 __pyx_t_2 = 0;
18002
18003 /* "View.MemoryView":1044
18004 * result.view.len = result.view.itemsize
18005 * for length in result.view.shape[:ndim]:
18006 * result.view.len *= length # <<<<<<<<<<<<<<
18007 *
18008 * result.to_object_func = to_object_func
18009 */
18010 __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)
18011 __Pyx_GOTREF(__pyx_t_2);
18012 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
18013 __Pyx_GOTREF(__pyx_t_3);
18014 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18015 __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)
18016 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18017 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
18018 }
18019
18020 /* "View.MemoryView":1046
18021 * result.view.len *= length
18022 *
18023 * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
18024 * result.to_dtype_func = to_dtype_func
18025 *
18026 */
18027 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
18028
18029 /* "View.MemoryView":1047
18030 *
18031 * result.to_object_func = to_object_func
18032 * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
18033 *
18034 * return result
18035 */
18036 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
18037
18038 /* "View.MemoryView":1049
18039 * result.to_dtype_func = to_dtype_func
18040 *
18041 * return result # <<<<<<<<<<<<<<
18042 *
18043 * @cname('__pyx_memoryview_get_slice_from_memoryview')
18044 */
18045 __Pyx_XDECREF(__pyx_r);
18046 __Pyx_INCREF(((PyObject *)__pyx_v_result));
18047 __pyx_r = ((PyObject *)__pyx_v_result);
18048 goto __pyx_L0;
18049
18050 /* "View.MemoryView":999
18051 *
18052 * @cname('__pyx_memoryview_fromslice')
18053 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
18054 * int ndim,
18055 * object (*to_object_func)(char *),
18056 */
18057
18058 /* function exit code */
18059 __pyx_L1_error:;
18060 __Pyx_XDECREF(__pyx_t_2);
18061 __Pyx_XDECREF(__pyx_t_3);
18062 __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18063 __pyx_r = 0;
18064 __pyx_L0:;
18065 __Pyx_XDECREF((PyObject *)__pyx_v_result);
18066 __Pyx_XDECREF(__pyx_v_length);
18067 __Pyx_XGIVEREF(__pyx_r);
18068 __Pyx_RefNannyFinishContext();
18069 return __pyx_r;
18070}
18071
18072/* "View.MemoryView":1052
18073 *
18074 * @cname('__pyx_memoryview_get_slice_from_memoryview')
18075 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
18076 * __Pyx_memviewslice *mslice) except NULL:
18077 * cdef _memoryviewslice obj
18078 */
18079
18080static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
18081 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
18082 __Pyx_memviewslice *__pyx_r;
18083 __Pyx_RefNannyDeclarations
18084 int __pyx_t_1;
18085 int __pyx_t_2;
18086 PyObject *__pyx_t_3 = NULL;
18087 int __pyx_lineno = 0;
18088 const char *__pyx_filename = NULL;
18089 int __pyx_clineno = 0;
18090 __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
18091
18092 /* "View.MemoryView":1055
18093 * __Pyx_memviewslice *mslice) except NULL:
18094 * cdef _memoryviewslice obj
18095 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
18096 * obj = memview
18097 * return &obj.from_slice
18098 */
18099 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
18100 __pyx_t_2 = (__pyx_t_1 != 0);
18101 if (__pyx_t_2) {
18102
18103 /* "View.MemoryView":1056
18104 * cdef _memoryviewslice obj
18105 * if isinstance(memview, _memoryviewslice):
18106 * obj = memview # <<<<<<<<<<<<<<
18107 * return &obj.from_slice
18108 * else:
18109 */
18110 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)
18111 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
18112 __Pyx_INCREF(__pyx_t_3);
18113 __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
18114 __pyx_t_3 = 0;
18115
18116 /* "View.MemoryView":1057
18117 * if isinstance(memview, _memoryviewslice):
18118 * obj = memview
18119 * return &obj.from_slice # <<<<<<<<<<<<<<
18120 * else:
18121 * slice_copy(memview, mslice)
18122 */
18123 __pyx_r = (&__pyx_v_obj->from_slice);
18124 goto __pyx_L0;
18125
18126 /* "View.MemoryView":1055
18127 * __Pyx_memviewslice *mslice) except NULL:
18128 * cdef _memoryviewslice obj
18129 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
18130 * obj = memview
18131 * return &obj.from_slice
18132 */
18133 }
18134
18135 /* "View.MemoryView":1059
18136 * return &obj.from_slice
18137 * else:
18138 * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
18139 * return mslice
18140 *
18141 */
18142 /*else*/ {
18143 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
18144
18145 /* "View.MemoryView":1060
18146 * else:
18147 * slice_copy(memview, mslice)
18148 * return mslice # <<<<<<<<<<<<<<
18149 *
18150 * @cname('__pyx_memoryview_slice_copy')
18151 */
18152 __pyx_r = __pyx_v_mslice;
18153 goto __pyx_L0;
18154 }
18155
18156 /* "View.MemoryView":1052
18157 *
18158 * @cname('__pyx_memoryview_get_slice_from_memoryview')
18159 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
18160 * __Pyx_memviewslice *mslice) except NULL:
18161 * cdef _memoryviewslice obj
18162 */
18163
18164 /* function exit code */
18165 __pyx_L1_error:;
18166 __Pyx_XDECREF(__pyx_t_3);
18167 __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
18168 __pyx_r = NULL;
18169 __pyx_L0:;
18170 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
18171 __Pyx_RefNannyFinishContext();
18172 return __pyx_r;
18173}
18174
18175/* "View.MemoryView":1063
18176 *
18177 * @cname('__pyx_memoryview_slice_copy')
18178 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
18179 * cdef int dim
18180 * cdef (Py_ssize_t*) shape, strides, suboffsets
18181 */
18182
18183static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
18184 int __pyx_v_dim;
18185 Py_ssize_t *__pyx_v_shape;
18186 Py_ssize_t *__pyx_v_strides;
18187 Py_ssize_t *__pyx_v_suboffsets;
18188 __Pyx_RefNannyDeclarations
18189 Py_ssize_t *__pyx_t_1;
18190 int __pyx_t_2;
18191 int __pyx_t_3;
18192 int __pyx_t_4;
18193 Py_ssize_t __pyx_t_5;
18194 __Pyx_RefNannySetupContext("slice_copy", 0);
18195
18196 /* "View.MemoryView":1067
18197 * cdef (Py_ssize_t*) shape, strides, suboffsets
18198 *
18199 * shape = memview.view.shape # <<<<<<<<<<<<<<
18200 * strides = memview.view.strides
18201 * suboffsets = memview.view.suboffsets
18202 */
18203 __pyx_t_1 = __pyx_v_memview->view.shape;
18204 __pyx_v_shape = __pyx_t_1;
18205
18206 /* "View.MemoryView":1068
18207 *
18208 * shape = memview.view.shape
18209 * strides = memview.view.strides # <<<<<<<<<<<<<<
18210 * suboffsets = memview.view.suboffsets
18211 *
18212 */
18213 __pyx_t_1 = __pyx_v_memview->view.strides;
18214 __pyx_v_strides = __pyx_t_1;
18215
18216 /* "View.MemoryView":1069
18217 * shape = memview.view.shape
18218 * strides = memview.view.strides
18219 * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
18220 *
18221 * dst.memview = <__pyx_memoryview *> memview
18222 */
18223 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
18224 __pyx_v_suboffsets = __pyx_t_1;
18225
18226 /* "View.MemoryView":1071
18227 * suboffsets = memview.view.suboffsets
18228 *
18229 * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
18230 * dst.data = <char *> memview.view.buf
18231 *
18232 */
18233 __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
18234
18235 /* "View.MemoryView":1072
18236 *
18237 * dst.memview = <__pyx_memoryview *> memview
18238 * dst.data = <char *> memview.view.buf # <<<<<<<<<<<<<<
18239 *
18240 * for dim in range(memview.view.ndim):
18241 */
18242 __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
18243
18244 /* "View.MemoryView":1074
18245 * dst.data = <char *> memview.view.buf
18246 *
18247 * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
18248 * dst.shape[dim] = shape[dim]
18249 * dst.strides[dim] = strides[dim]
18250 */
18251 __pyx_t_2 = __pyx_v_memview->view.ndim;
18252 __pyx_t_3 = __pyx_t_2;
18253 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18254 __pyx_v_dim = __pyx_t_4;
18255
18256 /* "View.MemoryView":1075
18257 *
18258 * for dim in range(memview.view.ndim):
18259 * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
18260 * dst.strides[dim] = strides[dim]
18261 * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
18262 */
18263 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
18264
18265 /* "View.MemoryView":1076
18266 * for dim in range(memview.view.ndim):
18267 * dst.shape[dim] = shape[dim]
18268 * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
18269 * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
18270 *
18271 */
18272 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
18273
18274 /* "View.MemoryView":1077
18275 * dst.shape[dim] = shape[dim]
18276 * dst.strides[dim] = strides[dim]
18277 * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
18278 *
18279 * @cname('__pyx_memoryview_copy_object')
18280 */
18281 if ((__pyx_v_suboffsets != 0)) {
18282 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
18283 } else {
18284 __pyx_t_5 = -1L;
18285 }
18286 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
18287 }
18288
18289 /* "View.MemoryView":1063
18290 *
18291 * @cname('__pyx_memoryview_slice_copy')
18292 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
18293 * cdef int dim
18294 * cdef (Py_ssize_t*) shape, strides, suboffsets
18295 */
18296
18297 /* function exit code */
18298 __Pyx_RefNannyFinishContext();
18299}
18300
18301/* "View.MemoryView":1080
18302 *
18303 * @cname('__pyx_memoryview_copy_object')
18304 * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
18305 * "Create a new memoryview object"
18306 * cdef __Pyx_memviewslice memviewslice
18307 */
18308
18309static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
18310 __Pyx_memviewslice __pyx_v_memviewslice;
18311 PyObject *__pyx_r = NULL;
18312 __Pyx_RefNannyDeclarations
18313 PyObject *__pyx_t_1 = NULL;
18314 int __pyx_lineno = 0;
18315 const char *__pyx_filename = NULL;
18316 int __pyx_clineno = 0;
18317 __Pyx_RefNannySetupContext("memoryview_copy", 0);
18318
18319 /* "View.MemoryView":1083
18320 * "Create a new memoryview object"
18321 * cdef __Pyx_memviewslice memviewslice
18322 * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
18323 * return memoryview_copy_from_slice(memview, &memviewslice)
18324 *
18325 */
18326 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
18327
18328 /* "View.MemoryView":1084
18329 * cdef __Pyx_memviewslice memviewslice
18330 * slice_copy(memview, &memviewslice)
18331 * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
18332 *
18333 * @cname('__pyx_memoryview_copy_object_from_slice')
18334 */
18335 __Pyx_XDECREF(__pyx_r);
18336 __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)
18337 __Pyx_GOTREF(__pyx_t_1);
18338 __pyx_r = __pyx_t_1;
18339 __pyx_t_1 = 0;
18340 goto __pyx_L0;
18341
18342 /* "View.MemoryView":1080
18343 *
18344 * @cname('__pyx_memoryview_copy_object')
18345 * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
18346 * "Create a new memoryview object"
18347 * cdef __Pyx_memviewslice memviewslice
18348 */
18349
18350 /* function exit code */
18351 __pyx_L1_error:;
18352 __Pyx_XDECREF(__pyx_t_1);
18353 __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
18354 __pyx_r = 0;
18355 __pyx_L0:;
18356 __Pyx_XGIVEREF(__pyx_r);
18357 __Pyx_RefNannyFinishContext();
18358 return __pyx_r;
18359}
18360
18361/* "View.MemoryView":1087
18362 *
18363 * @cname('__pyx_memoryview_copy_object_from_slice')
18364 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
18365 * """
18366 * Create a new memoryview object from a given memoryview object and slice.
18367 */
18368
18369static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
18370 PyObject *(*__pyx_v_to_object_func)(char *);
18371 int (*__pyx_v_to_dtype_func)(char *, PyObject *);
18372 PyObject *__pyx_r = NULL;
18373 __Pyx_RefNannyDeclarations
18374 int __pyx_t_1;
18375 int __pyx_t_2;
18376 PyObject *(*__pyx_t_3)(char *);
18377 int (*__pyx_t_4)(char *, PyObject *);
18378 PyObject *__pyx_t_5 = NULL;
18379 int __pyx_lineno = 0;
18380 const char *__pyx_filename = NULL;
18381 int __pyx_clineno = 0;
18382 __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
18383
18384 /* "View.MemoryView":1094
18385 * cdef int (*to_dtype_func)(char *, object) except 0
18386 *
18387 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
18388 * to_object_func = (<_memoryviewslice> memview).to_object_func
18389 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
18390 */
18391 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
18392 __pyx_t_2 = (__pyx_t_1 != 0);
18393 if (__pyx_t_2) {
18394
18395 /* "View.MemoryView":1095
18396 *
18397 * if isinstance(memview, _memoryviewslice):
18398 * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
18399 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
18400 * else:
18401 */
18402 __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
18403 __pyx_v_to_object_func = __pyx_t_3;
18404
18405 /* "View.MemoryView":1096
18406 * if isinstance(memview, _memoryviewslice):
18407 * to_object_func = (<_memoryviewslice> memview).to_object_func
18408 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
18409 * else:
18410 * to_object_func = NULL
18411 */
18412 __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
18413 __pyx_v_to_dtype_func = __pyx_t_4;
18414
18415 /* "View.MemoryView":1094
18416 * cdef int (*to_dtype_func)(char *, object) except 0
18417 *
18418 * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
18419 * to_object_func = (<_memoryviewslice> memview).to_object_func
18420 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
18421 */
18422 goto __pyx_L3;
18423 }
18424
18425 /* "View.MemoryView":1098
18426 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
18427 * else:
18428 * to_object_func = NULL # <<<<<<<<<<<<<<
18429 * to_dtype_func = NULL
18430 *
18431 */
18432 /*else*/ {
18433 __pyx_v_to_object_func = NULL;
18434
18435 /* "View.MemoryView":1099
18436 * else:
18437 * to_object_func = NULL
18438 * to_dtype_func = NULL # <<<<<<<<<<<<<<
18439 *
18440 * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
18441 */
18442 __pyx_v_to_dtype_func = NULL;
18443 }
18444 __pyx_L3:;
18445
18446 /* "View.MemoryView":1101
18447 * to_dtype_func = NULL
18448 *
18449 * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
18450 * to_object_func, to_dtype_func,
18451 * memview.dtype_is_object)
18452 */
18453 __Pyx_XDECREF(__pyx_r);
18454
18455 /* "View.MemoryView":1103
18456 * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
18457 * to_object_func, to_dtype_func,
18458 * memview.dtype_is_object) # <<<<<<<<<<<<<<
18459 *
18460 *
18461 */
18462 __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)
18463 __Pyx_GOTREF(__pyx_t_5);
18464 __pyx_r = __pyx_t_5;
18465 __pyx_t_5 = 0;
18466 goto __pyx_L0;
18467
18468 /* "View.MemoryView":1087
18469 *
18470 * @cname('__pyx_memoryview_copy_object_from_slice')
18471 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
18472 * """
18473 * Create a new memoryview object from a given memoryview object and slice.
18474 */
18475
18476 /* function exit code */
18477 __pyx_L1_error:;
18478 __Pyx_XDECREF(__pyx_t_5);
18479 __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18480 __pyx_r = 0;
18481 __pyx_L0:;
18482 __Pyx_XGIVEREF(__pyx_r);
18483 __Pyx_RefNannyFinishContext();
18484 return __pyx_r;
18485}
18486
18487/* "View.MemoryView":1109
18488 *
18489 *
18490 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
18491 * if arg < 0:
18492 * return -arg
18493 */
18494
18495static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
18496 Py_ssize_t __pyx_r;
18497 int __pyx_t_1;
18498
18499 /* "View.MemoryView":1110
18500 *
18501 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
18502 * if arg < 0: # <<<<<<<<<<<<<<
18503 * return -arg
18504 * else:
18505 */
18506 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
18507 if (__pyx_t_1) {
18508
18509 /* "View.MemoryView":1111
18510 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
18511 * if arg < 0:
18512 * return -arg # <<<<<<<<<<<<<<
18513 * else:
18514 * return arg
18515 */
18516 __pyx_r = (-__pyx_v_arg);
18517 goto __pyx_L0;
18518
18519 /* "View.MemoryView":1110
18520 *
18521 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
18522 * if arg < 0: # <<<<<<<<<<<<<<
18523 * return -arg
18524 * else:
18525 */
18526 }
18527
18528 /* "View.MemoryView":1113
18529 * return -arg
18530 * else:
18531 * return arg # <<<<<<<<<<<<<<
18532 *
18533 * @cname('__pyx_get_best_slice_order')
18534 */
18535 /*else*/ {
18536 __pyx_r = __pyx_v_arg;
18537 goto __pyx_L0;
18538 }
18539
18540 /* "View.MemoryView":1109
18541 *
18542 *
18543 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
18544 * if arg < 0:
18545 * return -arg
18546 */
18547
18548 /* function exit code */
18549 __pyx_L0:;
18550 return __pyx_r;
18551}
18552
18553/* "View.MemoryView":1116
18554 *
18555 * @cname('__pyx_get_best_slice_order')
18556 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
18557 * """
18558 * Figure out the best memory access order for a given slice.
18559 */
18560
18561static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
18562 int __pyx_v_i;
18563 Py_ssize_t __pyx_v_c_stride;
18564 Py_ssize_t __pyx_v_f_stride;
18565 char __pyx_r;
18566 int __pyx_t_1;
18567 int __pyx_t_2;
18568 int __pyx_t_3;
18569 int __pyx_t_4;
18570
18571 /* "View.MemoryView":1121
18572 * """
18573 * cdef int i
18574 * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
18575 * cdef Py_ssize_t f_stride = 0
18576 *
18577 */
18578 __pyx_v_c_stride = 0;
18579
18580 /* "View.MemoryView":1122
18581 * cdef int i
18582 * cdef Py_ssize_t c_stride = 0
18583 * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
18584 *
18585 * for i in range(ndim - 1, -1, -1):
18586 */
18587 __pyx_v_f_stride = 0;
18588
18589 /* "View.MemoryView":1124
18590 * cdef Py_ssize_t f_stride = 0
18591 *
18592 * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
18593 * if mslice.shape[i] > 1:
18594 * c_stride = mslice.strides[i]
18595 */
18596 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
18597 __pyx_v_i = __pyx_t_1;
18598
18599 /* "View.MemoryView":1125
18600 *
18601 * for i in range(ndim - 1, -1, -1):
18602 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
18603 * c_stride = mslice.strides[i]
18604 * break
18605 */
18606 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
18607 if (__pyx_t_2) {
18608
18609 /* "View.MemoryView":1126
18610 * for i in range(ndim - 1, -1, -1):
18611 * if mslice.shape[i] > 1:
18612 * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
18613 * break
18614 *
18615 */
18616 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
18617
18618 /* "View.MemoryView":1127
18619 * if mslice.shape[i] > 1:
18620 * c_stride = mslice.strides[i]
18621 * break # <<<<<<<<<<<<<<
18622 *
18623 * for i in range(ndim):
18624 */
18625 goto __pyx_L4_break;
18626
18627 /* "View.MemoryView":1125
18628 *
18629 * for i in range(ndim - 1, -1, -1):
18630 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
18631 * c_stride = mslice.strides[i]
18632 * break
18633 */
18634 }
18635 }
18636 __pyx_L4_break:;
18637
18638 /* "View.MemoryView":1129
18639 * break
18640 *
18641 * for i in range(ndim): # <<<<<<<<<<<<<<
18642 * if mslice.shape[i] > 1:
18643 * f_stride = mslice.strides[i]
18644 */
18645 __pyx_t_1 = __pyx_v_ndim;
18646 __pyx_t_3 = __pyx_t_1;
18647 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18648 __pyx_v_i = __pyx_t_4;
18649
18650 /* "View.MemoryView":1130
18651 *
18652 * for i in range(ndim):
18653 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
18654 * f_stride = mslice.strides[i]
18655 * break
18656 */
18657 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
18658 if (__pyx_t_2) {
18659
18660 /* "View.MemoryView":1131
18661 * for i in range(ndim):
18662 * if mslice.shape[i] > 1:
18663 * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
18664 * break
18665 *
18666 */
18667 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
18668
18669 /* "View.MemoryView":1132
18670 * if mslice.shape[i] > 1:
18671 * f_stride = mslice.strides[i]
18672 * break # <<<<<<<<<<<<<<
18673 *
18674 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
18675 */
18676 goto __pyx_L7_break;
18677
18678 /* "View.MemoryView":1130
18679 *
18680 * for i in range(ndim):
18681 * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
18682 * f_stride = mslice.strides[i]
18683 * break
18684 */
18685 }
18686 }
18687 __pyx_L7_break:;
18688
18689 /* "View.MemoryView":1134
18690 * break
18691 *
18692 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
18693 * return 'C'
18694 * else:
18695 */
18696 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
18697 if (__pyx_t_2) {
18698
18699 /* "View.MemoryView":1135
18700 *
18701 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
18702 * return 'C' # <<<<<<<<<<<<<<
18703 * else:
18704 * return 'F'
18705 */
18706 __pyx_r = 'C';
18707 goto __pyx_L0;
18708
18709 /* "View.MemoryView":1134
18710 * break
18711 *
18712 * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
18713 * return 'C'
18714 * else:
18715 */
18716 }
18717
18718 /* "View.MemoryView":1137
18719 * return 'C'
18720 * else:
18721 * return 'F' # <<<<<<<<<<<<<<
18722 *
18723 * @cython.cdivision(True)
18724 */
18725 /*else*/ {
18726 __pyx_r = 'F';
18727 goto __pyx_L0;
18728 }
18729
18730 /* "View.MemoryView":1116
18731 *
18732 * @cname('__pyx_get_best_slice_order')
18733 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
18734 * """
18735 * Figure out the best memory access order for a given slice.
18736 */
18737
18738 /* function exit code */
18739 __pyx_L0:;
18740 return __pyx_r;
18741}
18742
18743/* "View.MemoryView":1140
18744 *
18745 * @cython.cdivision(True)
18746 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
18747 * char *dst_data, Py_ssize_t *dst_strides,
18748 * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
18749 */
18750
18751static 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) {
18752 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
18753 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
18754 Py_ssize_t __pyx_v_dst_extent;
18755 Py_ssize_t __pyx_v_src_stride;
18756 Py_ssize_t __pyx_v_dst_stride;
18757 int __pyx_t_1;
18758 int __pyx_t_2;
18759 int __pyx_t_3;
18760 Py_ssize_t __pyx_t_4;
18761 Py_ssize_t __pyx_t_5;
18762 Py_ssize_t __pyx_t_6;
18763
18764 /* "View.MemoryView":1147
18765 *
18766 * cdef Py_ssize_t i
18767 * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
18768 * cdef Py_ssize_t dst_extent = dst_shape[0]
18769 * cdef Py_ssize_t src_stride = src_strides[0]
18770 */
18771 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
18772
18773 /* "View.MemoryView":1148
18774 * cdef Py_ssize_t i
18775 * cdef Py_ssize_t src_extent = src_shape[0]
18776 * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
18777 * cdef Py_ssize_t src_stride = src_strides[0]
18778 * cdef Py_ssize_t dst_stride = dst_strides[0]
18779 */
18780 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
18781
18782 /* "View.MemoryView":1149
18783 * cdef Py_ssize_t src_extent = src_shape[0]
18784 * cdef Py_ssize_t dst_extent = dst_shape[0]
18785 * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
18786 * cdef Py_ssize_t dst_stride = dst_strides[0]
18787 *
18788 */
18789 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
18790
18791 /* "View.MemoryView":1150
18792 * cdef Py_ssize_t dst_extent = dst_shape[0]
18793 * cdef Py_ssize_t src_stride = src_strides[0]
18794 * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
18795 *
18796 * if ndim == 1:
18797 */
18798 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
18799
18800 /* "View.MemoryView":1152
18801 * cdef Py_ssize_t dst_stride = dst_strides[0]
18802 *
18803 * if ndim == 1: # <<<<<<<<<<<<<<
18804 * if (src_stride > 0 and dst_stride > 0 and
18805 * <size_t> src_stride == itemsize == <size_t> dst_stride):
18806 */
18807 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
18808 if (__pyx_t_1) {
18809
18810 /* "View.MemoryView":1153
18811 *
18812 * if ndim == 1:
18813 * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
18814 * <size_t> src_stride == itemsize == <size_t> dst_stride):
18815 * memcpy(dst_data, src_data, itemsize * dst_extent)
18816 */
18817 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
18818 if (__pyx_t_2) {
18819 } else {
18820 __pyx_t_1 = __pyx_t_2;
18821 goto __pyx_L5_bool_binop_done;
18822 }
18823 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
18824 if (__pyx_t_2) {
18825 } else {
18826 __pyx_t_1 = __pyx_t_2;
18827 goto __pyx_L5_bool_binop_done;
18828 }
18829
18830 /* "View.MemoryView":1154
18831 * if ndim == 1:
18832 * if (src_stride > 0 and dst_stride > 0 and
18833 * <size_t> src_stride == itemsize == <size_t> dst_stride): # <<<<<<<<<<<<<<
18834 * memcpy(dst_data, src_data, itemsize * dst_extent)
18835 * else:
18836 */
18837 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
18838 if (__pyx_t_2) {
18839 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
18840 }
18841 __pyx_t_3 = (__pyx_t_2 != 0);
18842 __pyx_t_1 = __pyx_t_3;
18843 __pyx_L5_bool_binop_done:;
18844
18845 /* "View.MemoryView":1153
18846 *
18847 * if ndim == 1:
18848 * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
18849 * <size_t> src_stride == itemsize == <size_t> dst_stride):
18850 * memcpy(dst_data, src_data, itemsize * dst_extent)
18851 */
18852 if (__pyx_t_1) {
18853
18854 /* "View.MemoryView":1155
18855 * if (src_stride > 0 and dst_stride > 0 and
18856 * <size_t> src_stride == itemsize == <size_t> dst_stride):
18857 * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
18858 * else:
18859 * for i in range(dst_extent):
18860 */
18861 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
18862
18863 /* "View.MemoryView":1153
18864 *
18865 * if ndim == 1:
18866 * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
18867 * <size_t> src_stride == itemsize == <size_t> dst_stride):
18868 * memcpy(dst_data, src_data, itemsize * dst_extent)
18869 */
18870 goto __pyx_L4;
18871 }
18872
18873 /* "View.MemoryView":1157
18874 * memcpy(dst_data, src_data, itemsize * dst_extent)
18875 * else:
18876 * for i in range(dst_extent): # <<<<<<<<<<<<<<
18877 * memcpy(dst_data, src_data, itemsize)
18878 * src_data += src_stride
18879 */
18880 /*else*/ {
18881 __pyx_t_4 = __pyx_v_dst_extent;
18882 __pyx_t_5 = __pyx_t_4;
18883 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18884 __pyx_v_i = __pyx_t_6;
18885
18886 /* "View.MemoryView":1158
18887 * else:
18888 * for i in range(dst_extent):
18889 * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
18890 * src_data += src_stride
18891 * dst_data += dst_stride
18892 */
18893 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
18894
18895 /* "View.MemoryView":1159
18896 * for i in range(dst_extent):
18897 * memcpy(dst_data, src_data, itemsize)
18898 * src_data += src_stride # <<<<<<<<<<<<<<
18899 * dst_data += dst_stride
18900 * else:
18901 */
18902 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
18903
18904 /* "View.MemoryView":1160
18905 * memcpy(dst_data, src_data, itemsize)
18906 * src_data += src_stride
18907 * dst_data += dst_stride # <<<<<<<<<<<<<<
18908 * else:
18909 * for i in range(dst_extent):
18910 */
18911 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
18912 }
18913 }
18914 __pyx_L4:;
18915
18916 /* "View.MemoryView":1152
18917 * cdef Py_ssize_t dst_stride = dst_strides[0]
18918 *
18919 * if ndim == 1: # <<<<<<<<<<<<<<
18920 * if (src_stride > 0 and dst_stride > 0 and
18921 * <size_t> src_stride == itemsize == <size_t> dst_stride):
18922 */
18923 goto __pyx_L3;
18924 }
18925
18926 /* "View.MemoryView":1162
18927 * dst_data += dst_stride
18928 * else:
18929 * for i in range(dst_extent): # <<<<<<<<<<<<<<
18930 * _copy_strided_to_strided(src_data, src_strides + 1,
18931 * dst_data, dst_strides + 1,
18932 */
18933 /*else*/ {
18934 __pyx_t_4 = __pyx_v_dst_extent;
18935 __pyx_t_5 = __pyx_t_4;
18936 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18937 __pyx_v_i = __pyx_t_6;
18938
18939 /* "View.MemoryView":1163
18940 * else:
18941 * for i in range(dst_extent):
18942 * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
18943 * dst_data, dst_strides + 1,
18944 * src_shape + 1, dst_shape + 1,
18945 */
18946 _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);
18947
18948 /* "View.MemoryView":1167
18949 * src_shape + 1, dst_shape + 1,
18950 * ndim - 1, itemsize)
18951 * src_data += src_stride # <<<<<<<<<<<<<<
18952 * dst_data += dst_stride
18953 *
18954 */
18955 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
18956
18957 /* "View.MemoryView":1168
18958 * ndim - 1, itemsize)
18959 * src_data += src_stride
18960 * dst_data += dst_stride # <<<<<<<<<<<<<<
18961 *
18962 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
18963 */
18964 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
18965 }
18966 }
18967 __pyx_L3:;
18968
18969 /* "View.MemoryView":1140
18970 *
18971 * @cython.cdivision(True)
18972 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
18973 * char *dst_data, Py_ssize_t *dst_strides,
18974 * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
18975 */
18976
18977 /* function exit code */
18978}
18979
18980/* "View.MemoryView":1170
18981 * dst_data += dst_stride
18982 *
18983 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
18984 * __Pyx_memviewslice *dst,
18985 * int ndim, size_t itemsize) nogil:
18986 */
18987
18988static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
18989
18990 /* "View.MemoryView":1173
18991 * __Pyx_memviewslice *dst,
18992 * int ndim, size_t itemsize) nogil:
18993 * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
18994 * src.shape, dst.shape, ndim, itemsize)
18995 *
18996 */
18997 _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);
18998
18999 /* "View.MemoryView":1170
19000 * dst_data += dst_stride
19001 *
19002 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
19003 * __Pyx_memviewslice *dst,
19004 * int ndim, size_t itemsize) nogil:
19005 */
19006
19007 /* function exit code */
19008}
19009
19010/* "View.MemoryView":1177
19011 *
19012 * @cname('__pyx_memoryview_slice_get_size')
19013 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
19014 * "Return the size of the memory occupied by the slice in number of bytes"
19015 * cdef Py_ssize_t shape, size = src.memview.view.itemsize
19016 */
19017
19018static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
19019 Py_ssize_t __pyx_v_shape;
19020 Py_ssize_t __pyx_v_size;
19021 Py_ssize_t __pyx_r;
19022 Py_ssize_t __pyx_t_1;
19023 Py_ssize_t *__pyx_t_2;
19024 Py_ssize_t *__pyx_t_3;
19025 Py_ssize_t *__pyx_t_4;
19026
19027 /* "View.MemoryView":1179
19028 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
19029 * "Return the size of the memory occupied by the slice in number of bytes"
19030 * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
19031 *
19032 * for shape in src.shape[:ndim]:
19033 */
19034 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
19035 __pyx_v_size = __pyx_t_1;
19036
19037 /* "View.MemoryView":1181
19038 * cdef Py_ssize_t shape, size = src.memview.view.itemsize
19039 *
19040 * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
19041 * size *= shape
19042 *
19043 */
19044 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
19045 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
19046 __pyx_t_2 = __pyx_t_4;
19047 __pyx_v_shape = (__pyx_t_2[0]);
19048
19049 /* "View.MemoryView":1182
19050 *
19051 * for shape in src.shape[:ndim]:
19052 * size *= shape # <<<<<<<<<<<<<<
19053 *
19054 * return size
19055 */
19056 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
19057 }
19058
19059 /* "View.MemoryView":1184
19060 * size *= shape
19061 *
19062 * return size # <<<<<<<<<<<<<<
19063 *
19064 * @cname('__pyx_fill_contig_strides_array')
19065 */
19066 __pyx_r = __pyx_v_size;
19067 goto __pyx_L0;
19068
19069 /* "View.MemoryView":1177
19070 *
19071 * @cname('__pyx_memoryview_slice_get_size')
19072 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
19073 * "Return the size of the memory occupied by the slice in number of bytes"
19074 * cdef Py_ssize_t shape, size = src.memview.view.itemsize
19075 */
19076
19077 /* function exit code */
19078 __pyx_L0:;
19079 return __pyx_r;
19080}
19081
19082/* "View.MemoryView":1187
19083 *
19084 * @cname('__pyx_fill_contig_strides_array')
19085 * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
19086 * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
19087 * int ndim, char order) nogil:
19088 */
19089
19090static 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) {
19091 int __pyx_v_idx;
19092 Py_ssize_t __pyx_r;
19093 int __pyx_t_1;
19094 int __pyx_t_2;
19095 int __pyx_t_3;
19096 int __pyx_t_4;
19097
19098 /* "View.MemoryView":1196
19099 * cdef int idx
19100 *
19101 * if order == 'F': # <<<<<<<<<<<<<<
19102 * for idx in range(ndim):
19103 * strides[idx] = stride
19104 */
19105 __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
19106 if (__pyx_t_1) {
19107
19108 /* "View.MemoryView":1197
19109 *
19110 * if order == 'F':
19111 * for idx in range(ndim): # <<<<<<<<<<<<<<
19112 * strides[idx] = stride
19113 * stride *= shape[idx]
19114 */
19115 __pyx_t_2 = __pyx_v_ndim;
19116 __pyx_t_3 = __pyx_t_2;
19117 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19118 __pyx_v_idx = __pyx_t_4;
19119
19120 /* "View.MemoryView":1198
19121 * if order == 'F':
19122 * for idx in range(ndim):
19123 * strides[idx] = stride # <<<<<<<<<<<<<<
19124 * stride *= shape[idx]
19125 * else:
19126 */
19127 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
19128
19129 /* "View.MemoryView":1199
19130 * for idx in range(ndim):
19131 * strides[idx] = stride
19132 * stride *= shape[idx] # <<<<<<<<<<<<<<
19133 * else:
19134 * for idx in range(ndim - 1, -1, -1):
19135 */
19136 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
19137 }
19138
19139 /* "View.MemoryView":1196
19140 * cdef int idx
19141 *
19142 * if order == 'F': # <<<<<<<<<<<<<<
19143 * for idx in range(ndim):
19144 * strides[idx] = stride
19145 */
19146 goto __pyx_L3;
19147 }
19148
19149 /* "View.MemoryView":1201
19150 * stride *= shape[idx]
19151 * else:
19152 * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
19153 * strides[idx] = stride
19154 * stride *= shape[idx]
19155 */
19156 /*else*/ {
19157 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
19158 __pyx_v_idx = __pyx_t_2;
19159
19160 /* "View.MemoryView":1202
19161 * else:
19162 * for idx in range(ndim - 1, -1, -1):
19163 * strides[idx] = stride # <<<<<<<<<<<<<<
19164 * stride *= shape[idx]
19165 *
19166 */
19167 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
19168
19169 /* "View.MemoryView":1203
19170 * for idx in range(ndim - 1, -1, -1):
19171 * strides[idx] = stride
19172 * stride *= shape[idx] # <<<<<<<<<<<<<<
19173 *
19174 * return stride
19175 */
19176 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
19177 }
19178 }
19179 __pyx_L3:;
19180
19181 /* "View.MemoryView":1205
19182 * stride *= shape[idx]
19183 *
19184 * return stride # <<<<<<<<<<<<<<
19185 *
19186 * @cname('__pyx_memoryview_copy_data_to_temp')
19187 */
19188 __pyx_r = __pyx_v_stride;
19189 goto __pyx_L0;
19190
19191 /* "View.MemoryView":1187
19192 *
19193 * @cname('__pyx_fill_contig_strides_array')
19194 * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
19195 * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
19196 * int ndim, char order) nogil:
19197 */
19198
19199 /* function exit code */
19200 __pyx_L0:;
19201 return __pyx_r;
19202}
19203
19204/* "View.MemoryView":1208
19205 *
19206 * @cname('__pyx_memoryview_copy_data_to_temp')
19207 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
19208 * __Pyx_memviewslice *tmpslice,
19209 * char order,
19210 */
19211
19212static 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) {
19213 int __pyx_v_i;
19214 void *__pyx_v_result;
19215 size_t __pyx_v_itemsize;
19216 size_t __pyx_v_size;
19217 void *__pyx_r;
19218 Py_ssize_t __pyx_t_1;
19219 int __pyx_t_2;
19220 int __pyx_t_3;
19221 struct __pyx_memoryview_obj *__pyx_t_4;
19222 int __pyx_t_5;
19223 int __pyx_t_6;
19224 int __pyx_lineno = 0;
19225 const char *__pyx_filename = NULL;
19226 int __pyx_clineno = 0;
19227
19228 /* "View.MemoryView":1219
19229 * cdef void *result
19230 *
19231 * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
19232 * cdef size_t size = slice_get_size(src, ndim)
19233 *
19234 */
19235 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
19236 __pyx_v_itemsize = __pyx_t_1;
19237
19238 /* "View.MemoryView":1220
19239 *
19240 * cdef size_t itemsize = src.memview.view.itemsize
19241 * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
19242 *
19243 * result = malloc(size)
19244 */
19245 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
19246
19247 /* "View.MemoryView":1222
19248 * cdef size_t size = slice_get_size(src, ndim)
19249 *
19250 * result = malloc(size) # <<<<<<<<<<<<<<
19251 * if not result:
19252 * _err(MemoryError, NULL)
19253 */
19254 __pyx_v_result = malloc(__pyx_v_size);
19255
19256 /* "View.MemoryView":1223
19257 *
19258 * result = malloc(size)
19259 * if not result: # <<<<<<<<<<<<<<
19260 * _err(MemoryError, NULL)
19261 *
19262 */
19263 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
19264 if (__pyx_t_2) {
19265
19266 /* "View.MemoryView":1224
19267 * result = malloc(size)
19268 * if not result:
19269 * _err(MemoryError, NULL) # <<<<<<<<<<<<<<
19270 *
19271 *
19272 */
19273 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
19274
19275 /* "View.MemoryView":1223
19276 *
19277 * result = malloc(size)
19278 * if not result: # <<<<<<<<<<<<<<
19279 * _err(MemoryError, NULL)
19280 *
19281 */
19282 }
19283
19284 /* "View.MemoryView":1227
19285 *
19286 *
19287 * tmpslice.data = <char *> result # <<<<<<<<<<<<<<
19288 * tmpslice.memview = src.memview
19289 * for i in range(ndim):
19290 */
19291 __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
19292
19293 /* "View.MemoryView":1228
19294 *
19295 * tmpslice.data = <char *> result
19296 * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
19297 * for i in range(ndim):
19298 * tmpslice.shape[i] = src.shape[i]
19299 */
19300 __pyx_t_4 = __pyx_v_src->memview;
19301 __pyx_v_tmpslice->memview = __pyx_t_4;
19302
19303 /* "View.MemoryView":1229
19304 * tmpslice.data = <char *> result
19305 * tmpslice.memview = src.memview
19306 * for i in range(ndim): # <<<<<<<<<<<<<<
19307 * tmpslice.shape[i] = src.shape[i]
19308 * tmpslice.suboffsets[i] = -1
19309 */
19310 __pyx_t_3 = __pyx_v_ndim;
19311 __pyx_t_5 = __pyx_t_3;
19312 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19313 __pyx_v_i = __pyx_t_6;
19314
19315 /* "View.MemoryView":1230
19316 * tmpslice.memview = src.memview
19317 * for i in range(ndim):
19318 * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
19319 * tmpslice.suboffsets[i] = -1
19320 *
19321 */
19322 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
19323
19324 /* "View.MemoryView":1231
19325 * for i in range(ndim):
19326 * tmpslice.shape[i] = src.shape[i]
19327 * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
19328 *
19329 * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
19330 */
19331 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
19332 }
19333
19334 /* "View.MemoryView":1233
19335 * tmpslice.suboffsets[i] = -1
19336 *
19337 * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<<
19338 * ndim, order)
19339 *
19340 */
19341 (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));
19342
19343 /* "View.MemoryView":1237
19344 *
19345 *
19346 * for i in range(ndim): # <<<<<<<<<<<<<<
19347 * if tmpslice.shape[i] == 1:
19348 * tmpslice.strides[i] = 0
19349 */
19350 __pyx_t_3 = __pyx_v_ndim;
19351 __pyx_t_5 = __pyx_t_3;
19352 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19353 __pyx_v_i = __pyx_t_6;
19354
19355 /* "View.MemoryView":1238
19356 *
19357 * for i in range(ndim):
19358 * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
19359 * tmpslice.strides[i] = 0
19360 *
19361 */
19362 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
19363 if (__pyx_t_2) {
19364
19365 /* "View.MemoryView":1239
19366 * for i in range(ndim):
19367 * if tmpslice.shape[i] == 1:
19368 * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
19369 *
19370 * if slice_is_contig(src[0], order, ndim):
19371 */
19372 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
19373
19374 /* "View.MemoryView":1238
19375 *
19376 * for i in range(ndim):
19377 * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
19378 * tmpslice.strides[i] = 0
19379 *
19380 */
19381 }
19382 }
19383
19384 /* "View.MemoryView":1241
19385 * tmpslice.strides[i] = 0
19386 *
19387 * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
19388 * memcpy(result, src.data, size)
19389 * else:
19390 */
19391 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
19392 if (__pyx_t_2) {
19393
19394 /* "View.MemoryView":1242
19395 *
19396 * if slice_is_contig(src[0], order, ndim):
19397 * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
19398 * else:
19399 * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
19400 */
19401 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
19402
19403 /* "View.MemoryView":1241
19404 * tmpslice.strides[i] = 0
19405 *
19406 * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
19407 * memcpy(result, src.data, size)
19408 * else:
19409 */
19410 goto __pyx_L9;
19411 }
19412
19413 /* "View.MemoryView":1244
19414 * memcpy(result, src.data, size)
19415 * else:
19416 * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
19417 *
19418 * return result
19419 */
19420 /*else*/ {
19421 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
19422 }
19423 __pyx_L9:;
19424
19425 /* "View.MemoryView":1246
19426 * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
19427 *
19428 * return result # <<<<<<<<<<<<<<
19429 *
19430 *
19431 */
19432 __pyx_r = __pyx_v_result;
19433 goto __pyx_L0;
19434
19435 /* "View.MemoryView":1208
19436 *
19437 * @cname('__pyx_memoryview_copy_data_to_temp')
19438 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
19439 * __Pyx_memviewslice *tmpslice,
19440 * char order,
19441 */
19442
19443 /* function exit code */
19444 __pyx_L1_error:;
19445 {
19446 #ifdef WITH_THREAD
19447 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19448 #endif
19449 __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
19450 #ifdef WITH_THREAD
19451 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19452 #endif
19453 }
19454 __pyx_r = NULL;
19455 __pyx_L0:;
19456 return __pyx_r;
19457}
19458
19459/* "View.MemoryView":1251
19460 *
19461 * @cname('__pyx_memoryview_err_extents')
19462 * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
19463 * Py_ssize_t extent2) except -1 with gil:
19464 * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
19465 */
19466
19467static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
19468 int __pyx_r;
19469 __Pyx_RefNannyDeclarations
19470 PyObject *__pyx_t_1 = NULL;
19471 PyObject *__pyx_t_2 = NULL;
19472 PyObject *__pyx_t_3 = NULL;
19473 PyObject *__pyx_t_4 = NULL;
19474 int __pyx_lineno = 0;
19475 const char *__pyx_filename = NULL;
19476 int __pyx_clineno = 0;
19477 #ifdef WITH_THREAD
19478 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19479 #endif
19480 __Pyx_RefNannySetupContext("_err_extents", 0);
19481
19482 /* "View.MemoryView":1254
19483 * Py_ssize_t extent2) except -1 with gil:
19484 * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
19485 * (i, extent1, extent2)) # <<<<<<<<<<<<<<
19486 *
19487 * @cname('__pyx_memoryview_err_dim')
19488 */
19489 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
19490 __Pyx_GOTREF(__pyx_t_1);
19491 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
19492 __Pyx_GOTREF(__pyx_t_2);
19493 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
19494 __Pyx_GOTREF(__pyx_t_3);
19495 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
19496 __Pyx_GOTREF(__pyx_t_4);
19497 __Pyx_GIVEREF(__pyx_t_1);
19498 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
19499 __Pyx_GIVEREF(__pyx_t_2);
19500 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
19501 __Pyx_GIVEREF(__pyx_t_3);
19502 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
19503 __pyx_t_1 = 0;
19504 __pyx_t_2 = 0;
19505 __pyx_t_3 = 0;
19506
19507 /* "View.MemoryView":1253
19508 * cdef int _err_extents(int i, Py_ssize_t extent1,
19509 * Py_ssize_t extent2) except -1 with gil:
19510 * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<<
19511 * (i, extent1, extent2))
19512 *
19513 */
19514 __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)
19515 __Pyx_GOTREF(__pyx_t_3);
19516 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19517 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
19518 __Pyx_GOTREF(__pyx_t_4);
19519 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19520 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
19521 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19522 __PYX_ERR(2, 1253, __pyx_L1_error)
19523
19524 /* "View.MemoryView":1251
19525 *
19526 * @cname('__pyx_memoryview_err_extents')
19527 * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
19528 * Py_ssize_t extent2) except -1 with gil:
19529 * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
19530 */
19531
19532 /* function exit code */
19533 __pyx_L1_error:;
19534 __Pyx_XDECREF(__pyx_t_1);
19535 __Pyx_XDECREF(__pyx_t_2);
19536 __Pyx_XDECREF(__pyx_t_3);
19537 __Pyx_XDECREF(__pyx_t_4);
19538 __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19539 __pyx_r = -1;
19540 __Pyx_RefNannyFinishContext();
19541 #ifdef WITH_THREAD
19542 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19543 #endif
19544 return __pyx_r;
19545}
19546
19547/* "View.MemoryView":1257
19548 *
19549 * @cname('__pyx_memoryview_err_dim')
19550 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
19551 * raise error(msg.decode('ascii') % dim)
19552 *
19553 */
19554
19555static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
19556 int __pyx_r;
19557 __Pyx_RefNannyDeclarations
19558 PyObject *__pyx_t_1 = NULL;
19559 PyObject *__pyx_t_2 = NULL;
19560 PyObject *__pyx_t_3 = NULL;
19561 PyObject *__pyx_t_4 = NULL;
19562 int __pyx_lineno = 0;
19563 const char *__pyx_filename = NULL;
19564 int __pyx_clineno = 0;
19565 #ifdef WITH_THREAD
19566 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19567 #endif
19568 __Pyx_RefNannySetupContext("_err_dim", 0);
19569 __Pyx_INCREF(__pyx_v_error);
19570
19571 /* "View.MemoryView":1258
19572 * @cname('__pyx_memoryview_err_dim')
19573 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
19574 * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<<
19575 *
19576 * @cname('__pyx_memoryview_err')
19577 */
19578 __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)
19579 __Pyx_GOTREF(__pyx_t_2);
19580 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
19581 __Pyx_GOTREF(__pyx_t_3);
19582 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
19583 __Pyx_GOTREF(__pyx_t_4);
19584 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19585 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19586 __Pyx_INCREF(__pyx_v_error);
19587 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
19588 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
19589 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
19590 if (likely(__pyx_t_2)) {
19591 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
19592 __Pyx_INCREF(__pyx_t_2);
19593 __Pyx_INCREF(function);
19594 __Pyx_DECREF_SET(__pyx_t_3, function);
19595 }
19596 }
19597 __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);
19598 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
19599 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19600 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
19601 __Pyx_GOTREF(__pyx_t_1);
19602 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19603 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
19604 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19605 __PYX_ERR(2, 1258, __pyx_L1_error)
19606
19607 /* "View.MemoryView":1257
19608 *
19609 * @cname('__pyx_memoryview_err_dim')
19610 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
19611 * raise error(msg.decode('ascii') % dim)
19612 *
19613 */
19614
19615 /* function exit code */
19616 __pyx_L1_error:;
19617 __Pyx_XDECREF(__pyx_t_1);
19618 __Pyx_XDECREF(__pyx_t_2);
19619 __Pyx_XDECREF(__pyx_t_3);
19620 __Pyx_XDECREF(__pyx_t_4);
19621 __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
19622 __pyx_r = -1;
19623 __Pyx_XDECREF(__pyx_v_error);
19624 __Pyx_RefNannyFinishContext();
19625 #ifdef WITH_THREAD
19626 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19627 #endif
19628 return __pyx_r;
19629}
19630
19631/* "View.MemoryView":1261
19632 *
19633 * @cname('__pyx_memoryview_err')
19634 * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
19635 * if msg != NULL:
19636 * raise error(msg.decode('ascii'))
19637 */
19638
19639static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
19640 int __pyx_r;
19641 __Pyx_RefNannyDeclarations
19642 int __pyx_t_1;
19643 PyObject *__pyx_t_2 = NULL;
19644 PyObject *__pyx_t_3 = NULL;
19645 PyObject *__pyx_t_4 = NULL;
19646 PyObject *__pyx_t_5 = NULL;
19647 int __pyx_lineno = 0;
19648 const char *__pyx_filename = NULL;
19649 int __pyx_clineno = 0;
19650 #ifdef WITH_THREAD
19651 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19652 #endif
19653 __Pyx_RefNannySetupContext("_err", 0);
19654 __Pyx_INCREF(__pyx_v_error);
19655
19656 /* "View.MemoryView":1262
19657 * @cname('__pyx_memoryview_err')
19658 * cdef int _err(object error, char *msg) except -1 with gil:
19659 * if msg != NULL: # <<<<<<<<<<<<<<
19660 * raise error(msg.decode('ascii'))
19661 * else:
19662 */
19663 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
19664 if (unlikely(__pyx_t_1)) {
19665
19666 /* "View.MemoryView":1263
19667 * cdef int _err(object error, char *msg) except -1 with gil:
19668 * if msg != NULL:
19669 * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
19670 * else:
19671 * raise error
19672 */
19673 __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)
19674 __Pyx_GOTREF(__pyx_t_3);
19675 __Pyx_INCREF(__pyx_v_error);
19676 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
19677 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
19678 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
19679 if (likely(__pyx_t_5)) {
19680 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
19681 __Pyx_INCREF(__pyx_t_5);
19682 __Pyx_INCREF(function);
19683 __Pyx_DECREF_SET(__pyx_t_4, function);
19684 }
19685 }
19686 __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);
19687 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19688 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19689 if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
19690 __Pyx_GOTREF(__pyx_t_2);
19691 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19692 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
19693 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19694 __PYX_ERR(2, 1263, __pyx_L1_error)
19695
19696 /* "View.MemoryView":1262
19697 * @cname('__pyx_memoryview_err')
19698 * cdef int _err(object error, char *msg) except -1 with gil:
19699 * if msg != NULL: # <<<<<<<<<<<<<<
19700 * raise error(msg.decode('ascii'))
19701 * else:
19702 */
19703 }
19704
19705 /* "View.MemoryView":1265
19706 * raise error(msg.decode('ascii'))
19707 * else:
19708 * raise error # <<<<<<<<<<<<<<
19709 *
19710 * @cname('__pyx_memoryview_copy_contents')
19711 */
19712 /*else*/ {
19713 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
19714 __PYX_ERR(2, 1265, __pyx_L1_error)
19715 }
19716
19717 /* "View.MemoryView":1261
19718 *
19719 * @cname('__pyx_memoryview_err')
19720 * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
19721 * if msg != NULL:
19722 * raise error(msg.decode('ascii'))
19723 */
19724
19725 /* function exit code */
19726 __pyx_L1_error:;
19727 __Pyx_XDECREF(__pyx_t_2);
19728 __Pyx_XDECREF(__pyx_t_3);
19729 __Pyx_XDECREF(__pyx_t_4);
19730 __Pyx_XDECREF(__pyx_t_5);
19731 __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
19732 __pyx_r = -1;
19733 __Pyx_XDECREF(__pyx_v_error);
19734 __Pyx_RefNannyFinishContext();
19735 #ifdef WITH_THREAD
19736 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19737 #endif
19738 return __pyx_r;
19739}
19740
19741/* "View.MemoryView":1268
19742 *
19743 * @cname('__pyx_memoryview_copy_contents')
19744 * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
19745 * __Pyx_memviewslice dst,
19746 * int src_ndim, int dst_ndim,
19747 */
19748
19749static 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) {
19750 void *__pyx_v_tmpdata;
19751 size_t __pyx_v_itemsize;
19752 int __pyx_v_i;
19753 char __pyx_v_order;
19754 int __pyx_v_broadcasting;
19755 int __pyx_v_direct_copy;
19756 __Pyx_memviewslice __pyx_v_tmp;
19757 int __pyx_v_ndim;
19758 int __pyx_r;
19759 Py_ssize_t __pyx_t_1;
19760 int __pyx_t_2;
19761 int __pyx_t_3;
19762 int __pyx_t_4;
19763 int __pyx_t_5;
19764 int __pyx_t_6;
19765 void *__pyx_t_7;
19766 int __pyx_t_8;
19767 int __pyx_lineno = 0;
19768 const char *__pyx_filename = NULL;
19769 int __pyx_clineno = 0;
19770
19771 /* "View.MemoryView":1276
19772 * Check for overlapping memory and verify the shapes.
19773 * """
19774 * cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
19775 * cdef size_t itemsize = src.memview.view.itemsize
19776 * cdef int i
19777 */
19778 __pyx_v_tmpdata = NULL;
19779
19780 /* "View.MemoryView":1277
19781 * """
19782 * cdef void *tmpdata = NULL
19783 * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
19784 * cdef int i
19785 * cdef char order = get_best_order(&src, src_ndim)
19786 */
19787 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
19788 __pyx_v_itemsize = __pyx_t_1;
19789
19790 /* "View.MemoryView":1279
19791 * cdef size_t itemsize = src.memview.view.itemsize
19792 * cdef int i
19793 * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
19794 * cdef bint broadcasting = False
19795 * cdef bint direct_copy = False
19796 */
19797 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
19798
19799 /* "View.MemoryView":1280
19800 * cdef int i
19801 * cdef char order = get_best_order(&src, src_ndim)
19802 * cdef bint broadcasting = False # <<<<<<<<<<<<<<
19803 * cdef bint direct_copy = False
19804 * cdef __Pyx_memviewslice tmp
19805 */
19806 __pyx_v_broadcasting = 0;
19807
19808 /* "View.MemoryView":1281
19809 * cdef char order = get_best_order(&src, src_ndim)
19810 * cdef bint broadcasting = False
19811 * cdef bint direct_copy = False # <<<<<<<<<<<<<<
19812 * cdef __Pyx_memviewslice tmp
19813 *
19814 */
19815 __pyx_v_direct_copy = 0;
19816
19817 /* "View.MemoryView":1284
19818 * cdef __Pyx_memviewslice tmp
19819 *
19820 * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
19821 * broadcast_leading(&src, src_ndim, dst_ndim)
19822 * elif dst_ndim < src_ndim:
19823 */
19824 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
19825 if (__pyx_t_2) {
19826
19827 /* "View.MemoryView":1285
19828 *
19829 * if src_ndim < dst_ndim:
19830 * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
19831 * elif dst_ndim < src_ndim:
19832 * broadcast_leading(&dst, dst_ndim, src_ndim)
19833 */
19834 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
19835
19836 /* "View.MemoryView":1284
19837 * cdef __Pyx_memviewslice tmp
19838 *
19839 * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
19840 * broadcast_leading(&src, src_ndim, dst_ndim)
19841 * elif dst_ndim < src_ndim:
19842 */
19843 goto __pyx_L3;
19844 }
19845
19846 /* "View.MemoryView":1286
19847 * if src_ndim < dst_ndim:
19848 * broadcast_leading(&src, src_ndim, dst_ndim)
19849 * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
19850 * broadcast_leading(&dst, dst_ndim, src_ndim)
19851 *
19852 */
19853 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
19854 if (__pyx_t_2) {
19855
19856 /* "View.MemoryView":1287
19857 * broadcast_leading(&src, src_ndim, dst_ndim)
19858 * elif dst_ndim < src_ndim:
19859 * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
19860 *
19861 * cdef int ndim = max(src_ndim, dst_ndim)
19862 */
19863 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
19864
19865 /* "View.MemoryView":1286
19866 * if src_ndim < dst_ndim:
19867 * broadcast_leading(&src, src_ndim, dst_ndim)
19868 * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
19869 * broadcast_leading(&dst, dst_ndim, src_ndim)
19870 *
19871 */
19872 }
19873 __pyx_L3:;
19874
19875 /* "View.MemoryView":1289
19876 * broadcast_leading(&dst, dst_ndim, src_ndim)
19877 *
19878 * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
19879 *
19880 * for i in range(ndim):
19881 */
19882 __pyx_t_3 = __pyx_v_dst_ndim;
19883 __pyx_t_4 = __pyx_v_src_ndim;
19884 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
19885 __pyx_t_5 = __pyx_t_3;
19886 } else {
19887 __pyx_t_5 = __pyx_t_4;
19888 }
19889 __pyx_v_ndim = __pyx_t_5;
19890
19891 /* "View.MemoryView":1291
19892 * cdef int ndim = max(src_ndim, dst_ndim)
19893 *
19894 * for i in range(ndim): # <<<<<<<<<<<<<<
19895 * if src.shape[i] != dst.shape[i]:
19896 * if src.shape[i] == 1:
19897 */
19898 __pyx_t_5 = __pyx_v_ndim;
19899 __pyx_t_3 = __pyx_t_5;
19900 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19901 __pyx_v_i = __pyx_t_4;
19902
19903 /* "View.MemoryView":1292
19904 *
19905 * for i in range(ndim):
19906 * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
19907 * if src.shape[i] == 1:
19908 * broadcasting = True
19909 */
19910 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
19911 if (__pyx_t_2) {
19912
19913 /* "View.MemoryView":1293
19914 * for i in range(ndim):
19915 * if src.shape[i] != dst.shape[i]:
19916 * if src.shape[i] == 1: # <<<<<<<<<<<<<<
19917 * broadcasting = True
19918 * src.strides[i] = 0
19919 */
19920 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
19921 if (__pyx_t_2) {
19922
19923 /* "View.MemoryView":1294
19924 * if src.shape[i] != dst.shape[i]:
19925 * if src.shape[i] == 1:
19926 * broadcasting = True # <<<<<<<<<<<<<<
19927 * src.strides[i] = 0
19928 * else:
19929 */
19930 __pyx_v_broadcasting = 1;
19931
19932 /* "View.MemoryView":1295
19933 * if src.shape[i] == 1:
19934 * broadcasting = True
19935 * src.strides[i] = 0 # <<<<<<<<<<<<<<
19936 * else:
19937 * _err_extents(i, dst.shape[i], src.shape[i])
19938 */
19939 (__pyx_v_src.strides[__pyx_v_i]) = 0;
19940
19941 /* "View.MemoryView":1293
19942 * for i in range(ndim):
19943 * if src.shape[i] != dst.shape[i]:
19944 * if src.shape[i] == 1: # <<<<<<<<<<<<<<
19945 * broadcasting = True
19946 * src.strides[i] = 0
19947 */
19948 goto __pyx_L7;
19949 }
19950
19951 /* "View.MemoryView":1297
19952 * src.strides[i] = 0
19953 * else:
19954 * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
19955 *
19956 * if src.suboffsets[i] >= 0:
19957 */
19958 /*else*/ {
19959 __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)
19960 }
19961 __pyx_L7:;
19962
19963 /* "View.MemoryView":1292
19964 *
19965 * for i in range(ndim):
19966 * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
19967 * if src.shape[i] == 1:
19968 * broadcasting = True
19969 */
19970 }
19971
19972 /* "View.MemoryView":1299
19973 * _err_extents(i, dst.shape[i], src.shape[i])
19974 *
19975 * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
19976 * _err_dim(ValueError, "Dimension %d is not direct", i)
19977 *
19978 */
19979 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
19980 if (__pyx_t_2) {
19981
19982 /* "View.MemoryView":1300
19983 *
19984 * if src.suboffsets[i] >= 0:
19985 * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
19986 *
19987 * if slices_overlap(&src, &dst, ndim, itemsize):
19988 */
19989 __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)
19990
19991 /* "View.MemoryView":1299
19992 * _err_extents(i, dst.shape[i], src.shape[i])
19993 *
19994 * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
19995 * _err_dim(ValueError, "Dimension %d is not direct", i)
19996 *
19997 */
19998 }
19999 }
20000
20001 /* "View.MemoryView":1302
20002 * _err_dim(ValueError, "Dimension %d is not direct", i)
20003 *
20004 * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
20005 *
20006 * if not slice_is_contig(src, order, ndim):
20007 */
20008 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
20009 if (__pyx_t_2) {
20010
20011 /* "View.MemoryView":1304
20012 * if slices_overlap(&src, &dst, ndim, itemsize):
20013 *
20014 * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
20015 * order = get_best_order(&dst, ndim)
20016 *
20017 */
20018 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
20019 if (__pyx_t_2) {
20020
20021 /* "View.MemoryView":1305
20022 *
20023 * if not slice_is_contig(src, order, ndim):
20024 * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
20025 *
20026 * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
20027 */
20028 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
20029
20030 /* "View.MemoryView":1304
20031 * if slices_overlap(&src, &dst, ndim, itemsize):
20032 *
20033 * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
20034 * order = get_best_order(&dst, ndim)
20035 *
20036 */
20037 }
20038
20039 /* "View.MemoryView":1307
20040 * order = get_best_order(&dst, ndim)
20041 *
20042 * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
20043 * src = tmp
20044 *
20045 */
20046 __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)
20047 __pyx_v_tmpdata = __pyx_t_7;
20048
20049 /* "View.MemoryView":1308
20050 *
20051 * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
20052 * src = tmp # <<<<<<<<<<<<<<
20053 *
20054 * if not broadcasting:
20055 */
20056 __pyx_v_src = __pyx_v_tmp;
20057
20058 /* "View.MemoryView":1302
20059 * _err_dim(ValueError, "Dimension %d is not direct", i)
20060 *
20061 * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
20062 *
20063 * if not slice_is_contig(src, order, ndim):
20064 */
20065 }
20066
20067 /* "View.MemoryView":1310
20068 * src = tmp
20069 *
20070 * if not broadcasting: # <<<<<<<<<<<<<<
20071 *
20072 *
20073 */
20074 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
20075 if (__pyx_t_2) {
20076
20077 /* "View.MemoryView":1313
20078 *
20079 *
20080 * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
20081 * direct_copy = slice_is_contig(dst, 'C', ndim)
20082 * elif slice_is_contig(src, 'F', ndim):
20083 */
20084 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
20085 if (__pyx_t_2) {
20086
20087 /* "View.MemoryView":1314
20088 *
20089 * if slice_is_contig(src, 'C', ndim):
20090 * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<<
20091 * elif slice_is_contig(src, 'F', ndim):
20092 * direct_copy = slice_is_contig(dst, 'F', ndim)
20093 */
20094 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
20095
20096 /* "View.MemoryView":1313
20097 *
20098 *
20099 * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
20100 * direct_copy = slice_is_contig(dst, 'C', ndim)
20101 * elif slice_is_contig(src, 'F', ndim):
20102 */
20103 goto __pyx_L12;
20104 }
20105
20106 /* "View.MemoryView":1315
20107 * if slice_is_contig(src, 'C', ndim):
20108 * direct_copy = slice_is_contig(dst, 'C', ndim)
20109 * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
20110 * direct_copy = slice_is_contig(dst, 'F', ndim)
20111 *
20112 */
20113 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
20114 if (__pyx_t_2) {
20115
20116 /* "View.MemoryView":1316
20117 * direct_copy = slice_is_contig(dst, 'C', ndim)
20118 * elif slice_is_contig(src, 'F', ndim):
20119 * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<<
20120 *
20121 * if direct_copy:
20122 */
20123 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
20124
20125 /* "View.MemoryView":1315
20126 * if slice_is_contig(src, 'C', ndim):
20127 * direct_copy = slice_is_contig(dst, 'C', ndim)
20128 * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
20129 * direct_copy = slice_is_contig(dst, 'F', ndim)
20130 *
20131 */
20132 }
20133 __pyx_L12:;
20134
20135 /* "View.MemoryView":1318
20136 * direct_copy = slice_is_contig(dst, 'F', ndim)
20137 *
20138 * if direct_copy: # <<<<<<<<<<<<<<
20139 *
20140 * refcount_copying(&dst, dtype_is_object, ndim, False)
20141 */
20142 __pyx_t_2 = (__pyx_v_direct_copy != 0);
20143 if (__pyx_t_2) {
20144
20145 /* "View.MemoryView":1320
20146 * if direct_copy:
20147 *
20148 * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
20149 * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
20150 * refcount_copying(&dst, dtype_is_object, ndim, True)
20151 */
20152 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20153
20154 /* "View.MemoryView":1321
20155 *
20156 * refcount_copying(&dst, dtype_is_object, ndim, False)
20157 * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<<
20158 * refcount_copying(&dst, dtype_is_object, ndim, True)
20159 * free(tmpdata)
20160 */
20161 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
20162
20163 /* "View.MemoryView":1322
20164 * refcount_copying(&dst, dtype_is_object, ndim, False)
20165 * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
20166 * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
20167 * free(tmpdata)
20168 * return 0
20169 */
20170 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20171
20172 /* "View.MemoryView":1323
20173 * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
20174 * refcount_copying(&dst, dtype_is_object, ndim, True)
20175 * free(tmpdata) # <<<<<<<<<<<<<<
20176 * return 0
20177 *
20178 */
20179 free(__pyx_v_tmpdata);
20180
20181 /* "View.MemoryView":1324
20182 * refcount_copying(&dst, dtype_is_object, ndim, True)
20183 * free(tmpdata)
20184 * return 0 # <<<<<<<<<<<<<<
20185 *
20186 * if order == 'F' == get_best_order(&dst, ndim):
20187 */
20188 __pyx_r = 0;
20189 goto __pyx_L0;
20190
20191 /* "View.MemoryView":1318
20192 * direct_copy = slice_is_contig(dst, 'F', ndim)
20193 *
20194 * if direct_copy: # <<<<<<<<<<<<<<
20195 *
20196 * refcount_copying(&dst, dtype_is_object, ndim, False)
20197 */
20198 }
20199
20200 /* "View.MemoryView":1310
20201 * src = tmp
20202 *
20203 * if not broadcasting: # <<<<<<<<<<<<<<
20204 *
20205 *
20206 */
20207 }
20208
20209 /* "View.MemoryView":1326
20210 * return 0
20211 *
20212 * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
20213 *
20214 *
20215 */
20216 __pyx_t_2 = (__pyx_v_order == 'F');
20217 if (__pyx_t_2) {
20218 __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
20219 }
20220 __pyx_t_8 = (__pyx_t_2 != 0);
20221 if (__pyx_t_8) {
20222
20223 /* "View.MemoryView":1329
20224 *
20225 *
20226 * transpose_memslice(&src) # <<<<<<<<<<<<<<
20227 * transpose_memslice(&dst)
20228 *
20229 */
20230 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
20231
20232 /* "View.MemoryView":1330
20233 *
20234 * transpose_memslice(&src)
20235 * transpose_memslice(&dst) # <<<<<<<<<<<<<<
20236 *
20237 * refcount_copying(&dst, dtype_is_object, ndim, False)
20238 */
20239 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
20240
20241 /* "View.MemoryView":1326
20242 * return 0
20243 *
20244 * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
20245 *
20246 *
20247 */
20248 }
20249
20250 /* "View.MemoryView":1332
20251 * transpose_memslice(&dst)
20252 *
20253 * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
20254 * copy_strided_to_strided(&src, &dst, ndim, itemsize)
20255 * refcount_copying(&dst, dtype_is_object, ndim, True)
20256 */
20257 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20258
20259 /* "View.MemoryView":1333
20260 *
20261 * refcount_copying(&dst, dtype_is_object, ndim, False)
20262 * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
20263 * refcount_copying(&dst, dtype_is_object, ndim, True)
20264 *
20265 */
20266 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
20267
20268 /* "View.MemoryView":1334
20269 * refcount_copying(&dst, dtype_is_object, ndim, False)
20270 * copy_strided_to_strided(&src, &dst, ndim, itemsize)
20271 * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
20272 *
20273 * free(tmpdata)
20274 */
20275 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20276
20277 /* "View.MemoryView":1336
20278 * refcount_copying(&dst, dtype_is_object, ndim, True)
20279 *
20280 * free(tmpdata) # <<<<<<<<<<<<<<
20281 * return 0
20282 *
20283 */
20284 free(__pyx_v_tmpdata);
20285
20286 /* "View.MemoryView":1337
20287 *
20288 * free(tmpdata)
20289 * return 0 # <<<<<<<<<<<<<<
20290 *
20291 * @cname('__pyx_memoryview_broadcast_leading')
20292 */
20293 __pyx_r = 0;
20294 goto __pyx_L0;
20295
20296 /* "View.MemoryView":1268
20297 *
20298 * @cname('__pyx_memoryview_copy_contents')
20299 * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
20300 * __Pyx_memviewslice dst,
20301 * int src_ndim, int dst_ndim,
20302 */
20303
20304 /* function exit code */
20305 __pyx_L1_error:;
20306 {
20307 #ifdef WITH_THREAD
20308 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20309 #endif
20310 __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
20311 #ifdef WITH_THREAD
20312 __Pyx_PyGILState_Release(__pyx_gilstate_save);
20313 #endif
20314 }
20315 __pyx_r = -1;
20316 __pyx_L0:;
20317 return __pyx_r;
20318}
20319
20320/* "View.MemoryView":1340
20321 *
20322 * @cname('__pyx_memoryview_broadcast_leading')
20323 * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
20324 * int ndim,
20325 * int ndim_other) nogil:
20326 */
20327
20328static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
20329 int __pyx_v_i;
20330 int __pyx_v_offset;
20331 int __pyx_t_1;
20332 int __pyx_t_2;
20333 int __pyx_t_3;
20334
20335 /* "View.MemoryView":1344
20336 * int ndim_other) nogil:
20337 * cdef int i
20338 * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
20339 *
20340 * for i in range(ndim - 1, -1, -1):
20341 */
20342 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
20343
20344 /* "View.MemoryView":1346
20345 * cdef int offset = ndim_other - ndim
20346 *
20347 * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
20348 * mslice.shape[i + offset] = mslice.shape[i]
20349 * mslice.strides[i + offset] = mslice.strides[i]
20350 */
20351 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
20352 __pyx_v_i = __pyx_t_1;
20353
20354 /* "View.MemoryView":1347
20355 *
20356 * for i in range(ndim - 1, -1, -1):
20357 * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<<
20358 * mslice.strides[i + offset] = mslice.strides[i]
20359 * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
20360 */
20361 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
20362
20363 /* "View.MemoryView":1348
20364 * for i in range(ndim - 1, -1, -1):
20365 * mslice.shape[i + offset] = mslice.shape[i]
20366 * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<<
20367 * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
20368 *
20369 */
20370 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
20371
20372 /* "View.MemoryView":1349
20373 * mslice.shape[i + offset] = mslice.shape[i]
20374 * mslice.strides[i + offset] = mslice.strides[i]
20375 * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<<
20376 *
20377 * for i in range(offset):
20378 */
20379 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
20380 }
20381
20382 /* "View.MemoryView":1351
20383 * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
20384 *
20385 * for i in range(offset): # <<<<<<<<<<<<<<
20386 * mslice.shape[i] = 1
20387 * mslice.strides[i] = mslice.strides[0]
20388 */
20389 __pyx_t_1 = __pyx_v_offset;
20390 __pyx_t_2 = __pyx_t_1;
20391 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20392 __pyx_v_i = __pyx_t_3;
20393
20394 /* "View.MemoryView":1352
20395 *
20396 * for i in range(offset):
20397 * mslice.shape[i] = 1 # <<<<<<<<<<<<<<
20398 * mslice.strides[i] = mslice.strides[0]
20399 * mslice.suboffsets[i] = -1
20400 */
20401 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
20402
20403 /* "View.MemoryView":1353
20404 * for i in range(offset):
20405 * mslice.shape[i] = 1
20406 * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<<
20407 * mslice.suboffsets[i] = -1
20408 *
20409 */
20410 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
20411
20412 /* "View.MemoryView":1354
20413 * mslice.shape[i] = 1
20414 * mslice.strides[i] = mslice.strides[0]
20415 * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
20416 *
20417 *
20418 */
20419 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
20420 }
20421
20422 /* "View.MemoryView":1340
20423 *
20424 * @cname('__pyx_memoryview_broadcast_leading')
20425 * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
20426 * int ndim,
20427 * int ndim_other) nogil:
20428 */
20429
20430 /* function exit code */
20431}
20432
20433/* "View.MemoryView":1362
20434 *
20435 * @cname('__pyx_memoryview_refcount_copying')
20436 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
20437 * int ndim, bint inc) nogil:
20438 *
20439 */
20440
20441static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
20442 int __pyx_t_1;
20443
20444 /* "View.MemoryView":1366
20445 *
20446 *
20447 * if dtype_is_object: # <<<<<<<<<<<<<<
20448 * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
20449 * dst.strides, ndim, inc)
20450 */
20451 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
20452 if (__pyx_t_1) {
20453
20454 /* "View.MemoryView":1367
20455 *
20456 * if dtype_is_object:
20457 * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<<
20458 * dst.strides, ndim, inc)
20459 *
20460 */
20461 __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);
20462
20463 /* "View.MemoryView":1366
20464 *
20465 *
20466 * if dtype_is_object: # <<<<<<<<<<<<<<
20467 * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
20468 * dst.strides, ndim, inc)
20469 */
20470 }
20471
20472 /* "View.MemoryView":1362
20473 *
20474 * @cname('__pyx_memoryview_refcount_copying')
20475 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
20476 * int ndim, bint inc) nogil:
20477 *
20478 */
20479
20480 /* function exit code */
20481}
20482
20483/* "View.MemoryView":1371
20484 *
20485 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
20486 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
20487 * Py_ssize_t *strides, int ndim,
20488 * bint inc) with gil:
20489 */
20490
20491static 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) {
20492 __Pyx_RefNannyDeclarations
20493 #ifdef WITH_THREAD
20494 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20495 #endif
20496 __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
20497
20498 /* "View.MemoryView":1374
20499 * Py_ssize_t *strides, int ndim,
20500 * bint inc) with gil:
20501 * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
20502 *
20503 * @cname('__pyx_memoryview_refcount_objects_in_slice')
20504 */
20505 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
20506
20507 /* "View.MemoryView":1371
20508 *
20509 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
20510 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
20511 * Py_ssize_t *strides, int ndim,
20512 * bint inc) with gil:
20513 */
20514
20515 /* function exit code */
20516 __Pyx_RefNannyFinishContext();
20517 #ifdef WITH_THREAD
20518 __Pyx_PyGILState_Release(__pyx_gilstate_save);
20519 #endif
20520}
20521
20522/* "View.MemoryView":1377
20523 *
20524 * @cname('__pyx_memoryview_refcount_objects_in_slice')
20525 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
20526 * Py_ssize_t *strides, int ndim, bint inc):
20527 * cdef Py_ssize_t i
20528 */
20529
20530static 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) {
20531 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
20532 __Pyx_RefNannyDeclarations
20533 Py_ssize_t __pyx_t_1;
20534 Py_ssize_t __pyx_t_2;
20535 Py_ssize_t __pyx_t_3;
20536 int __pyx_t_4;
20537 __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
20538
20539 /* "View.MemoryView":1381
20540 * cdef Py_ssize_t i
20541 *
20542 * for i in range(shape[0]): # <<<<<<<<<<<<<<
20543 * if ndim == 1:
20544 * if inc:
20545 */
20546 __pyx_t_1 = (__pyx_v_shape[0]);
20547 __pyx_t_2 = __pyx_t_1;
20548 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20549 __pyx_v_i = __pyx_t_3;
20550
20551 /* "View.MemoryView":1382
20552 *
20553 * for i in range(shape[0]):
20554 * if ndim == 1: # <<<<<<<<<<<<<<
20555 * if inc:
20556 * Py_INCREF((<PyObject **> data)[0])
20557 */
20558 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
20559 if (__pyx_t_4) {
20560
20561 /* "View.MemoryView":1383
20562 * for i in range(shape[0]):
20563 * if ndim == 1:
20564 * if inc: # <<<<<<<<<<<<<<
20565 * Py_INCREF((<PyObject **> data)[0])
20566 * else:
20567 */
20568 __pyx_t_4 = (__pyx_v_inc != 0);
20569 if (__pyx_t_4) {
20570
20571 /* "View.MemoryView":1384
20572 * if ndim == 1:
20573 * if inc:
20574 * Py_INCREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
20575 * else:
20576 * Py_DECREF((<PyObject **> data)[0])
20577 */
20578 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
20579
20580 /* "View.MemoryView":1383
20581 * for i in range(shape[0]):
20582 * if ndim == 1:
20583 * if inc: # <<<<<<<<<<<<<<
20584 * Py_INCREF((<PyObject **> data)[0])
20585 * else:
20586 */
20587 goto __pyx_L6;
20588 }
20589
20590 /* "View.MemoryView":1386
20591 * Py_INCREF((<PyObject **> data)[0])
20592 * else:
20593 * Py_DECREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
20594 * else:
20595 * refcount_objects_in_slice(data, shape + 1, strides + 1,
20596 */
20597 /*else*/ {
20598 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
20599 }
20600 __pyx_L6:;
20601
20602 /* "View.MemoryView":1382
20603 *
20604 * for i in range(shape[0]):
20605 * if ndim == 1: # <<<<<<<<<<<<<<
20606 * if inc:
20607 * Py_INCREF((<PyObject **> data)[0])
20608 */
20609 goto __pyx_L5;
20610 }
20611
20612 /* "View.MemoryView":1388
20613 * Py_DECREF((<PyObject **> data)[0])
20614 * else:
20615 * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
20616 * ndim - 1, inc)
20617 *
20618 */
20619 /*else*/ {
20620
20621 /* "View.MemoryView":1389
20622 * else:
20623 * refcount_objects_in_slice(data, shape + 1, strides + 1,
20624 * ndim - 1, inc) # <<<<<<<<<<<<<<
20625 *
20626 * data += strides[0]
20627 */
20628 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
20629 }
20630 __pyx_L5:;
20631
20632 /* "View.MemoryView":1391
20633 * ndim - 1, inc)
20634 *
20635 * data += strides[0] # <<<<<<<<<<<<<<
20636 *
20637 *
20638 */
20639 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
20640 }
20641
20642 /* "View.MemoryView":1377
20643 *
20644 * @cname('__pyx_memoryview_refcount_objects_in_slice')
20645 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
20646 * Py_ssize_t *strides, int ndim, bint inc):
20647 * cdef Py_ssize_t i
20648 */
20649
20650 /* function exit code */
20651 __Pyx_RefNannyFinishContext();
20652}
20653
20654/* "View.MemoryView":1397
20655 *
20656 * @cname('__pyx_memoryview_slice_assign_scalar')
20657 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
20658 * size_t itemsize, void *item,
20659 * bint dtype_is_object) nogil:
20660 */
20661
20662static 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) {
20663
20664 /* "View.MemoryView":1400
20665 * size_t itemsize, void *item,
20666 * bint dtype_is_object) nogil:
20667 * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
20668 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
20669 * itemsize, item)
20670 */
20671 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20672
20673 /* "View.MemoryView":1401
20674 * bint dtype_is_object) nogil:
20675 * refcount_copying(dst, dtype_is_object, ndim, False)
20676 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<<
20677 * itemsize, item)
20678 * refcount_copying(dst, dtype_is_object, ndim, True)
20679 */
20680 __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);
20681
20682 /* "View.MemoryView":1403
20683 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
20684 * itemsize, item)
20685 * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
20686 *
20687 *
20688 */
20689 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20690
20691 /* "View.MemoryView":1397
20692 *
20693 * @cname('__pyx_memoryview_slice_assign_scalar')
20694 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
20695 * size_t itemsize, void *item,
20696 * bint dtype_is_object) nogil:
20697 */
20698
20699 /* function exit code */
20700}
20701
20702/* "View.MemoryView":1407
20703 *
20704 * @cname('__pyx_memoryview__slice_assign_scalar')
20705 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
20706 * Py_ssize_t *strides, int ndim,
20707 * size_t itemsize, void *item) nogil:
20708 */
20709
20710static 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) {
20711 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
20712 Py_ssize_t __pyx_v_stride;
20713 Py_ssize_t __pyx_v_extent;
20714 int __pyx_t_1;
20715 Py_ssize_t __pyx_t_2;
20716 Py_ssize_t __pyx_t_3;
20717 Py_ssize_t __pyx_t_4;
20718
20719 /* "View.MemoryView":1411
20720 * size_t itemsize, void *item) nogil:
20721 * cdef Py_ssize_t i
20722 * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
20723 * cdef Py_ssize_t extent = shape[0]
20724 *
20725 */
20726 __pyx_v_stride = (__pyx_v_strides[0]);
20727
20728 /* "View.MemoryView":1412
20729 * cdef Py_ssize_t i
20730 * cdef Py_ssize_t stride = strides[0]
20731 * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
20732 *
20733 * if ndim == 1:
20734 */
20735 __pyx_v_extent = (__pyx_v_shape[0]);
20736
20737 /* "View.MemoryView":1414
20738 * cdef Py_ssize_t extent = shape[0]
20739 *
20740 * if ndim == 1: # <<<<<<<<<<<<<<
20741 * for i in range(extent):
20742 * memcpy(data, item, itemsize)
20743 */
20744 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
20745 if (__pyx_t_1) {
20746
20747 /* "View.MemoryView":1415
20748 *
20749 * if ndim == 1:
20750 * for i in range(extent): # <<<<<<<<<<<<<<
20751 * memcpy(data, item, itemsize)
20752 * data += stride
20753 */
20754 __pyx_t_2 = __pyx_v_extent;
20755 __pyx_t_3 = __pyx_t_2;
20756 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20757 __pyx_v_i = __pyx_t_4;
20758
20759 /* "View.MemoryView":1416
20760 * if ndim == 1:
20761 * for i in range(extent):
20762 * memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
20763 * data += stride
20764 * else:
20765 */
20766 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
20767
20768 /* "View.MemoryView":1417
20769 * for i in range(extent):
20770 * memcpy(data, item, itemsize)
20771 * data += stride # <<<<<<<<<<<<<<
20772 * else:
20773 * for i in range(extent):
20774 */
20775 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
20776 }
20777
20778 /* "View.MemoryView":1414
20779 * cdef Py_ssize_t extent = shape[0]
20780 *
20781 * if ndim == 1: # <<<<<<<<<<<<<<
20782 * for i in range(extent):
20783 * memcpy(data, item, itemsize)
20784 */
20785 goto __pyx_L3;
20786 }
20787
20788 /* "View.MemoryView":1419
20789 * data += stride
20790 * else:
20791 * for i in range(extent): # <<<<<<<<<<<<<<
20792 * _slice_assign_scalar(data, shape + 1, strides + 1,
20793 * ndim - 1, itemsize, item)
20794 */
20795 /*else*/ {
20796 __pyx_t_2 = __pyx_v_extent;
20797 __pyx_t_3 = __pyx_t_2;
20798 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20799 __pyx_v_i = __pyx_t_4;
20800
20801 /* "View.MemoryView":1420
20802 * else:
20803 * for i in range(extent):
20804 * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
20805 * ndim - 1, itemsize, item)
20806 * data += stride
20807 */
20808 __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);
20809
20810 /* "View.MemoryView":1422
20811 * _slice_assign_scalar(data, shape + 1, strides + 1,
20812 * ndim - 1, itemsize, item)
20813 * data += stride # <<<<<<<<<<<<<<
20814 *
20815 *
20816 */
20817 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
20818 }
20819 }
20820 __pyx_L3:;
20821
20822 /* "View.MemoryView":1407
20823 *
20824 * @cname('__pyx_memoryview__slice_assign_scalar')
20825 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
20826 * Py_ssize_t *strides, int ndim,
20827 * size_t itemsize, void *item) nogil:
20828 */
20829
20830 /* function exit code */
20831}
20832
20833/* "(tree fragment)":1
20834 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
20835 * cdef object __pyx_PickleError
20836 * cdef object __pyx_result
20837 */
20838
20839/* Python wrapper */
20840static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20841static 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};
20842static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20843 PyObject *__pyx_v___pyx_type = 0;
20844 long __pyx_v___pyx_checksum;
20845 PyObject *__pyx_v___pyx_state = 0;
20846 int __pyx_lineno = 0;
20847 const char *__pyx_filename = NULL;
20848 int __pyx_clineno = 0;
20849 PyObject *__pyx_r = 0;
20850 __Pyx_RefNannyDeclarations
20851 __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
20852 {
20853 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
20854 PyObject* values[3] = {0,0,0};
20855 if (unlikely(__pyx_kwds)) {
20856 Py_ssize_t kw_args;
20857 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20858 switch (pos_args) {
20859 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20860 CYTHON_FALLTHROUGH;
20861 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20862 CYTHON_FALLTHROUGH;
20863 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20864 CYTHON_FALLTHROUGH;
20865 case 0: break;
20866 default: goto __pyx_L5_argtuple_error;
20867 }
20868 kw_args = PyDict_Size(__pyx_kwds);
20869 switch (pos_args) {
20870 case 0:
20871 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
20872 else goto __pyx_L5_argtuple_error;
20873 CYTHON_FALLTHROUGH;
20874 case 1:
20875 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
20876 else {
20877 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
20878 }
20879 CYTHON_FALLTHROUGH;
20880 case 2:
20881 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
20882 else {
20883 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
20884 }
20885 }
20886 if (unlikely(kw_args > 0)) {
20887 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
20888 }
20889 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20890 goto __pyx_L5_argtuple_error;
20891 } else {
20892 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20893 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20894 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20895 }
20896 __pyx_v___pyx_type = values[0];
20897 __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)
20898 __pyx_v___pyx_state = values[2];
20899 }
20900 goto __pyx_L4_argument_unpacking_done;
20901 __pyx_L5_argtuple_error:;
20902 __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
20903 __pyx_L3_error:;
20904 __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20905 __Pyx_RefNannyFinishContext();
20906 return NULL;
20907 __pyx_L4_argument_unpacking_done:;
20908 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
20909
20910 /* function exit code */
20911 __Pyx_RefNannyFinishContext();
20912 return __pyx_r;
20913}
20914
20915static 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) {
20916 PyObject *__pyx_v___pyx_PickleError = 0;
20917 PyObject *__pyx_v___pyx_result = 0;
20918 PyObject *__pyx_r = NULL;
20919 __Pyx_RefNannyDeclarations
20920 int __pyx_t_1;
20921 PyObject *__pyx_t_2 = NULL;
20922 PyObject *__pyx_t_3 = NULL;
20923 PyObject *__pyx_t_4 = NULL;
20924 PyObject *__pyx_t_5 = NULL;
20925 int __pyx_t_6;
20926 int __pyx_lineno = 0;
20927 const char *__pyx_filename = NULL;
20928 int __pyx_clineno = 0;
20929 __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
20930
20931 /* "(tree fragment)":4
20932 * cdef object __pyx_PickleError
20933 * cdef object __pyx_result
20934 * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
20935 * from pickle import PickleError as __pyx_PickleError
20936 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
20937 */
20938 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
20939 if (__pyx_t_1) {
20940
20941 /* "(tree fragment)":5
20942 * cdef object __pyx_result
20943 * if __pyx_checksum != 0xb068931:
20944 * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
20945 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
20946 * __pyx_result = Enum.__new__(__pyx_type)
20947 */
20948 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
20949 __Pyx_GOTREF(__pyx_t_2);
20950 __Pyx_INCREF(__pyx_n_s_PickleError);
20951 __Pyx_GIVEREF(__pyx_n_s_PickleError);
20952 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
20953 __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)
20954 __Pyx_GOTREF(__pyx_t_3);
20955 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20956 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
20957 __Pyx_GOTREF(__pyx_t_2);
20958 __Pyx_INCREF(__pyx_t_2);
20959 __pyx_v___pyx_PickleError = __pyx_t_2;
20960 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20961 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20962
20963 /* "(tree fragment)":6
20964 * if __pyx_checksum != 0xb068931:
20965 * from pickle import PickleError as __pyx_PickleError
20966 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<<
20967 * __pyx_result = Enum.__new__(__pyx_type)
20968 * if __pyx_state is not None:
20969 */
20970 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
20971 __Pyx_GOTREF(__pyx_t_2);
20972 __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)
20973 __Pyx_GOTREF(__pyx_t_4);
20974 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20975 __Pyx_INCREF(__pyx_v___pyx_PickleError);
20976 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
20977 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
20978 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
20979 if (likely(__pyx_t_5)) {
20980 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
20981 __Pyx_INCREF(__pyx_t_5);
20982 __Pyx_INCREF(function);
20983 __Pyx_DECREF_SET(__pyx_t_2, function);
20984 }
20985 }
20986 __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);
20987 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20988 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20989 if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
20990 __Pyx_GOTREF(__pyx_t_3);
20991 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20992 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20993 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20994 __PYX_ERR(2, 6, __pyx_L1_error)
20995
20996 /* "(tree fragment)":4
20997 * cdef object __pyx_PickleError
20998 * cdef object __pyx_result
20999 * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
21000 * from pickle import PickleError as __pyx_PickleError
21001 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21002 */
21003 }
21004
21005 /* "(tree fragment)":7
21006 * from pickle import PickleError as __pyx_PickleError
21007 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21008 * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<<
21009 * if __pyx_state is not None:
21010 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21011 */
21012 __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)
21013 __Pyx_GOTREF(__pyx_t_2);
21014 __pyx_t_4 = NULL;
21015 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
21016 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
21017 if (likely(__pyx_t_4)) {
21018 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
21019 __Pyx_INCREF(__pyx_t_4);
21020 __Pyx_INCREF(function);
21021 __Pyx_DECREF_SET(__pyx_t_2, function);
21022 }
21023 }
21024 __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);
21025 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
21026 if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
21027 __Pyx_GOTREF(__pyx_t_3);
21028 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21029 __pyx_v___pyx_result = __pyx_t_3;
21030 __pyx_t_3 = 0;
21031
21032 /* "(tree fragment)":8
21033 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21034 * __pyx_result = Enum.__new__(__pyx_type)
21035 * if __pyx_state is not None: # <<<<<<<<<<<<<<
21036 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21037 * return __pyx_result
21038 */
21039 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
21040 __pyx_t_6 = (__pyx_t_1 != 0);
21041 if (__pyx_t_6) {
21042
21043 /* "(tree fragment)":9
21044 * __pyx_result = Enum.__new__(__pyx_type)
21045 * if __pyx_state is not None:
21046 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
21047 * return __pyx_result
21048 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21049 */
21050 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)
21051 __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)
21052 __Pyx_GOTREF(__pyx_t_3);
21053 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21054
21055 /* "(tree fragment)":8
21056 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21057 * __pyx_result = Enum.__new__(__pyx_type)
21058 * if __pyx_state is not None: # <<<<<<<<<<<<<<
21059 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21060 * return __pyx_result
21061 */
21062 }
21063
21064 /* "(tree fragment)":10
21065 * if __pyx_state is not None:
21066 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21067 * return __pyx_result # <<<<<<<<<<<<<<
21068 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21069 * __pyx_result.name = __pyx_state[0]
21070 */
21071 __Pyx_XDECREF(__pyx_r);
21072 __Pyx_INCREF(__pyx_v___pyx_result);
21073 __pyx_r = __pyx_v___pyx_result;
21074 goto __pyx_L0;
21075
21076 /* "(tree fragment)":1
21077 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
21078 * cdef object __pyx_PickleError
21079 * cdef object __pyx_result
21080 */
21081
21082 /* function exit code */
21083 __pyx_L1_error:;
21084 __Pyx_XDECREF(__pyx_t_2);
21085 __Pyx_XDECREF(__pyx_t_3);
21086 __Pyx_XDECREF(__pyx_t_4);
21087 __Pyx_XDECREF(__pyx_t_5);
21088 __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
21089 __pyx_r = NULL;
21090 __pyx_L0:;
21091 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
21092 __Pyx_XDECREF(__pyx_v___pyx_result);
21093 __Pyx_XGIVEREF(__pyx_r);
21094 __Pyx_RefNannyFinishContext();
21095 return __pyx_r;
21096}
21097
21098/* "(tree fragment)":11
21099 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21100 * return __pyx_result
21101 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
21102 * __pyx_result.name = __pyx_state[0]
21103 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21104 */
21105
21106static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
21107 PyObject *__pyx_r = NULL;
21108 __Pyx_RefNannyDeclarations
21109 PyObject *__pyx_t_1 = NULL;
21110 int __pyx_t_2;
21111 Py_ssize_t __pyx_t_3;
21112 int __pyx_t_4;
21113 int __pyx_t_5;
21114 PyObject *__pyx_t_6 = NULL;
21115 PyObject *__pyx_t_7 = NULL;
21116 PyObject *__pyx_t_8 = NULL;
21117 int __pyx_lineno = 0;
21118 const char *__pyx_filename = NULL;
21119 int __pyx_clineno = 0;
21120 __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
21121
21122 /* "(tree fragment)":12
21123 * return __pyx_result
21124 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21125 * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<<
21126 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21127 * __pyx_result.__dict__.update(__pyx_state[1])
21128 */
21129 if (unlikely(__pyx_v___pyx_state == Py_None)) {
21130 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
21131 __PYX_ERR(2, 12, __pyx_L1_error)
21132 }
21133 __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)
21134 __Pyx_GOTREF(__pyx_t_1);
21135 __Pyx_GIVEREF(__pyx_t_1);
21136 __Pyx_GOTREF(__pyx_v___pyx_result->name);
21137 __Pyx_DECREF(__pyx_v___pyx_result->name);
21138 __pyx_v___pyx_result->name = __pyx_t_1;
21139 __pyx_t_1 = 0;
21140
21141 /* "(tree fragment)":13
21142 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21143 * __pyx_result.name = __pyx_state[0]
21144 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
21145 * __pyx_result.__dict__.update(__pyx_state[1])
21146 */
21147 if (unlikely(__pyx_v___pyx_state == Py_None)) {
21148 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
21149 __PYX_ERR(2, 13, __pyx_L1_error)
21150 }
21151 __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)
21152 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
21153 if (__pyx_t_4) {
21154 } else {
21155 __pyx_t_2 = __pyx_t_4;
21156 goto __pyx_L4_bool_binop_done;
21157 }
21158 __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)
21159 __pyx_t_5 = (__pyx_t_4 != 0);
21160 __pyx_t_2 = __pyx_t_5;
21161 __pyx_L4_bool_binop_done:;
21162 if (__pyx_t_2) {
21163
21164 /* "(tree fragment)":14
21165 * __pyx_result.name = __pyx_state[0]
21166 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21167 * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
21168 */
21169 __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)
21170 __Pyx_GOTREF(__pyx_t_6);
21171 __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)
21172 __Pyx_GOTREF(__pyx_t_7);
21173 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21174 if (unlikely(__pyx_v___pyx_state == Py_None)) {
21175 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
21176 __PYX_ERR(2, 14, __pyx_L1_error)
21177 }
21178 __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)
21179 __Pyx_GOTREF(__pyx_t_6);
21180 __pyx_t_8 = NULL;
21181 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
21182 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
21183 if (likely(__pyx_t_8)) {
21184 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
21185 __Pyx_INCREF(__pyx_t_8);
21186 __Pyx_INCREF(function);
21187 __Pyx_DECREF_SET(__pyx_t_7, function);
21188 }
21189 }
21190 __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);
21191 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
21192 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21193 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
21194 __Pyx_GOTREF(__pyx_t_1);
21195 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
21196 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21197
21198 /* "(tree fragment)":13
21199 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21200 * __pyx_result.name = __pyx_state[0]
21201 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
21202 * __pyx_result.__dict__.update(__pyx_state[1])
21203 */
21204 }
21205
21206 /* "(tree fragment)":11
21207 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21208 * return __pyx_result
21209 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
21210 * __pyx_result.name = __pyx_state[0]
21211 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21212 */
21213
21214 /* function exit code */
21215 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21216 goto __pyx_L0;
21217 __pyx_L1_error:;
21218 __Pyx_XDECREF(__pyx_t_1);
21219 __Pyx_XDECREF(__pyx_t_6);
21220 __Pyx_XDECREF(__pyx_t_7);
21221 __Pyx_XDECREF(__pyx_t_8);
21222 __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
21223 __pyx_r = 0;
21224 __pyx_L0:;
21225 __Pyx_XGIVEREF(__pyx_r);
21226 __Pyx_RefNannyFinishContext();
21227 return __pyx_r;
21228}
21229static struct __pyx_vtabstruct_array __pyx_vtable_array;
21230
21231static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
21232 struct __pyx_array_obj *p;
21233 PyObject *o;
21234 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21235 o = (*t->tp_alloc)(t, 0);
21236 } else {
21237 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21238 }
21239 if (unlikely(!o)) return 0;
21240 p = ((struct __pyx_array_obj *)o);
21241 p->__pyx_vtab = __pyx_vtabptr_array;
21242 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
21243 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
21244 if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
21245 return o;
21246 bad:
21247 Py_DECREF(o); o = 0;
21248 return NULL;
21249}
21250
21251static void __pyx_tp_dealloc_array(PyObject *o) {
21252 struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
21253 #if CYTHON_USE_TP_FINALIZE
21254 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))) {
21255 if (PyObject_CallFinalizerFromDealloc(o)) return;
21256 }
21257 #endif
21258 {
21259 PyObject *etype, *eval, *etb;
21260 PyErr_Fetch(&etype, &eval, &etb);
21261 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21262 __pyx_array___dealloc__(o);
21263 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21264 PyErr_Restore(etype, eval, etb);
21265 }
21266 Py_CLEAR(p->mode);
21267 Py_CLEAR(p->_format);
21268 (*Py_TYPE(o)->tp_free)(o);
21269}
21270static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
21271 PyObject *r;
21272 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
21273 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
21274 Py_DECREF(x);
21275 return r;
21276}
21277
21278static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
21279 if (v) {
21280 return __pyx_array___setitem__(o, i, v);
21281 }
21282 else {
21283 PyErr_Format(PyExc_NotImplementedError,
21284 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
21285 return -1;
21286 }
21287}
21288
21289static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
21290 PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
21291 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
21292 PyErr_Clear();
21293 v = __pyx_array___getattr__(o, n);
21294 }
21295 return v;
21296}
21297
21298static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
21299 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
21300}
21301
21302static PyMethodDef __pyx_methods_array[] = {
21303 {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
21304 {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
21305 {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
21306 {0, 0, 0, 0}
21307};
21308
21309static struct PyGetSetDef __pyx_getsets_array[] = {
21310 {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
21311 {0, 0, 0, 0, 0}
21312};
21313
21314static PySequenceMethods __pyx_tp_as_sequence_array = {
21315 __pyx_array___len__, /*sq_length*/
21316 0, /*sq_concat*/
21317 0, /*sq_repeat*/
21318 __pyx_sq_item_array, /*sq_item*/
21319 0, /*sq_slice*/
21320 0, /*sq_ass_item*/
21321 0, /*sq_ass_slice*/
21322 0, /*sq_contains*/
21323 0, /*sq_inplace_concat*/
21324 0, /*sq_inplace_repeat*/
21325};
21326
21327static PyMappingMethods __pyx_tp_as_mapping_array = {
21328 __pyx_array___len__, /*mp_length*/
21329 __pyx_array___getitem__, /*mp_subscript*/
21330 __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
21331};
21332
21333static PyBufferProcs __pyx_tp_as_buffer_array = {
21334 #if PY_MAJOR_VERSION < 3
21335 0, /*bf_getreadbuffer*/
21336 #endif
21337 #if PY_MAJOR_VERSION < 3
21338 0, /*bf_getwritebuffer*/
21339 #endif
21340 #if PY_MAJOR_VERSION < 3
21341 0, /*bf_getsegcount*/
21342 #endif
21343 #if PY_MAJOR_VERSION < 3
21344 0, /*bf_getcharbuffer*/
21345 #endif
21346 __pyx_array_getbuffer, /*bf_getbuffer*/
21347 0, /*bf_releasebuffer*/
21348};
21349
21350static PyTypeObject __pyx_type___pyx_array = {
21351 PyVarObject_HEAD_INIT(0, 0)
21352 "rank_cy.array", /*tp_name*/
21353 sizeof(struct __pyx_array_obj), /*tp_basicsize*/
21354 0, /*tp_itemsize*/
21355 __pyx_tp_dealloc_array, /*tp_dealloc*/
21356 #if PY_VERSION_HEX < 0x030800b4
21357 0, /*tp_print*/
21358 #endif
21359 #if PY_VERSION_HEX >= 0x030800b4
21360 0, /*tp_vectorcall_offset*/
21361 #endif
21362 0, /*tp_getattr*/
21363 0, /*tp_setattr*/
21364 #if PY_MAJOR_VERSION < 3
21365 0, /*tp_compare*/
21366 #endif
21367 #if PY_MAJOR_VERSION >= 3
21368 0, /*tp_as_async*/
21369 #endif
21370 0, /*tp_repr*/
21371 0, /*tp_as_number*/
21372 &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
21373 &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
21374 0, /*tp_hash*/
21375 0, /*tp_call*/
21376 0, /*tp_str*/
21377 __pyx_tp_getattro_array, /*tp_getattro*/
21378 0, /*tp_setattro*/
21379 &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
21380 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
21381 0, /*tp_doc*/
21382 0, /*tp_traverse*/
21383 0, /*tp_clear*/
21384 0, /*tp_richcompare*/
21385 0, /*tp_weaklistoffset*/
21386 0, /*tp_iter*/
21387 0, /*tp_iternext*/
21388 __pyx_methods_array, /*tp_methods*/
21389 0, /*tp_members*/
21390 __pyx_getsets_array, /*tp_getset*/
21391 0, /*tp_base*/
21392 0, /*tp_dict*/
21393 0, /*tp_descr_get*/
21394 0, /*tp_descr_set*/
21395 0, /*tp_dictoffset*/
21396 0, /*tp_init*/
21397 0, /*tp_alloc*/
21398 __pyx_tp_new_array, /*tp_new*/
21399 0, /*tp_free*/
21400 0, /*tp_is_gc*/
21401 0, /*tp_bases*/
21402 0, /*tp_mro*/
21403 0, /*tp_cache*/
21404 0, /*tp_subclasses*/
21405 0, /*tp_weaklist*/
21406 0, /*tp_del*/
21407 0, /*tp_version_tag*/
21408 #if PY_VERSION_HEX >= 0x030400a1
21409 0, /*tp_finalize*/
21410 #endif
21411 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
21412 0, /*tp_vectorcall*/
21413 #endif
21414 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21415 0, /*tp_print*/
21416 #endif
21417 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
21418 0, /*tp_pypy_flags*/
21419 #endif
21420};
21421
21422static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
21423 struct __pyx_MemviewEnum_obj *p;
21424 PyObject *o;
21425 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21426 o = (*t->tp_alloc)(t, 0);
21427 } else {
21428 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21429 }
21430 if (unlikely(!o)) return 0;
21431 p = ((struct __pyx_MemviewEnum_obj *)o);
21432 p->name = Py_None; Py_INCREF(Py_None);
21433 return o;
21434}
21435
21436static void __pyx_tp_dealloc_Enum(PyObject *o) {
21437 struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
21438 #if CYTHON_USE_TP_FINALIZE
21439 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21440 if (PyObject_CallFinalizerFromDealloc(o)) return;
21441 }
21442 #endif
21443 PyObject_GC_UnTrack(o);
21444 Py_CLEAR(p->name);
21445 (*Py_TYPE(o)->tp_free)(o);
21446}
21447
21448static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
21449 int e;
21450 struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
21451 if (p->name) {
21452 e = (*v)(p->name, a); if (e) return e;
21453 }
21454 return 0;
21455}
21456
21457static int __pyx_tp_clear_Enum(PyObject *o) {
21458 PyObject* tmp;
21459 struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
21460 tmp = ((PyObject*)p->name);
21461 p->name = Py_None; Py_INCREF(Py_None);
21462 Py_XDECREF(tmp);
21463 return 0;
21464}
21465
21466static PyMethodDef __pyx_methods_Enum[] = {
21467 {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
21468 {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
21469 {0, 0, 0, 0}
21470};
21471
21472static PyTypeObject __pyx_type___pyx_MemviewEnum = {
21473 PyVarObject_HEAD_INIT(0, 0)
21474 "rank_cy.Enum", /*tp_name*/
21475 sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
21476 0, /*tp_itemsize*/
21477 __pyx_tp_dealloc_Enum, /*tp_dealloc*/
21478 #if PY_VERSION_HEX < 0x030800b4
21479 0, /*tp_print*/
21480 #endif
21481 #if PY_VERSION_HEX >= 0x030800b4
21482 0, /*tp_vectorcall_offset*/
21483 #endif
21484 0, /*tp_getattr*/
21485 0, /*tp_setattr*/
21486 #if PY_MAJOR_VERSION < 3
21487 0, /*tp_compare*/
21488 #endif
21489 #if PY_MAJOR_VERSION >= 3
21490 0, /*tp_as_async*/
21491 #endif
21492 __pyx_MemviewEnum___repr__, /*tp_repr*/
21493 0, /*tp_as_number*/
21494 0, /*tp_as_sequence*/
21495 0, /*tp_as_mapping*/
21496 0, /*tp_hash*/
21497 0, /*tp_call*/
21498 0, /*tp_str*/
21499 0, /*tp_getattro*/
21500 0, /*tp_setattro*/
21501 0, /*tp_as_buffer*/
21502 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
21503 0, /*tp_doc*/
21504 __pyx_tp_traverse_Enum, /*tp_traverse*/
21505 __pyx_tp_clear_Enum, /*tp_clear*/
21506 0, /*tp_richcompare*/
21507 0, /*tp_weaklistoffset*/
21508 0, /*tp_iter*/
21509 0, /*tp_iternext*/
21510 __pyx_methods_Enum, /*tp_methods*/
21511 0, /*tp_members*/
21512 0, /*tp_getset*/
21513 0, /*tp_base*/
21514 0, /*tp_dict*/
21515 0, /*tp_descr_get*/
21516 0, /*tp_descr_set*/
21517 0, /*tp_dictoffset*/
21518 __pyx_MemviewEnum___init__, /*tp_init*/
21519 0, /*tp_alloc*/
21520 __pyx_tp_new_Enum, /*tp_new*/
21521 0, /*tp_free*/
21522 0, /*tp_is_gc*/
21523 0, /*tp_bases*/
21524 0, /*tp_mro*/
21525 0, /*tp_cache*/
21526 0, /*tp_subclasses*/
21527 0, /*tp_weaklist*/
21528 0, /*tp_del*/
21529 0, /*tp_version_tag*/
21530 #if PY_VERSION_HEX >= 0x030400a1
21531 0, /*tp_finalize*/
21532 #endif
21533 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
21534 0, /*tp_vectorcall*/
21535 #endif
21536 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21537 0, /*tp_print*/
21538 #endif
21539 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
21540 0, /*tp_pypy_flags*/
21541 #endif
21542};
21543static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
21544
21545static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
21546 struct __pyx_memoryview_obj *p;
21547 PyObject *o;
21548 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21549 o = (*t->tp_alloc)(t, 0);
21550 } else {
21551 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21552 }
21553 if (unlikely(!o)) return 0;
21554 p = ((struct __pyx_memoryview_obj *)o);
21555 p->__pyx_vtab = __pyx_vtabptr_memoryview;
21556 p->obj = Py_None; Py_INCREF(Py_None);
21557 p->_size = Py_None; Py_INCREF(Py_None);
21558 p->_array_interface = Py_None; Py_INCREF(Py_None);
21559 p->view.obj = NULL;
21560 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
21561 return o;
21562 bad:
21563 Py_DECREF(o); o = 0;
21564 return NULL;
21565}
21566
21567static void __pyx_tp_dealloc_memoryview(PyObject *o) {
21568 struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
21569 #if CYTHON_USE_TP_FINALIZE
21570 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21571 if (PyObject_CallFinalizerFromDealloc(o)) return;
21572 }
21573 #endif
21574 PyObject_GC_UnTrack(o);
21575 {
21576 PyObject *etype, *eval, *etb;
21577 PyErr_Fetch(&etype, &eval, &etb);
21578 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21579 __pyx_memoryview___dealloc__(o);
21580 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21581 PyErr_Restore(etype, eval, etb);
21582 }
21583 Py_CLEAR(p->obj);
21584 Py_CLEAR(p->_size);
21585 Py_CLEAR(p->_array_interface);
21586 (*Py_TYPE(o)->tp_free)(o);
21587}
21588
21589static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
21590 int e;
21591 struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
21592 if (p->obj) {
21593 e = (*v)(p->obj, a); if (e) return e;
21594 }
21595 if (p->_size) {
21596 e = (*v)(p->_size, a); if (e) return e;
21597 }
21598 if (p->_array_interface) {
21599 e = (*v)(p->_array_interface, a); if (e) return e;
21600 }
21601 if (p->view.obj) {
21602 e = (*v)(p->view.obj, a); if (e) return e;
21603 }
21604 return 0;
21605}
21606
21607static int __pyx_tp_clear_memoryview(PyObject *o) {
21608 PyObject* tmp;
21609 struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
21610 tmp = ((PyObject*)p->obj);
21611 p->obj = Py_None; Py_INCREF(Py_None);
21612 Py_XDECREF(tmp);
21613 tmp = ((PyObject*)p->_size);
21614 p->_size = Py_None; Py_INCREF(Py_None);
21615 Py_XDECREF(tmp);
21616 tmp = ((PyObject*)p->_array_interface);
21617 p->_array_interface = Py_None; Py_INCREF(Py_None);
21618 Py_XDECREF(tmp);
21619 Py_CLEAR(p->view.obj);
21620 return 0;
21621}
21622static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
21623 PyObject *r;
21624 PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
21625 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
21626 Py_DECREF(x);
21627 return r;
21628}
21629
21630static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
21631 if (v) {
21632 return __pyx_memoryview___setitem__(o, i, v);
21633 }
21634 else {
21635 PyErr_Format(PyExc_NotImplementedError,
21636 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
21637 return -1;
21638 }
21639}
21640
21641static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
21642 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
21643}
21644
21645static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
21646 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
21647}
21648
21649static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
21650 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
21651}
21652
21653static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
21654 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
21655}
21656
21657static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
21658 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
21659}
21660
21661static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
21662 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
21663}
21664
21665static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
21666 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
21667}
21668
21669static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
21670 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
21671}
21672
21673static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
21674 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
21675}
21676
21677static PyMethodDef __pyx_methods_memoryview[] = {
21678 {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
21679 {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
21680 {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
21681 {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
21682 {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
21683 {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
21684 {0, 0, 0, 0}
21685};
21686
21687static struct PyGetSetDef __pyx_getsets_memoryview[] = {
21688 {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
21689 {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
21690 {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
21691 {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
21692 {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
21693 {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
21694 {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
21695 {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
21696 {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
21697 {0, 0, 0, 0, 0}
21698};
21699
21700static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
21701 __pyx_memoryview___len__, /*sq_length*/
21702 0, /*sq_concat*/
21703 0, /*sq_repeat*/
21704 __pyx_sq_item_memoryview, /*sq_item*/
21705 0, /*sq_slice*/
21706 0, /*sq_ass_item*/
21707 0, /*sq_ass_slice*/
21708 0, /*sq_contains*/
21709 0, /*sq_inplace_concat*/
21710 0, /*sq_inplace_repeat*/
21711};
21712
21713static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
21714 __pyx_memoryview___len__, /*mp_length*/
21715 __pyx_memoryview___getitem__, /*mp_subscript*/
21716 __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
21717};
21718
21719static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
21720 #if PY_MAJOR_VERSION < 3
21721 0, /*bf_getreadbuffer*/
21722 #endif
21723 #if PY_MAJOR_VERSION < 3
21724 0, /*bf_getwritebuffer*/
21725 #endif
21726 #if PY_MAJOR_VERSION < 3
21727 0, /*bf_getsegcount*/
21728 #endif
21729 #if PY_MAJOR_VERSION < 3
21730 0, /*bf_getcharbuffer*/
21731 #endif
21732 __pyx_memoryview_getbuffer, /*bf_getbuffer*/
21733 0, /*bf_releasebuffer*/
21734};
21735
21736static PyTypeObject __pyx_type___pyx_memoryview = {
21737 PyVarObject_HEAD_INIT(0, 0)
21738 "rank_cy.memoryview", /*tp_name*/
21739 sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
21740 0, /*tp_itemsize*/
21741 __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
21742 #if PY_VERSION_HEX < 0x030800b4
21743 0, /*tp_print*/
21744 #endif
21745 #if PY_VERSION_HEX >= 0x030800b4
21746 0, /*tp_vectorcall_offset*/
21747 #endif
21748 0, /*tp_getattr*/
21749 0, /*tp_setattr*/
21750 #if PY_MAJOR_VERSION < 3
21751 0, /*tp_compare*/
21752 #endif
21753 #if PY_MAJOR_VERSION >= 3
21754 0, /*tp_as_async*/
21755 #endif
21756 __pyx_memoryview___repr__, /*tp_repr*/
21757 0, /*tp_as_number*/
21758 &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
21759 &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
21760 0, /*tp_hash*/
21761 0, /*tp_call*/
21762 __pyx_memoryview___str__, /*tp_str*/
21763 0, /*tp_getattro*/
21764 0, /*tp_setattro*/
21765 &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
21766 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
21767 0, /*tp_doc*/
21768 __pyx_tp_traverse_memoryview, /*tp_traverse*/
21769 __pyx_tp_clear_memoryview, /*tp_clear*/
21770 0, /*tp_richcompare*/
21771 0, /*tp_weaklistoffset*/
21772 0, /*tp_iter*/
21773 0, /*tp_iternext*/
21774 __pyx_methods_memoryview, /*tp_methods*/
21775 0, /*tp_members*/
21776 __pyx_getsets_memoryview, /*tp_getset*/
21777 0, /*tp_base*/
21778 0, /*tp_dict*/
21779 0, /*tp_descr_get*/
21780 0, /*tp_descr_set*/
21781 0, /*tp_dictoffset*/
21782 0, /*tp_init*/
21783 0, /*tp_alloc*/
21784 __pyx_tp_new_memoryview, /*tp_new*/
21785 0, /*tp_free*/
21786 0, /*tp_is_gc*/
21787 0, /*tp_bases*/
21788 0, /*tp_mro*/
21789 0, /*tp_cache*/
21790 0, /*tp_subclasses*/
21791 0, /*tp_weaklist*/
21792 0, /*tp_del*/
21793 0, /*tp_version_tag*/
21794 #if PY_VERSION_HEX >= 0x030400a1
21795 0, /*tp_finalize*/
21796 #endif
21797 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
21798 0, /*tp_vectorcall*/
21799 #endif
21800 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21801 0, /*tp_print*/
21802 #endif
21803 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
21804 0, /*tp_pypy_flags*/
21805 #endif
21806};
21807static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
21808
21809static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
21810 struct __pyx_memoryviewslice_obj *p;
21811 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
21812 if (unlikely(!o)) return 0;
21813 p = ((struct __pyx_memoryviewslice_obj *)o);
21814 p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
21815 p->from_object = Py_None; Py_INCREF(Py_None);
21816 p->from_slice.memview = NULL;
21817 return o;
21818}
21819
21820static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
21821 struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
21822 #if CYTHON_USE_TP_FINALIZE
21823 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21824 if (PyObject_CallFinalizerFromDealloc(o)) return;
21825 }
21826 #endif
21827 PyObject_GC_UnTrack(o);
21828 {
21829 PyObject *etype, *eval, *etb;
21830 PyErr_Fetch(&etype, &eval, &etb);
21831 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21832 __pyx_memoryviewslice___dealloc__(o);
21833 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21834 PyErr_Restore(etype, eval, etb);
21835 }
21836 Py_CLEAR(p->from_object);
21837 PyObject_GC_Track(o);
21838 __pyx_tp_dealloc_memoryview(o);
21839}
21840
21841static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
21842 int e;
21843 struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
21844 e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
21845 if (p->from_object) {
21846 e = (*v)(p->from_object, a); if (e) return e;
21847 }
21848 return 0;
21849}
21850
21851static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
21852 PyObject* tmp;
21853 struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
21854 __pyx_tp_clear_memoryview(o);
21855 tmp = ((PyObject*)p->from_object);
21856 p->from_object = Py_None; Py_INCREF(Py_None);
21857 Py_XDECREF(tmp);
21858 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
21859 return 0;
21860}
21861
21862static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
21863 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
21864}
21865
21866static PyMethodDef __pyx_methods__memoryviewslice[] = {
21867 {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
21868 {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
21869 {0, 0, 0, 0}
21870};
21871
21872static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
21873 {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
21874 {0, 0, 0, 0, 0}
21875};
21876
21877static PyTypeObject __pyx_type___pyx_memoryviewslice = {
21878 PyVarObject_HEAD_INIT(0, 0)
21879 "rank_cy._memoryviewslice", /*tp_name*/
21880 sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
21881 0, /*tp_itemsize*/
21882 __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
21883 #if PY_VERSION_HEX < 0x030800b4
21884 0, /*tp_print*/
21885 #endif
21886 #if PY_VERSION_HEX >= 0x030800b4
21887 0, /*tp_vectorcall_offset*/
21888 #endif
21889 0, /*tp_getattr*/
21890 0, /*tp_setattr*/
21891 #if PY_MAJOR_VERSION < 3
21892 0, /*tp_compare*/
21893 #endif
21894 #if PY_MAJOR_VERSION >= 3
21895 0, /*tp_as_async*/
21896 #endif
21897 #if CYTHON_COMPILING_IN_PYPY
21898 __pyx_memoryview___repr__, /*tp_repr*/
21899 #else
21900 0, /*tp_repr*/
21901 #endif
21902 0, /*tp_as_number*/
21903 0, /*tp_as_sequence*/
21904 0, /*tp_as_mapping*/
21905 0, /*tp_hash*/
21906 0, /*tp_call*/
21907 #if CYTHON_COMPILING_IN_PYPY
21908 __pyx_memoryview___str__, /*tp_str*/
21909 #else
21910 0, /*tp_str*/
21911 #endif
21912 0, /*tp_getattro*/
21913 0, /*tp_setattro*/
21914 0, /*tp_as_buffer*/
21915 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
21916 "Internal class for passing memoryview slices to Python", /*tp_doc*/
21917 __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
21918 __pyx_tp_clear__memoryviewslice, /*tp_clear*/
21919 0, /*tp_richcompare*/
21920 0, /*tp_weaklistoffset*/
21921 0, /*tp_iter*/
21922 0, /*tp_iternext*/
21923 __pyx_methods__memoryviewslice, /*tp_methods*/
21924 0, /*tp_members*/
21925 __pyx_getsets__memoryviewslice, /*tp_getset*/
21926 0, /*tp_base*/
21927 0, /*tp_dict*/
21928 0, /*tp_descr_get*/
21929 0, /*tp_descr_set*/
21930 0, /*tp_dictoffset*/
21931 0, /*tp_init*/
21932 0, /*tp_alloc*/
21933 __pyx_tp_new__memoryviewslice, /*tp_new*/
21934 0, /*tp_free*/
21935 0, /*tp_is_gc*/
21936 0, /*tp_bases*/
21937 0, /*tp_mro*/
21938 0, /*tp_cache*/
21939 0, /*tp_subclasses*/
21940 0, /*tp_weaklist*/
21941 0, /*tp_del*/
21942 0, /*tp_version_tag*/
21943 #if PY_VERSION_HEX >= 0x030400a1
21944 0, /*tp_finalize*/
21945 #endif
21946 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
21947 0, /*tp_vectorcall*/
21948 #endif
21949 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21950 0, /*tp_print*/
21951 #endif
21952 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
21953 0, /*tp_pypy_flags*/
21954 #endif
21955};
21956
21957static PyMethodDef __pyx_methods[] = {
21958 {"evaluate_cy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7rank_cy_1evaluate_cy, METH_VARARGS|METH_KEYWORDS, 0},
21959 {"eval_cuhk03_cy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7rank_cy_3eval_cuhk03_cy, METH_VARARGS|METH_KEYWORDS, 0},
21960 {"eval_market1501_cy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7rank_cy_5eval_market1501_cy, METH_VARARGS|METH_KEYWORDS, 0},
21961 {0, 0, 0, 0}
21962};
21963
21964#if PY_MAJOR_VERSION >= 3
21965#if CYTHON_PEP489_MULTI_PHASE_INIT
21966static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
21967static int __pyx_pymod_exec_rank_cy(PyObject* module); /*proto*/
21968static PyModuleDef_Slot __pyx_moduledef_slots[] = {
21969 {Py_mod_create, (void*)__pyx_pymod_create},
21970 {Py_mod_exec, (void*)__pyx_pymod_exec_rank_cy},
21971 {0, NULL}
21972};
21973#endif
21974
21975static struct PyModuleDef __pyx_moduledef = {
21976 PyModuleDef_HEAD_INIT,
21977 "rank_cy",
21978 0, /* m_doc */
21979 #if CYTHON_PEP489_MULTI_PHASE_INIT
21980 0, /* m_size */
21981 #else
21982 -1, /* m_size */
21983 #endif
21984 __pyx_methods /* m_methods */,
21985 #if CYTHON_PEP489_MULTI_PHASE_INIT
21986 __pyx_moduledef_slots, /* m_slots */
21987 #else
21988 NULL, /* m_reload */
21989 #endif
21990 NULL, /* m_traverse */
21991 NULL, /* m_clear */
21992 NULL /* m_free */
21993};
21994#endif
21995#ifndef CYTHON_SMALL_CODE
21996#if defined(__clang__)
21997 #define CYTHON_SMALL_CODE
21998#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
21999 #define CYTHON_SMALL_CODE __attribute__((cold))
22000#else
22001 #define CYTHON_SMALL_CODE
22002#endif
22003#endif
22004
22005static __Pyx_StringTabEntry __pyx_string_tab[] = {
22006 {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
22007 {&__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},
22008 {&__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},
22009 {&__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},
22010 {&__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},
22011 {&__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},
22012 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
22013 {&__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},
22014 {&__pyx_kp_s_Error_all_query_identities_do_no, __pyx_k_Error_all_query_identities_do_no, sizeof(__pyx_k_Error_all_query_identities_do_no), 0, 0, 1, 0},
22015 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
22016 {&__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},
22017 {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
22018 {&__pyx_n_s_IndexFlatL2, __pyx_k_IndexFlatL2, sizeof(__pyx_k_IndexFlatL2), 0, 0, 1, 1},
22019 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
22020 {&__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},
22021 {&__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},
22022 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
22023 {&__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},
22024 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
22025 {&__pyx_kp_s_Note_number_of_gallery_samples_i, __pyx_k_Note_number_of_gallery_samples_i, sizeof(__pyx_k_Note_number_of_gallery_samples_i), 0, 0, 1, 0},
22026 {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
22027 {&__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},
22028 {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
22029 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
22030 {&__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},
22031 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
22032 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
22033 {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
22034 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
22035 {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
22036 {&__pyx_n_s_argsort, __pyx_k_argsort, sizeof(__pyx_k_argsort), 0, 0, 1, 1},
22037 {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1},
22038 {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
22039 {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1},
22040 {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
22041 {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
22042 {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
22043 {&__pyx_n_s_choice, __pyx_k_choice, sizeof(__pyx_k_choice), 0, 0, 1, 1},
22044 {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
22045 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
22046 {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
22047 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
22048 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
22049 {&__pyx_n_s_defaultdict, __pyx_k_defaultdict, sizeof(__pyx_k_defaultdict), 0, 0, 1, 1},
22050 {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
22051 {&__pyx_n_s_distmat, __pyx_k_distmat, sizeof(__pyx_k_distmat), 0, 0, 1, 1},
22052 {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
22053 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
22054 {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
22055 {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
22056 {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
22057 {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
22058 {&__pyx_n_s_faiss, __pyx_k_faiss, sizeof(__pyx_k_faiss), 0, 0, 1, 1},
22059 {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
22060 {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
22061 {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
22062 {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
22063 {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
22064 {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
22065 {&__pyx_n_s_g_camids, __pyx_k_g_camids, sizeof(__pyx_k_g_camids), 0, 0, 1, 1},
22066 {&__pyx_n_s_g_feats, __pyx_k_g_feats, sizeof(__pyx_k_g_feats), 0, 0, 1, 1},
22067 {&__pyx_n_s_g_pids, __pyx_k_g_pids, sizeof(__pyx_k_g_pids), 0, 0, 1, 1},
22068 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
22069 {&__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},
22070 {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
22071 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
22072 {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1},
22073 {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
22074 {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
22075 {&__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},
22076 {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
22077 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
22078 {&__pyx_n_s_max_rank, __pyx_k_max_rank, sizeof(__pyx_k_max_rank), 0, 0, 1, 1},
22079 {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
22080 {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
22081 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
22082 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
22083 {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
22084 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
22085 {&__pyx_n_s_newaxis, __pyx_k_newaxis, sizeof(__pyx_k_newaxis), 0, 0, 1, 1},
22086 {&__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},
22087 {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
22088 {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
22089 {&__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},
22090 {&__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},
22091 {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
22092 {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
22093 {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
22094 {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
22095 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
22096 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
22097 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
22098 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
22099 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
22100 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
22101 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
22102 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
22103 {&__pyx_n_s_q_camids, __pyx_k_q_camids, sizeof(__pyx_k_q_camids), 0, 0, 1, 1},
22104 {&__pyx_n_s_q_feats, __pyx_k_q_feats, sizeof(__pyx_k_q_feats), 0, 0, 1, 1},
22105 {&__pyx_n_s_q_pids, __pyx_k_q_pids, sizeof(__pyx_k_q_pids), 0, 0, 1, 1},
22106 {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1},
22107 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
22108 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
22109 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
22110 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
22111 {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1},
22112 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
22113 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
22114 {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
22115 {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
22116 {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
22117 {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
22118 {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
22119 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
22120 {&__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},
22121 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
22122 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
22123 {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
22124 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
22125 {&__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},
22126 {&__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},
22127 {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
22128 {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
22129 {&__pyx_n_s_use_distmat, __pyx_k_use_distmat, sizeof(__pyx_k_use_distmat), 0, 0, 1, 1},
22130 {&__pyx_n_s_use_metric_cuhk03, __pyx_k_use_metric_cuhk03, sizeof(__pyx_k_use_metric_cuhk03), 0, 0, 1, 1},
22131 {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
22132 {0, 0, 0, 0, 0, 0, 0}
22133};
22134static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
22135 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 79, __pyx_L1_error)
22136 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
22137 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 133, __pyx_L1_error)
22138 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
22139 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error)
22140 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
22141 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
22142 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
22143 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
22144 return 0;
22145 __pyx_L1_error:;
22146 return -1;
22147}
22148
22149static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
22150 __Pyx_RefNannyDeclarations
22151 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
22152
22153 /* "rank_cy.pyx":57
22154 * cdef:
22155 * long num_repeats = 10
22156 * long[:,:] matches = (np.asarray(g_pids)[np.asarray(indices)] == np.asarray(q_pids)[:, np.newaxis]).astype(np.int64) # <<<<<<<<<<<<<<
22157 *
22158 * float[:,:] all_cmc = np.zeros((num_q, max_rank), dtype=np.float32)
22159 */
22160 __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 57, __pyx_L1_error)
22161 __Pyx_GOTREF(__pyx_slice_);
22162 __Pyx_GIVEREF(__pyx_slice_);
22163
22164 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":945
22165 * __pyx_import_array()
22166 * except Exception:
22167 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
22168 *
22169 * cdef inline int import_umath() except -1:
22170 */
22171 __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)
22172 __Pyx_GOTREF(__pyx_tuple__2);
22173 __Pyx_GIVEREF(__pyx_tuple__2);
22174
22175 /* "../../../../../../opt/conda/envs/LUP/lib/python3.8/site-packages/numpy/__init__.pxd":951
22176 * _import_umath()
22177 * except Exception:
22178 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
22179 *
22180 * cdef inline int import_ufunc() except -1:
22181 */
22182 __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)
22183 __Pyx_GOTREF(__pyx_tuple__3);
22184 __Pyx_GIVEREF(__pyx_tuple__3);
22185
22186 /* "View.MemoryView":133
22187 *
22188 * if not self.ndim:
22189 * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
22190 *
22191 * if itemsize <= 0:
22192 */
22193 __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)
22194 __Pyx_GOTREF(__pyx_tuple__4);
22195 __Pyx_GIVEREF(__pyx_tuple__4);
22196
22197 /* "View.MemoryView":136
22198 *
22199 * if itemsize <= 0:
22200 * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
22201 *
22202 * if not isinstance(format, bytes):
22203 */
22204 __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)
22205 __Pyx_GOTREF(__pyx_tuple__5);
22206 __Pyx_GIVEREF(__pyx_tuple__5);
22207
22208 /* "View.MemoryView":148
22209 *
22210 * if not self._shape:
22211 * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
22212 *
22213 *
22214 */
22215 __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)
22216 __Pyx_GOTREF(__pyx_tuple__6);
22217 __Pyx_GIVEREF(__pyx_tuple__6);
22218
22219 /* "View.MemoryView":176
22220 * self.data = <char *>malloc(self.len)
22221 * if not self.data:
22222 * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
22223 *
22224 * if self.dtype_is_object:
22225 */
22226 __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)
22227 __Pyx_GOTREF(__pyx_tuple__7);
22228 __Pyx_GIVEREF(__pyx_tuple__7);
22229
22230 /* "View.MemoryView":192
22231 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
22232 * if not (flags & bufmode):
22233 * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
22234 * info.buf = self.data
22235 * info.len = self.len
22236 */
22237 __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)
22238 __Pyx_GOTREF(__pyx_tuple__8);
22239 __Pyx_GIVEREF(__pyx_tuple__8);
22240
22241 /* "(tree fragment)":2
22242 * def __reduce_cython__(self):
22243 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
22244 * def __setstate_cython__(self, __pyx_state):
22245 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
22246 */
22247 __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)
22248 __Pyx_GOTREF(__pyx_tuple__9);
22249 __Pyx_GIVEREF(__pyx_tuple__9);
22250
22251 /* "(tree fragment)":4
22252 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
22253 * def __setstate_cython__(self, __pyx_state):
22254 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
22255 */
22256 __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)
22257 __Pyx_GOTREF(__pyx_tuple__10);
22258 __Pyx_GIVEREF(__pyx_tuple__10);
22259
22260 /* "View.MemoryView":418
22261 * def __setitem__(memoryview self, object index, object value):
22262 * if self.view.readonly:
22263 * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
22264 *
22265 * have_slices, index = _unellipsify(index, self.view.ndim)
22266 */
22267 __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)
22268 __Pyx_GOTREF(__pyx_tuple__11);
22269 __Pyx_GIVEREF(__pyx_tuple__11);
22270
22271 /* "View.MemoryView":495
22272 * result = struct.unpack(self.view.format, bytesitem)
22273 * except struct.error:
22274 * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
22275 * else:
22276 * if len(self.view.format) == 1:
22277 */
22278 __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)
22279 __Pyx_GOTREF(__pyx_tuple__12);
22280 __Pyx_GIVEREF(__pyx_tuple__12);
22281
22282 /* "View.MemoryView":520
22283 * def __getbuffer__(self, Py_buffer *info, int flags):
22284 * if flags & PyBUF_WRITABLE and self.view.readonly:
22285 * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
22286 *
22287 * if flags & PyBUF_ND:
22288 */
22289 __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)
22290 __Pyx_GOTREF(__pyx_tuple__13);
22291 __Pyx_GIVEREF(__pyx_tuple__13);
22292
22293 /* "View.MemoryView":570
22294 * if self.view.strides == NULL:
22295 *
22296 * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
22297 *
22298 * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
22299 */
22300 __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)
22301 __Pyx_GOTREF(__pyx_tuple__14);
22302 __Pyx_GIVEREF(__pyx_tuple__14);
22303
22304 /* "View.MemoryView":577
22305 * def suboffsets(self):
22306 * if self.view.suboffsets == NULL:
22307 * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
22308 *
22309 * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
22310 */
22311 __pyx_tuple__15 = PyTuple_New(1); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 577, __pyx_L1_error)
22312 __Pyx_GOTREF(__pyx_tuple__15);
22313 __Pyx_INCREF(__pyx_int_neg_1);
22314 __Pyx_GIVEREF(__pyx_int_neg_1);
22315 PyTuple_SET_ITEM(__pyx_tuple__15, 0, __pyx_int_neg_1);
22316 __Pyx_GIVEREF(__pyx_tuple__15);
22317
22318 /* "(tree fragment)":2
22319 * def __reduce_cython__(self):
22320 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
22321 * def __setstate_cython__(self, __pyx_state):
22322 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
22323 */
22324 __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)
22325 __Pyx_GOTREF(__pyx_tuple__16);
22326 __Pyx_GIVEREF(__pyx_tuple__16);
22327
22328 /* "(tree fragment)":4
22329 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
22330 * def __setstate_cython__(self, __pyx_state):
22331 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
22332 */
22333 __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)
22334 __Pyx_GOTREF(__pyx_tuple__17);
22335 __Pyx_GIVEREF(__pyx_tuple__17);
22336
22337 /* "View.MemoryView":703
22338 * for suboffset in suboffsets[:ndim]:
22339 * if suboffset >= 0:
22340 * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
22341 *
22342 *
22343 */
22344 __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)
22345 __Pyx_GOTREF(__pyx_tuple__18);
22346 __Pyx_GIVEREF(__pyx_tuple__18);
22347
22348 /* "(tree fragment)":2
22349 * def __reduce_cython__(self):
22350 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
22351 * def __setstate_cython__(self, __pyx_state):
22352 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
22353 */
22354 __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)
22355 __Pyx_GOTREF(__pyx_tuple__19);
22356 __Pyx_GIVEREF(__pyx_tuple__19);
22357
22358 /* "(tree fragment)":4
22359 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
22360 * def __setstate_cython__(self, __pyx_state):
22361 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
22362 */
22363 __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)
22364 __Pyx_GOTREF(__pyx_tuple__20);
22365 __Pyx_GIVEREF(__pyx_tuple__20);
22366
22367 /* "View.MemoryView":286
22368 * return self.name
22369 *
22370 * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
22371 * cdef strided = Enum("<strided and direct>") # default
22372 * cdef indirect = Enum("<strided and indirect>")
22373 */
22374 __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)
22375 __Pyx_GOTREF(__pyx_tuple__21);
22376 __Pyx_GIVEREF(__pyx_tuple__21);
22377
22378 /* "View.MemoryView":287
22379 *
22380 * cdef generic = Enum("<strided and direct or indirect>")
22381 * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
22382 * cdef indirect = Enum("<strided and indirect>")
22383 *
22384 */
22385 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 287, __pyx_L1_error)
22386 __Pyx_GOTREF(__pyx_tuple__22);
22387 __Pyx_GIVEREF(__pyx_tuple__22);
22388
22389 /* "View.MemoryView":288
22390 * cdef generic = Enum("<strided and direct or indirect>")
22391 * cdef strided = Enum("<strided and direct>") # default
22392 * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
22393 *
22394 *
22395 */
22396 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 288, __pyx_L1_error)
22397 __Pyx_GOTREF(__pyx_tuple__23);
22398 __Pyx_GIVEREF(__pyx_tuple__23);
22399
22400 /* "View.MemoryView":291
22401 *
22402 *
22403 * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
22404 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
22405 *
22406 */
22407 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 291, __pyx_L1_error)
22408 __Pyx_GOTREF(__pyx_tuple__24);
22409 __Pyx_GIVEREF(__pyx_tuple__24);
22410
22411 /* "View.MemoryView":292
22412 *
22413 * cdef contiguous = Enum("<contiguous and direct>")
22414 * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
22415 *
22416 *
22417 */
22418 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 292, __pyx_L1_error)
22419 __Pyx_GOTREF(__pyx_tuple__25);
22420 __Pyx_GIVEREF(__pyx_tuple__25);
22421
22422 /* "(tree fragment)":1
22423 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
22424 * cdef object __pyx_PickleError
22425 * cdef object __pyx_result
22426 */
22427 __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)
22428 __Pyx_GOTREF(__pyx_tuple__26);
22429 __Pyx_GIVEREF(__pyx_tuple__26);
22430 __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)
22431 __Pyx_RefNannyFinishContext();
22432 return 0;
22433 __pyx_L1_error:;
22434 __Pyx_RefNannyFinishContext();
22435 return -1;
22436}
22437
22438static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
22439 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22440 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
22441 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22442 __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
22443 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22444 return 0;
22445 __pyx_L1_error:;
22446 return -1;
22447}
22448
22449static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
22450static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
22451static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
22452static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
22453static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
22454static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
22455static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
22456
22457static int __Pyx_modinit_global_init_code(void) {
22458 __Pyx_RefNannyDeclarations
22459 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
22460 /*--- Global init code ---*/
22461 generic = Py_None; Py_INCREF(Py_None);
22462 strided = Py_None; Py_INCREF(Py_None);
22463 indirect = Py_None; Py_INCREF(Py_None);
22464 contiguous = Py_None; Py_INCREF(Py_None);
22465 indirect_contiguous = Py_None; Py_INCREF(Py_None);
22466 __Pyx_RefNannyFinishContext();
22467 return 0;
22468}
22469
22470static int __Pyx_modinit_variable_export_code(void) {
22471 __Pyx_RefNannyDeclarations
22472 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
22473 /*--- Variable export code ---*/
22474 __Pyx_RefNannyFinishContext();
22475 return 0;
22476}
22477
22478static int __Pyx_modinit_function_export_code(void) {
22479 __Pyx_RefNannyDeclarations
22480 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
22481 /*--- Function export code ---*/
22482 __Pyx_RefNannyFinishContext();
22483 return 0;
22484}
22485
22486static int __Pyx_modinit_type_init_code(void) {
22487 __Pyx_RefNannyDeclarations
22488 int __pyx_lineno = 0;
22489 const char *__pyx_filename = NULL;
22490 int __pyx_clineno = 0;
22491 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
22492 /*--- Type init code ---*/
22493 __pyx_vtabptr_array = &__pyx_vtable_array;
22494 __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
22495 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
22496 #if PY_VERSION_HEX < 0x030800B1
22497 __pyx_type___pyx_array.tp_print = 0;
22498 #endif
22499 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
22500 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
22501 __pyx_array_type = &__pyx_type___pyx_array;
22502 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
22503 #if PY_VERSION_HEX < 0x030800B1
22504 __pyx_type___pyx_MemviewEnum.tp_print = 0;
22505 #endif
22506 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
22507 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22508 }
22509 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
22510 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
22511 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
22512 __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
22513 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
22514 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
22515 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
22516 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
22517 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
22518 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
22519 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
22520 #if PY_VERSION_HEX < 0x030800B1
22521 __pyx_type___pyx_memoryview.tp_print = 0;
22522 #endif
22523 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
22524 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22525 }
22526 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
22527 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
22528 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
22529 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
22530 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
22531 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
22532 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
22533 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
22534 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
22535 #if PY_VERSION_HEX < 0x030800B1
22536 __pyx_type___pyx_memoryviewslice.tp_print = 0;
22537 #endif
22538 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
22539 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22540 }
22541 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
22542 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
22543 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
22544 __Pyx_RefNannyFinishContext();
22545 return 0;
22546 __pyx_L1_error:;
22547 __Pyx_RefNannyFinishContext();
22548 return -1;
22549}
22550
22551static int __Pyx_modinit_type_import_code(void) {
22552 __Pyx_RefNannyDeclarations
22553 PyObject *__pyx_t_1 = NULL;
22554 int __pyx_lineno = 0;
22555 const char *__pyx_filename = NULL;
22556 int __pyx_clineno = 0;
22557 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
22558 /*--- Type import code ---*/
22559 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
22560 __Pyx_GOTREF(__pyx_t_1);
22561 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
22562 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
22563 sizeof(PyTypeObject),
22564 #else
22565 sizeof(PyHeapTypeObject),
22566 #endif
22567 __Pyx_ImportType_CheckSize_Warn);
22568 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
22569 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22570 __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
22571 __Pyx_GOTREF(__pyx_t_1);
22572 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
22573 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
22574 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
22575 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
22576 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
22577 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
22578 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
22579 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
22580 __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22581 if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
22582 __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22583 if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
22584 __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22585 if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
22586 __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22587 if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
22588 __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22589 if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
22590 __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22591 if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
22592 __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22593 if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
22594 __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22595 if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
22596 __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22597 if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
22598 __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22599 if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
22600 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
22601 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
22602 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22603 __Pyx_RefNannyFinishContext();
22604 return 0;
22605 __pyx_L1_error:;
22606 __Pyx_XDECREF(__pyx_t_1);
22607 __Pyx_RefNannyFinishContext();
22608 return -1;
22609}
22610
22611static int __Pyx_modinit_variable_import_code(void) {
22612 __Pyx_RefNannyDeclarations
22613 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
22614 /*--- Variable import code ---*/
22615 __Pyx_RefNannyFinishContext();
22616 return 0;
22617}
22618
22619static int __Pyx_modinit_function_import_code(void) {
22620 __Pyx_RefNannyDeclarations
22621 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
22622 /*--- Function import code ---*/
22623 __Pyx_RefNannyFinishContext();
22624 return 0;
22625}
22626
22627
22628#ifndef CYTHON_NO_PYINIT_EXPORT
22629#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
22630#elif PY_MAJOR_VERSION < 3
22631#ifdef __cplusplus
22632#define __Pyx_PyMODINIT_FUNC extern "C" void
22633#else
22634#define __Pyx_PyMODINIT_FUNC void
22635#endif
22636#else
22637#ifdef __cplusplus
22638#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
22639#else
22640#define __Pyx_PyMODINIT_FUNC PyObject *
22641#endif
22642#endif
22643
22644
22645#if PY_MAJOR_VERSION < 3
22646__Pyx_PyMODINIT_FUNC initrank_cy(void) CYTHON_SMALL_CODE; /*proto*/
22647__Pyx_PyMODINIT_FUNC initrank_cy(void)
22648#else
22649__Pyx_PyMODINIT_FUNC PyInit_rank_cy(void) CYTHON_SMALL_CODE; /*proto*/
22650__Pyx_PyMODINIT_FUNC PyInit_rank_cy(void)
22651#if CYTHON_PEP489_MULTI_PHASE_INIT
22652{
22653 return PyModuleDef_Init(&__pyx_moduledef);
22654}
22655static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
22656 #if PY_VERSION_HEX >= 0x030700A1
22657 static PY_INT64_T main_interpreter_id = -1;
22658 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
22659 if (main_interpreter_id == -1) {
22660 main_interpreter_id = current_id;
22661 return (unlikely(current_id == -1)) ? -1 : 0;
22662 } else if (unlikely(main_interpreter_id != current_id))
22663 #else
22664 static PyInterpreterState *main_interpreter = NULL;
22665 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
22666 if (!main_interpreter) {
22667 main_interpreter = current_interpreter;
22668 } else if (unlikely(main_interpreter != current_interpreter))
22669 #endif
22670 {
22671 PyErr_SetString(
22672 PyExc_ImportError,
22673 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
22674 return -1;
22675 }
22676 return 0;
22677}
22678static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
22679 PyObject *value = PyObject_GetAttrString(spec, from_name);
22680 int result = 0;
22681 if (likely(value)) {
22682 if (allow_none || value != Py_None) {
22683 result = PyDict_SetItemString(moddict, to_name, value);
22684 }
22685 Py_DECREF(value);
22686 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
22687 PyErr_Clear();
22688 } else {
22689 result = -1;
22690 }
22691 return result;
22692}
22693static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
22694 PyObject *module = NULL, *moddict, *modname;
22695 if (__Pyx_check_single_interpreter())
22696 return NULL;
22697 if (__pyx_m)
22698 return __Pyx_NewRef(__pyx_m);
22699 modname = PyObject_GetAttrString(spec, "name");
22700 if (unlikely(!modname)) goto bad;
22701 module = PyModule_NewObject(modname);
22702 Py_DECREF(modname);
22703 if (unlikely(!module)) goto bad;
22704 moddict = PyModule_GetDict(module);
22705 if (unlikely(!moddict)) goto bad;
22706 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
22707 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
22708 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
22709 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
22710 return module;
22711bad:
22712 Py_XDECREF(module);
22713 return NULL;
22714}
22715
22716
22717static CYTHON_SMALL_CODE int __pyx_pymod_exec_rank_cy(PyObject *__pyx_pyinit_module)
22718#endif
22719#endif
22720{
22721 PyObject *__pyx_t_1 = NULL;
22722 PyObject *__pyx_t_2 = NULL;
22723 static PyThread_type_lock __pyx_t_3[8];
22724 int __pyx_lineno = 0;
22725 const char *__pyx_filename = NULL;
22726 int __pyx_clineno = 0;
22727 __Pyx_RefNannyDeclarations
22728 #if CYTHON_PEP489_MULTI_PHASE_INIT
22729 if (__pyx_m) {
22730 if (__pyx_m == __pyx_pyinit_module) return 0;
22731 PyErr_SetString(PyExc_RuntimeError, "Module 'rank_cy' has already been imported. Re-initialisation is not supported.");
22732 return -1;
22733 }
22734 #elif PY_MAJOR_VERSION >= 3
22735 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
22736 #endif
22737 #if CYTHON_REFNANNY
22738__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
22739if (!__Pyx_RefNanny) {
22740 PyErr_Clear();
22741 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
22742 if (!__Pyx_RefNanny)
22743 Py_FatalError("failed to import 'refnanny' module");
22744}
22745#endif
22746 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_rank_cy(void)", 0);
22747 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22748 #ifdef __Pxy_PyFrame_Initialize_Offsets
22749 __Pxy_PyFrame_Initialize_Offsets();
22750 #endif
22751 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
22752 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
22753 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
22754 #ifdef __Pyx_CyFunction_USED
22755 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22756 #endif
22757 #ifdef __Pyx_FusedFunction_USED
22758 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22759 #endif
22760 #ifdef __Pyx_Coroutine_USED
22761 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22762 #endif
22763 #ifdef __Pyx_Generator_USED
22764 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22765 #endif
22766 #ifdef __Pyx_AsyncGen_USED
22767 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22768 #endif
22769 #ifdef __Pyx_StopAsyncIteration_USED
22770 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22771 #endif
22772 /*--- Library function declarations ---*/
22773 /*--- Threads initialization code ---*/
22774 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
22775 PyEval_InitThreads();
22776 #endif
22777 /*--- Module creation code ---*/
22778 #if CYTHON_PEP489_MULTI_PHASE_INIT
22779 __pyx_m = __pyx_pyinit_module;
22780 Py_INCREF(__pyx_m);
22781 #else
22782 #if PY_MAJOR_VERSION < 3
22783 __pyx_m = Py_InitModule4("rank_cy", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
22784 #else
22785 __pyx_m = PyModule_Create(&__pyx_moduledef);
22786 #endif
22787 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
22788 #endif
22789 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
22790 Py_INCREF(__pyx_d);
22791 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
22792 Py_INCREF(__pyx_b);
22793 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
22794 Py_INCREF(__pyx_cython_runtime);
22795 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22796 /*--- Initialize various global constants etc. ---*/
22797 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22798 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
22799 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22800 #endif
22801 if (__pyx_module_is_main_rank_cy) {
22802 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22803 }
22804 #if PY_MAJOR_VERSION >= 3
22805 {
22806 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
22807 if (!PyDict_GetItemString(modules, "rank_cy")) {
22808 if (unlikely(PyDict_SetItemString(modules, "rank_cy", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22809 }
22810 }
22811 #endif
22812 /*--- Builtin init code ---*/
22813 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22814 /*--- Constants init code ---*/
22815 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22816 /*--- Global type/function init code ---*/
22817 (void)__Pyx_modinit_global_init_code();
22818 (void)__Pyx_modinit_variable_export_code();
22819 (void)__Pyx_modinit_function_export_code();
22820 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22821 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22822 (void)__Pyx_modinit_variable_import_code();
22823 (void)__Pyx_modinit_function_import_code();
22824 /*--- Execution code ---*/
22825 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
22826 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22827 #endif
22828
22829 /* "rank_cy.pyx":5
22830 *
22831 * import cython
22832 * import numpy as np # <<<<<<<<<<<<<<
22833 * cimport numpy as np
22834 * from collections import defaultdict
22835 */
22836 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
22837 __Pyx_GOTREF(__pyx_t_1);
22838 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
22839 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22840
22841 /* "rank_cy.pyx":7
22842 * import numpy as np
22843 * cimport numpy as np
22844 * from collections import defaultdict # <<<<<<<<<<<<<<
22845 * import faiss
22846 *
22847 */
22848 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
22849 __Pyx_GOTREF(__pyx_t_1);
22850 __Pyx_INCREF(__pyx_n_s_defaultdict);
22851 __Pyx_GIVEREF(__pyx_n_s_defaultdict);
22852 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_defaultdict);
22853 __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
22854 __Pyx_GOTREF(__pyx_t_2);
22855 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22856 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
22857 __Pyx_GOTREF(__pyx_t_1);
22858 if (PyDict_SetItem(__pyx_d, __pyx_n_s_defaultdict, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
22859 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22860 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22861
22862 /* "rank_cy.pyx":8
22863 * cimport numpy as np
22864 * from collections import defaultdict
22865 * import faiss # <<<<<<<<<<<<<<
22866 *
22867 *
22868 */
22869 __pyx_t_2 = __Pyx_Import(__pyx_n_s_faiss, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
22870 __Pyx_GOTREF(__pyx_t_2);
22871 if (PyDict_SetItem(__pyx_d, __pyx_n_s_faiss, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
22872 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22873
22874 /* "rank_cy.pyx":1
22875 * # cython: boundscheck=False, wraparound=False, nonecheck=False, cdivision=True # <<<<<<<<<<<<<<
22876 * # credits: https://github.com/KaiyangZhou/deep-person-reid/blob/master/torchreid/metrics/rank_cylib/rank_cy.pyx
22877 *
22878 */
22879 __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
22880 __Pyx_GOTREF(__pyx_t_2);
22881 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22882 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22883
22884 /* "View.MemoryView":209
22885 * info.obj = self
22886 *
22887 * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
22888 *
22889 * def __dealloc__(array self):
22890 */
22891 __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 209, __pyx_L1_error)
22892 __Pyx_GOTREF(__pyx_t_2);
22893 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
22894 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22895 PyType_Modified(__pyx_array_type);
22896
22897 /* "View.MemoryView":286
22898 * return self.name
22899 *
22900 * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
22901 * cdef strided = Enum("<strided and direct>") # default
22902 * cdef indirect = Enum("<strided and indirect>")
22903 */
22904 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 286, __pyx_L1_error)
22905 __Pyx_GOTREF(__pyx_t_2);
22906 __Pyx_XGOTREF(generic);
22907 __Pyx_DECREF_SET(generic, __pyx_t_2);
22908 __Pyx_GIVEREF(__pyx_t_2);
22909 __pyx_t_2 = 0;
22910
22911 /* "View.MemoryView":287
22912 *
22913 * cdef generic = Enum("<strided and direct or indirect>")
22914 * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
22915 * cdef indirect = Enum("<strided and indirect>")
22916 *
22917 */
22918 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error)
22919 __Pyx_GOTREF(__pyx_t_2);
22920 __Pyx_XGOTREF(strided);
22921 __Pyx_DECREF_SET(strided, __pyx_t_2);
22922 __Pyx_GIVEREF(__pyx_t_2);
22923 __pyx_t_2 = 0;
22924
22925 /* "View.MemoryView":288
22926 * cdef generic = Enum("<strided and direct or indirect>")
22927 * cdef strided = Enum("<strided and direct>") # default
22928 * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
22929 *
22930 *
22931 */
22932 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error)
22933 __Pyx_GOTREF(__pyx_t_2);
22934 __Pyx_XGOTREF(indirect);
22935 __Pyx_DECREF_SET(indirect, __pyx_t_2);
22936 __Pyx_GIVEREF(__pyx_t_2);
22937 __pyx_t_2 = 0;
22938
22939 /* "View.MemoryView":291
22940 *
22941 *
22942 * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
22943 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
22944 *
22945 */
22946 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 291, __pyx_L1_error)
22947 __Pyx_GOTREF(__pyx_t_2);
22948 __Pyx_XGOTREF(contiguous);
22949 __Pyx_DECREF_SET(contiguous, __pyx_t_2);
22950 __Pyx_GIVEREF(__pyx_t_2);
22951 __pyx_t_2 = 0;
22952
22953 /* "View.MemoryView":292
22954 *
22955 * cdef contiguous = Enum("<contiguous and direct>")
22956 * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
22957 *
22958 *
22959 */
22960 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 292, __pyx_L1_error)
22961 __Pyx_GOTREF(__pyx_t_2);
22962 __Pyx_XGOTREF(indirect_contiguous);
22963 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2);
22964 __Pyx_GIVEREF(__pyx_t_2);
22965 __pyx_t_2 = 0;
22966
22967 /* "View.MemoryView":316
22968 *
22969 * DEF THREAD_LOCKS_PREALLOCATED = 8
22970 * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<<
22971 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
22972 * PyThread_allocate_lock(),
22973 */
22974 __pyx_memoryview_thread_locks_used = 0;
22975
22976 /* "View.MemoryView":317
22977 * DEF THREAD_LOCKS_PREALLOCATED = 8
22978 * cdef int __pyx_memoryview_thread_locks_used = 0
22979 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<<
22980 * PyThread_allocate_lock(),
22981 * PyThread_allocate_lock(),
22982 */
22983 __pyx_t_3[0] = PyThread_allocate_lock();
22984 __pyx_t_3[1] = PyThread_allocate_lock();
22985 __pyx_t_3[2] = PyThread_allocate_lock();
22986 __pyx_t_3[3] = PyThread_allocate_lock();
22987 __pyx_t_3[4] = PyThread_allocate_lock();
22988 __pyx_t_3[5] = PyThread_allocate_lock();
22989 __pyx_t_3[6] = PyThread_allocate_lock();
22990 __pyx_t_3[7] = PyThread_allocate_lock();
22991 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
22992
22993 /* "View.MemoryView":549
22994 * info.obj = self
22995 *
22996 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
22997 *
22998 *
22999 */
23000 __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 549, __pyx_L1_error)
23001 __Pyx_GOTREF(__pyx_t_2);
23002 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 549, __pyx_L1_error)
23003 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23004 PyType_Modified(__pyx_memoryview_type);
23005
23006 /* "View.MemoryView":995
23007 * return self.from_object
23008 *
23009 * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
23010 *
23011 *
23012 */
23013 __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 995, __pyx_L1_error)
23014 __Pyx_GOTREF(__pyx_t_2);
23015 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 995, __pyx_L1_error)
23016 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23017 PyType_Modified(__pyx_memoryviewslice_type);
23018
23019 /* "(tree fragment)":1
23020 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
23021 * cdef object __pyx_PickleError
23022 * cdef object __pyx_result
23023 */
23024 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
23025 __Pyx_GOTREF(__pyx_t_2);
23026 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
23027 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23028
23029 /* "(tree fragment)":11
23030 * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
23031 * return __pyx_result
23032 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
23033 * __pyx_result.name = __pyx_state[0]
23034 * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
23035 */
23036
23037 /*--- Wrapped vars code ---*/
23038
23039 goto __pyx_L0;
23040 __pyx_L1_error:;
23041 __Pyx_XDECREF(__pyx_t_1);
23042 __Pyx_XDECREF(__pyx_t_2);
23043 if (__pyx_m) {
23044 if (__pyx_d) {
23045 __Pyx_AddTraceback("init rank_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
23046 }
23047 Py_CLEAR(__pyx_m);
23048 } else if (!PyErr_Occurred()) {
23049 PyErr_SetString(PyExc_ImportError, "init rank_cy");
23050 }
23051 __pyx_L0:;
23052 __Pyx_RefNannyFinishContext();
23053 #if CYTHON_PEP489_MULTI_PHASE_INIT
23054 return (__pyx_m != NULL) ? 0 : -1;
23055 #elif PY_MAJOR_VERSION >= 3
23056 return __pyx_m;
23057 #else
23058 return;
23059 #endif
23060}
23061
23062/* --- Runtime support code --- */
23063/* Refnanny */
23064#if CYTHON_REFNANNY
23065static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
23066 PyObject *m = NULL, *p = NULL;
23067 void *r = NULL;
23068 m = PyImport_ImportModule(modname);
23069 if (!m) goto end;
23070 p = PyObject_GetAttrString(m, "RefNannyAPI");
23071 if (!p) goto end;
23072 r = PyLong_AsVoidPtr(p);
23073end:
23074 Py_XDECREF(p);
23075 Py_XDECREF(m);
23076 return (__Pyx_RefNannyAPIStruct *)r;
23077}
23078#endif
23079
23080/* PyObjectGetAttrStr */
23081#if CYTHON_USE_TYPE_SLOTS
23082static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
23083 PyTypeObject* tp = Py_TYPE(obj);
23084 if (likely(tp->tp_getattro))
23085 return tp->tp_getattro(obj, attr_name);
23086#if PY_MAJOR_VERSION < 3
23087 if (likely(tp->tp_getattr))
23088 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
23089#endif
23090 return PyObject_GetAttr(obj, attr_name);
23091}
23092#endif
23093
23094/* GetBuiltinName */
23095static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
23096 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
23097 if (unlikely(!result)) {
23098 PyErr_Format(PyExc_NameError,
23099#if PY_MAJOR_VERSION >= 3
23100 "name '%U' is not defined", name);
23101#else
23102 "name '%.200s' is not defined", PyString_AS_STRING(name));
23103#endif
23104 }
23105 return result;
23106}
23107
23108/* PyDictVersioning */
23109#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
23110static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
23111 PyObject *dict = Py_TYPE(obj)->tp_dict;
23112 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
23113}
23114static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
23115 PyObject **dictptr = NULL;
23116 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
23117 if (offset) {
23118#if CYTHON_COMPILING_IN_CPYTHON
23119 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
23120#else
23121 dictptr = _PyObject_GetDictPtr(obj);
23122#endif
23123 }
23124 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
23125}
23126static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
23127 PyObject *dict = Py_TYPE(obj)->tp_dict;
23128 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
23129 return 0;
23130 return obj_dict_version == __Pyx_get_object_dict_version(obj);
23131}
23132#endif
23133
23134/* GetModuleGlobalName */
23135#if CYTHON_USE_DICT_VERSIONS
23136static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
23137#else
23138static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
23139#endif
23140{
23141 PyObject *result;
23142#if !CYTHON_AVOID_BORROWED_REFS
23143#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
23144 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
23145 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23146 if (likely(result)) {
23147 return __Pyx_NewRef(result);
23148 } else if (unlikely(PyErr_Occurred())) {
23149 return NULL;
23150 }
23151#else
23152 result = PyDict_GetItem(__pyx_d, name);
23153 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23154 if (likely(result)) {
23155 return __Pyx_NewRef(result);
23156 }
23157#endif
23158#else
23159 result = PyObject_GetItem(__pyx_d, name);
23160 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23161 if (likely(result)) {
23162 return __Pyx_NewRef(result);
23163 }
23164 PyErr_Clear();
23165#endif
23166 return __Pyx_GetBuiltinName(name);
23167}
23168
23169/* PyObjectCall */
23170#if CYTHON_COMPILING_IN_CPYTHON
23171static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
23172 PyObject *result;
23173 ternaryfunc call = Py_TYPE(func)->tp_call;
23174 if (unlikely(!call))
23175 return PyObject_Call(func, arg, kw);
23176 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
23177 return NULL;
23178 result = (*call)(func, arg, kw);
23179 Py_LeaveRecursiveCall();
23180 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23181 PyErr_SetString(
23182 PyExc_SystemError,
23183 "NULL result without error in PyObject_Call");
23184 }
23185 return result;
23186}
23187#endif
23188
23189/* MemviewSliceInit */
23190static int
23191__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
23192 int ndim,
23193 __Pyx_memviewslice *memviewslice,
23194 int memview_is_new_reference)
23195{
23196 __Pyx_RefNannyDeclarations
23197 int i, retval=-1;
23198 Py_buffer *buf = &memview->view;
23199 __Pyx_RefNannySetupContext("init_memviewslice", 0);
23200 if (unlikely(memviewslice->memview || memviewslice->data)) {
23201 PyErr_SetString(PyExc_ValueError,
23202 "memviewslice is already initialized!");
23203 goto fail;
23204 }
23205 if (buf->strides) {
23206 for (i = 0; i < ndim; i++) {
23207 memviewslice->strides[i] = buf->strides[i];
23208 }
23209 } else {
23210 Py_ssize_t stride = buf->itemsize;
23211 for (i = ndim - 1; i >= 0; i--) {
23212 memviewslice->strides[i] = stride;
23213 stride *= buf->shape[i];
23214 }
23215 }
23216 for (i = 0; i < ndim; i++) {
23217 memviewslice->shape[i] = buf->shape[i];
23218 if (buf->suboffsets) {
23219 memviewslice->suboffsets[i] = buf->suboffsets[i];
23220 } else {
23221 memviewslice->suboffsets[i] = -1;
23222 }
23223 }
23224 memviewslice->memview = memview;
23225 memviewslice->data = (char *)buf->buf;
23226 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
23227 Py_INCREF(memview);
23228 }
23229 retval = 0;
23230 goto no_fail;
23231fail:
23232 memviewslice->memview = 0;
23233 memviewslice->data = 0;
23234 retval = -1;
23235no_fail:
23236 __Pyx_RefNannyFinishContext();
23237 return retval;
23238}
23239#ifndef Py_NO_RETURN
23240#define Py_NO_RETURN
23241#endif
23242static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
23243 va_list vargs;
23244 char msg[200];
23245#ifdef HAVE_STDARG_PROTOTYPES
23246 va_start(vargs, fmt);
23247#else
23248 va_start(vargs);
23249#endif
23250 vsnprintf(msg, 200, fmt, vargs);
23251 va_end(vargs);
23252 Py_FatalError(msg);
23253}
23254static CYTHON_INLINE int
23255__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23256 PyThread_type_lock lock)
23257{
23258 int result;
23259 PyThread_acquire_lock(lock, 1);
23260 result = (*acquisition_count)++;
23261 PyThread_release_lock(lock);
23262 return result;
23263}
23264static CYTHON_INLINE int
23265__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23266 PyThread_type_lock lock)
23267{
23268 int result;
23269 PyThread_acquire_lock(lock, 1);
23270 result = (*acquisition_count)--;
23271 PyThread_release_lock(lock);
23272 return result;
23273}
23274static CYTHON_INLINE void
23275__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
23276{
23277 int first_time;
23278 struct __pyx_memoryview_obj *memview = memslice->memview;
23279 if (unlikely(!memview || (PyObject *) memview == Py_None))
23280 return;
23281 if (unlikely(__pyx_get_slice_count(memview) < 0))
23282 __pyx_fatalerror("Acquisition count is %d (line %d)",
23283 __pyx_get_slice_count(memview), lineno);
23284 first_time = __pyx_add_acquisition_count(memview) == 0;
23285 if (unlikely(first_time)) {
23286 if (have_gil) {
23287 Py_INCREF((PyObject *) memview);
23288 } else {
23289 PyGILState_STATE _gilstate = PyGILState_Ensure();
23290 Py_INCREF((PyObject *) memview);
23291 PyGILState_Release(_gilstate);
23292 }
23293 }
23294}
23295static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
23296 int have_gil, int lineno) {
23297 int last_time;
23298 struct __pyx_memoryview_obj *memview = memslice->memview;
23299 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
23300 memslice->memview = NULL;
23301 return;
23302 }
23303 if (unlikely(__pyx_get_slice_count(memview) <= 0))
23304 __pyx_fatalerror("Acquisition count is %d (line %d)",
23305 __pyx_get_slice_count(memview), lineno);
23306 last_time = __pyx_sub_acquisition_count(memview) == 1;
23307 memslice->data = NULL;
23308 if (unlikely(last_time)) {
23309 if (have_gil) {
23310 Py_CLEAR(memslice->memview);
23311 } else {
23312 PyGILState_STATE _gilstate = PyGILState_Ensure();
23313 Py_CLEAR(memslice->memview);
23314 PyGILState_Release(_gilstate);
23315 }
23316 } else {
23317 memslice->memview = NULL;
23318 }
23319}
23320
23321/* RaiseArgTupleInvalid */
23322static void __Pyx_RaiseArgtupleInvalid(
23323 const char* func_name,
23324 int exact,
23325 Py_ssize_t num_min,
23326 Py_ssize_t num_max,
23327 Py_ssize_t num_found)
23328{
23329 Py_ssize_t num_expected;
23330 const char *more_or_less;
23331 if (num_found < num_min) {
23332 num_expected = num_min;
23333 more_or_less = "at least";
23334 } else {
23335 num_expected = num_max;
23336 more_or_less = "at most";
23337 }
23338 if (exact) {
23339 more_or_less = "exactly";
23340 }
23341 PyErr_Format(PyExc_TypeError,
23342 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
23343 func_name, more_or_less, num_expected,
23344 (num_expected == 1) ? "" : "s", num_found);
23345}
23346
23347/* RaiseDoubleKeywords */
23348static void __Pyx_RaiseDoubleKeywordsError(
23349 const char* func_name,
23350 PyObject* kw_name)
23351{
23352 PyErr_Format(PyExc_TypeError,
23353 #if PY_MAJOR_VERSION >= 3
23354 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23355 #else
23356 "%s() got multiple values for keyword argument '%s'", func_name,
23357 PyString_AsString(kw_name));
23358 #endif
23359}
23360
23361/* ParseKeywords */
23362static int __Pyx_ParseOptionalKeywords(
23363 PyObject *kwds,
23364 PyObject **argnames[],
23365 PyObject *kwds2,
23366 PyObject *values[],
23367 Py_ssize_t num_pos_args,
23368 const char* function_name)
23369{
23370 PyObject *key = 0, *value = 0;
23371 Py_ssize_t pos = 0;
23372 PyObject*** name;
23373 PyObject*** first_kw_arg = argnames + num_pos_args;
23374 while (PyDict_Next(kwds, &pos, &key, &value)) {
23375 name = first_kw_arg;
23376 while (*name && (**name != key)) name++;
23377 if (*name) {
23378 values[name-argnames] = value;
23379 continue;
23380 }
23381 name = first_kw_arg;
23382 #if PY_MAJOR_VERSION < 3
23383 if (likely(PyString_Check(key))) {
23384 while (*name) {
23385 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23386 && _PyString_Eq(**name, key)) {
23387 values[name-argnames] = value;
23388 break;
23389 }
23390 name++;
23391 }
23392 if (*name) continue;
23393 else {
23394 PyObject*** argname = argnames;
23395 while (argname != first_kw_arg) {
23396 if ((**argname == key) || (
23397 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23398 && _PyString_Eq(**argname, key))) {
23399 goto arg_passed_twice;
23400 }
23401 argname++;
23402 }
23403 }
23404 } else
23405 #endif
23406 if (likely(PyUnicode_Check(key))) {
23407 while (*name) {
23408 int cmp = (**name == key) ? 0 :
23409 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23410 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23411 #endif
23412 PyUnicode_Compare(**name, key);
23413 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23414 if (cmp == 0) {
23415 values[name-argnames] = value;
23416 break;
23417 }
23418 name++;
23419 }
23420 if (*name) continue;
23421 else {
23422 PyObject*** argname = argnames;
23423 while (argname != first_kw_arg) {
23424 int cmp = (**argname == key) ? 0 :
23425 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23426 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23427 #endif
23428 PyUnicode_Compare(**argname, key);
23429 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23430 if (cmp == 0) goto arg_passed_twice;
23431 argname++;
23432 }
23433 }
23434 } else
23435 goto invalid_keyword_type;
23436 if (kwds2) {
23437 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
23438 } else {
23439 goto invalid_keyword;
23440 }
23441 }
23442 return 0;
23443arg_passed_twice:
23444 __Pyx_RaiseDoubleKeywordsError(function_name, key);
23445 goto bad;
23446invalid_keyword_type:
23447 PyErr_Format(PyExc_TypeError,
23448 "%.200s() keywords must be strings", function_name);
23449 goto bad;
23450invalid_keyword:
23451 PyErr_Format(PyExc_TypeError,
23452 #if PY_MAJOR_VERSION < 3
23453 "%.200s() got an unexpected keyword argument '%.200s'",
23454 function_name, PyString_AsString(key));
23455 #else
23456 "%s() got an unexpected keyword argument '%U'",
23457 function_name, key);
23458 #endif
23459bad:
23460 return -1;
23461}
23462
23463/* PyCFunctionFastCall */
23464#if CYTHON_FAST_PYCCALL
23465static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
23466 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
23467 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
23468 PyObject *self = PyCFunction_GET_SELF(func);
23469 int flags = PyCFunction_GET_FLAGS(func);
23470 assert(PyCFunction_Check(func));
23471 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
23472 assert(nargs >= 0);
23473 assert(nargs == 0 || args != NULL);
23474 /* _PyCFunction_FastCallDict() must not be called with an exception set,
23475 because it may clear it (directly or indirectly) and so the
23476 caller loses its exception */
23477 assert(!PyErr_Occurred());
23478 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
23479 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
23480 } else {
23481 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
23482 }
23483}
23484#endif
23485
23486/* PyFunctionFastCall */
23487#if CYTHON_FAST_PYCALL
23488static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
23489 PyObject *globals) {
23490 PyFrameObject *f;
23491 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23492 PyObject **fastlocals;
23493 Py_ssize_t i;
23494 PyObject *result;
23495 assert(globals != NULL);
23496 /* XXX Perhaps we should create a specialized
23497 PyFrame_New() that doesn't take locals, but does
23498 take builtins without sanity checking them.
23499 */
23500 assert(tstate != NULL);
23501 f = PyFrame_New(tstate, co, globals, NULL);
23502 if (f == NULL) {
23503 return NULL;
23504 }
23505 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
23506 for (i = 0; i < na; i++) {
23507 Py_INCREF(*args);
23508 fastlocals[i] = *args++;
23509 }
23510 result = PyEval_EvalFrameEx(f,0);
23511 ++tstate->recursion_depth;
23512 Py_DECREF(f);
23513 --tstate->recursion_depth;
23514 return result;
23515}
23516#if 1 || PY_VERSION_HEX < 0x030600B1
23517static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
23518 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
23519 PyObject *globals = PyFunction_GET_GLOBALS(func);
23520 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
23521 PyObject *closure;
23522#if PY_MAJOR_VERSION >= 3
23523 PyObject *kwdefs;
23524#endif
23525 PyObject *kwtuple, **k;
23526 PyObject **d;
23527 Py_ssize_t nd;
23528 Py_ssize_t nk;
23529 PyObject *result;
23530 assert(kwargs == NULL || PyDict_Check(kwargs));
23531 nk = kwargs ? PyDict_Size(kwargs) : 0;
23532 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
23533 return NULL;
23534 }
23535 if (
23536#if PY_MAJOR_VERSION >= 3
23537 co->co_kwonlyargcount == 0 &&
23538#endif
23539 likely(kwargs == NULL || nk == 0) &&
23540 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
23541 if (argdefs == NULL && co->co_argcount == nargs) {
23542 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
23543 goto done;
23544 }
23545 else if (nargs == 0 && argdefs != NULL
23546 && co->co_argcount == Py_SIZE(argdefs)) {
23547 /* function called with no arguments, but all parameters have
23548 a default value: use default values as arguments .*/
23549 args = &PyTuple_GET_ITEM(argdefs, 0);
23550 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
23551 goto done;
23552 }
23553 }
23554 if (kwargs != NULL) {
23555 Py_ssize_t pos, i;
23556 kwtuple = PyTuple_New(2 * nk);
23557 if (kwtuple == NULL) {
23558 result = NULL;
23559 goto done;
23560 }
23561 k = &PyTuple_GET_ITEM(kwtuple, 0);
23562 pos = i = 0;
23563 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
23564 Py_INCREF(k[i]);
23565 Py_INCREF(k[i+1]);
23566 i += 2;
23567 }
23568 nk = i / 2;
23569 }
23570 else {
23571 kwtuple = NULL;
23572 k = NULL;
23573 }
23574 closure = PyFunction_GET_CLOSURE(func);
23575#if PY_MAJOR_VERSION >= 3
23576 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
23577#endif
23578 if (argdefs != NULL) {
23579 d = &PyTuple_GET_ITEM(argdefs, 0);
23580 nd = Py_SIZE(argdefs);
23581 }
23582 else {
23583 d = NULL;
23584 nd = 0;
23585 }
23586#if PY_MAJOR_VERSION >= 3
23587 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
23588 args, (int)nargs,
23589 k, (int)nk,
23590 d, (int)nd, kwdefs, closure);
23591#else
23592 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
23593 args, (int)nargs,
23594 k, (int)nk,
23595 d, (int)nd, closure);
23596#endif
23597 Py_XDECREF(kwtuple);
23598done:
23599 Py_LeaveRecursiveCall();
23600 return result;
23601}
23602#endif
23603#endif
23604
23605/* PyObjectCall2Args */
23606static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
23607 PyObject *args, *result = NULL;
23608 #if CYTHON_FAST_PYCALL
23609 if (PyFunction_Check(function)) {
23610 PyObject *args[2] = {arg1, arg2};
23611 return __Pyx_PyFunction_FastCall(function, args, 2);
23612 }
23613 #endif
23614 #if CYTHON_FAST_PYCCALL
23615 if (__Pyx_PyFastCFunction_Check(function)) {
23616 PyObject *args[2] = {arg1, arg2};
23617 return __Pyx_PyCFunction_FastCall(function, args, 2);
23618 }
23619 #endif
23620 args = PyTuple_New(2);
23621 if (unlikely(!args)) goto done;
23622 Py_INCREF(arg1);
23623 PyTuple_SET_ITEM(args, 0, arg1);
23624 Py_INCREF(arg2);
23625 PyTuple_SET_ITEM(args, 1, arg2);
23626 Py_INCREF(function);
23627 result = __Pyx_PyObject_Call(function, args, NULL);
23628 Py_DECREF(args);
23629 Py_DECREF(function);
23630done:
23631 return result;
23632}
23633
23634/* PyObjectCallMethO */
23635#if CYTHON_COMPILING_IN_CPYTHON
23636static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
23637 PyObject *self, *result;
23638 PyCFunction cfunc;
23639 cfunc = PyCFunction_GET_FUNCTION(func);
23640 self = PyCFunction_GET_SELF(func);
23641 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
23642 return NULL;
23643 result = cfunc(self, arg);
23644 Py_LeaveRecursiveCall();
23645 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23646 PyErr_SetString(
23647 PyExc_SystemError,
23648 "NULL result without error in PyObject_Call");
23649 }
23650 return result;
23651}
23652#endif
23653
23654/* PyObjectCallOneArg */
23655#if CYTHON_COMPILING_IN_CPYTHON
23656static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23657 PyObject *result;
23658 PyObject *args = PyTuple_New(1);
23659 if (unlikely(!args)) return NULL;
23660 Py_INCREF(arg);
23661 PyTuple_SET_ITEM(args, 0, arg);
23662 result = __Pyx_PyObject_Call(func, args, NULL);
23663 Py_DECREF(args);
23664 return result;
23665}
23666static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23667#if CYTHON_FAST_PYCALL
23668 if (PyFunction_Check(func)) {
23669 return __Pyx_PyFunction_FastCall(func, &arg, 1);
23670 }
23671#endif
23672 if (likely(PyCFunction_Check(func))) {
23673 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
23674 return __Pyx_PyObject_CallMethO(func, arg);
23675#if CYTHON_FAST_PYCCALL
23676 } else if (__Pyx_PyFastCFunction_Check(func)) {
23677 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
23678#endif
23679 }
23680 }
23681 return __Pyx__PyObject_CallOneArg(func, arg);
23682}
23683#else
23684static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23685 PyObject *result;
23686 PyObject *args = PyTuple_Pack(1, arg);
23687 if (unlikely(!args)) return NULL;
23688 result = __Pyx_PyObject_Call(func, args, NULL);
23689 Py_DECREF(args);
23690 return result;
23691}
23692#endif
23693
23694/* GetItemInt */
23695static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
23696 PyObject *r;
23697 if (!j) return NULL;
23698 r = PyObject_GetItem(o, j);
23699 Py_DECREF(j);
23700 return r;
23701}
23702static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
23703 CYTHON_NCP_UNUSED int wraparound,
23704 CYTHON_NCP_UNUSED int boundscheck) {
23705#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23706 Py_ssize_t wrapped_i = i;
23707 if (wraparound & unlikely(i < 0)) {
23708 wrapped_i += PyList_GET_SIZE(o);
23709 }
23710 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
23711 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
23712 Py_INCREF(r);
23713 return r;
23714 }
23715 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23716#else
23717 return PySequence_GetItem(o, i);
23718#endif
23719}
23720static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
23721 CYTHON_NCP_UNUSED int wraparound,
23722 CYTHON_NCP_UNUSED int boundscheck) {
23723#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23724 Py_ssize_t wrapped_i = i;
23725 if (wraparound & unlikely(i < 0)) {
23726 wrapped_i += PyTuple_GET_SIZE(o);
23727 }
23728 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
23729 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
23730 Py_INCREF(r);
23731 return r;
23732 }
23733 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23734#else
23735 return PySequence_GetItem(o, i);
23736#endif
23737}
23738static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
23739 CYTHON_NCP_UNUSED int wraparound,
23740 CYTHON_NCP_UNUSED int boundscheck) {
23741#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
23742 if (is_list || PyList_CheckExact(o)) {
23743 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
23744 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
23745 PyObject *r = PyList_GET_ITEM(o, n);
23746 Py_INCREF(r);
23747 return r;
23748 }
23749 }
23750 else if (PyTuple_CheckExact(o)) {
23751 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
23752 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
23753 PyObject *r = PyTuple_GET_ITEM(o, n);
23754 Py_INCREF(r);
23755 return r;
23756 }
23757 } else {
23758 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
23759 if (likely(m && m->sq_item)) {
23760 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
23761 Py_ssize_t l = m->sq_length(o);
23762 if (likely(l >= 0)) {
23763 i += l;
23764 } else {
23765 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23766 return NULL;
23767 PyErr_Clear();
23768 }
23769 }
23770 return m->sq_item(o, i);
23771 }
23772 }
23773#else
23774 if (is_list || PySequence_Check(o)) {
23775 return PySequence_GetItem(o, i);
23776 }
23777#endif
23778 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23779}
23780
23781/* ObjectGetItem */
23782#if CYTHON_USE_TYPE_SLOTS
23783static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
23784 PyObject *runerr;
23785 Py_ssize_t key_value;
23786 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
23787 if (unlikely(!(m && m->sq_item))) {
23788 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
23789 return NULL;
23790 }
23791 key_value = __Pyx_PyIndex_AsSsize_t(index);
23792 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
23793 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
23794 }
23795 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
23796 PyErr_Clear();
23797 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
23798 }
23799 return NULL;
23800}
23801static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
23802 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
23803 if (likely(m && m->mp_subscript)) {
23804 return m->mp_subscript(obj, key);
23805 }
23806 return __Pyx_PyObject_GetIndex(obj, key);
23807}
23808#endif
23809
23810/* PyObjectGetMethod */
23811static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
23812 PyObject *attr;
23813#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
23814 PyTypeObject *tp = Py_TYPE(obj);
23815 PyObject *descr;
23816 descrgetfunc f = NULL;
23817 PyObject **dictptr, *dict;
23818 int meth_found = 0;
23819 assert (*method == NULL);
23820 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
23821 attr = __Pyx_PyObject_GetAttrStr(obj, name);
23822 goto try_unpack;
23823 }
23824 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
23825 return 0;
23826 }
23827 descr = _PyType_Lookup(tp, name);
23828 if (likely(descr != NULL)) {
23829 Py_INCREF(descr);
23830#if PY_MAJOR_VERSION >= 3
23831 #ifdef __Pyx_CyFunction_USED
23832 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
23833 #else
23834 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
23835 #endif
23836#else
23837 #ifdef __Pyx_CyFunction_USED
23838 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
23839 #else
23840 if (likely(PyFunction_Check(descr)))
23841 #endif
23842#endif
23843 {
23844 meth_found = 1;
23845 } else {
23846 f = Py_TYPE(descr)->tp_descr_get;
23847 if (f != NULL && PyDescr_IsData(descr)) {
23848 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
23849 Py_DECREF(descr);
23850 goto try_unpack;
23851 }
23852 }
23853 }
23854 dictptr = _PyObject_GetDictPtr(obj);
23855 if (dictptr != NULL && (dict = *dictptr) != NULL) {
23856 Py_INCREF(dict);
23857 attr = __Pyx_PyDict_GetItemStr(dict, name);
23858 if (attr != NULL) {
23859 Py_INCREF(attr);
23860 Py_DECREF(dict);
23861 Py_XDECREF(descr);
23862 goto try_unpack;
23863 }
23864 Py_DECREF(dict);
23865 }
23866 if (meth_found) {
23867 *method = descr;
23868 return 1;
23869 }
23870 if (f != NULL) {
23871 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
23872 Py_DECREF(descr);
23873 goto try_unpack;
23874 }
23875 if (descr != NULL) {
23876 *method = descr;
23877 return 0;
23878 }
23879 PyErr_Format(PyExc_AttributeError,
23880#if PY_MAJOR_VERSION >= 3
23881 "'%.50s' object has no attribute '%U'",
23882 tp->tp_name, name);
23883#else
23884 "'%.50s' object has no attribute '%.400s'",
23885 tp->tp_name, PyString_AS_STRING(name));
23886#endif
23887 return 0;
23888#else
23889 attr = __Pyx_PyObject_GetAttrStr(obj, name);
23890 goto try_unpack;
23891#endif
23892try_unpack:
23893#if CYTHON_UNPACK_METHODS
23894 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
23895 PyObject *function = PyMethod_GET_FUNCTION(attr);
23896 Py_INCREF(function);
23897 Py_DECREF(attr);
23898 *method = function;
23899 return 1;
23900 }
23901#endif
23902 *method = attr;
23903 return 0;
23904}
23905
23906/* PyObjectCallMethod1 */
23907static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
23908 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
23909 Py_DECREF(method);
23910 return result;
23911}
23912static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
23913 PyObject *method = NULL, *result;
23914 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
23915 if (likely(is_method)) {
23916 result = __Pyx_PyObject_Call2Args(method, obj, arg);
23917 Py_DECREF(method);
23918 return result;
23919 }
23920 if (unlikely(!method)) return NULL;
23921 return __Pyx__PyObject_CallMethod1(method, arg);
23922}
23923
23924/* append */
23925static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
23926 if (likely(PyList_CheckExact(L))) {
23927 if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
23928 } else {
23929 PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
23930 if (unlikely(!retval))
23931 return -1;
23932 Py_DECREF(retval);
23933 }
23934 return 0;
23935}
23936
23937/* PyObjectCallNoArg */
23938#if CYTHON_COMPILING_IN_CPYTHON
23939static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
23940#if CYTHON_FAST_PYCALL
23941 if (PyFunction_Check(func)) {
23942 return __Pyx_PyFunction_FastCall(func, NULL, 0);
23943 }
23944#endif
23945#ifdef __Pyx_CyFunction_USED
23946 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
23947#else
23948 if (likely(PyCFunction_Check(func)))
23949#endif
23950 {
23951 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
23952 return __Pyx_PyObject_CallMethO(func, NULL);
23953 }
23954 }
23955 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
23956}
23957#endif
23958
23959/* RaiseTooManyValuesToUnpack */
23960static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
23961 PyErr_Format(PyExc_ValueError,
23962 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
23963}
23964
23965/* RaiseNeedMoreValuesToUnpack */
23966static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
23967 PyErr_Format(PyExc_ValueError,
23968 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
23969 index, (index == 1) ? "" : "s");
23970}
23971
23972/* IterFinish */
23973static CYTHON_INLINE int __Pyx_IterFinish(void) {
23974#if CYTHON_FAST_THREAD_STATE
23975 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23976 PyObject* exc_type = tstate->curexc_type;
23977 if (unlikely(exc_type)) {
23978 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
23979 PyObject *exc_value, *exc_tb;
23980 exc_value = tstate->curexc_value;
23981 exc_tb = tstate->curexc_traceback;
23982 tstate->curexc_type = 0;
23983 tstate->curexc_value = 0;
23984 tstate->curexc_traceback = 0;
23985 Py_DECREF(exc_type);
23986 Py_XDECREF(exc_value);
23987 Py_XDECREF(exc_tb);
23988 return 0;
23989 } else {
23990 return -1;
23991 }
23992 }
23993 return 0;
23994#else
23995 if (unlikely(PyErr_Occurred())) {
23996 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
23997 PyErr_Clear();
23998 return 0;
23999 } else {
24000 return -1;
24001 }
24002 }
24003 return 0;
24004#endif
24005}
24006
24007/* UnpackItemEndCheck */
24008static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
24009 if (unlikely(retval)) {
24010 Py_DECREF(retval);
24011 __Pyx_RaiseTooManyValuesError(expected);
24012 return -1;
24013 } else {
24014 return __Pyx_IterFinish();
24015 }
24016 return 0;
24017}
24018
24019/* None */
24020static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
24021 PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
24022}
24023
24024/* GetTopmostException */
24025#if CYTHON_USE_EXC_INFO_STACK
24026static _PyErr_StackItem *
24027__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
24028{
24029 _PyErr_StackItem *exc_info = tstate->exc_info;
24030 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
24031 exc_info->previous_item != NULL)
24032 {
24033 exc_info = exc_info->previous_item;
24034 }
24035 return exc_info;
24036}
24037#endif
24038
24039/* SaveResetException */
24040#if CYTHON_FAST_THREAD_STATE
24041static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24042 #if CYTHON_USE_EXC_INFO_STACK
24043 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
24044 *type = exc_info->exc_type;
24045 *value = exc_info->exc_value;
24046 *tb = exc_info->exc_traceback;
24047 #else
24048 *type = tstate->exc_type;
24049 *value = tstate->exc_value;
24050 *tb = tstate->exc_traceback;
24051 #endif
24052 Py_XINCREF(*type);
24053 Py_XINCREF(*value);
24054 Py_XINCREF(*tb);
24055}
24056static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24057 PyObject *tmp_type, *tmp_value, *tmp_tb;
24058 #if CYTHON_USE_EXC_INFO_STACK
24059 _PyErr_StackItem *exc_info = tstate->exc_info;
24060 tmp_type = exc_info->exc_type;
24061 tmp_value = exc_info->exc_value;
24062 tmp_tb = exc_info->exc_traceback;
24063 exc_info->exc_type = type;
24064 exc_info->exc_value = value;
24065 exc_info->exc_traceback = tb;
24066 #else
24067 tmp_type = tstate->exc_type;
24068 tmp_value = tstate->exc_value;
24069 tmp_tb = tstate->exc_traceback;
24070 tstate->exc_type = type;
24071 tstate->exc_value = value;
24072 tstate->exc_traceback = tb;
24073 #endif
24074 Py_XDECREF(tmp_type);
24075 Py_XDECREF(tmp_value);
24076 Py_XDECREF(tmp_tb);
24077}
24078#endif
24079
24080/* PyErrExceptionMatches */
24081#if CYTHON_FAST_THREAD_STATE
24082static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24083 Py_ssize_t i, n;
24084 n = PyTuple_GET_SIZE(tuple);
24085#if PY_MAJOR_VERSION >= 3
24086 for (i=0; i<n; i++) {
24087 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
24088 }
24089#endif
24090 for (i=0; i<n; i++) {
24091 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
24092 }
24093 return 0;
24094}
24095static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
24096 PyObject *exc_type = tstate->curexc_type;
24097 if (exc_type == err) return 1;
24098 if (unlikely(!exc_type)) return 0;
24099 if (unlikely(PyTuple_Check(err)))
24100 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
24101 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
24102}
24103#endif
24104
24105/* GetException */
24106#if CYTHON_FAST_THREAD_STATE
24107static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
24108#else
24109static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
24110#endif
24111{
24112 PyObject *local_type, *local_value, *local_tb;
24113#if CYTHON_FAST_THREAD_STATE
24114 PyObject *tmp_type, *tmp_value, *tmp_tb;
24115 local_type = tstate->curexc_type;
24116 local_value = tstate->curexc_value;
24117 local_tb = tstate->curexc_traceback;
24118 tstate->curexc_type = 0;
24119 tstate->curexc_value = 0;
24120 tstate->curexc_traceback = 0;
24121#else
24122 PyErr_Fetch(&local_type, &local_value, &local_tb);
24123#endif
24124 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
24125#if CYTHON_FAST_THREAD_STATE
24126 if (unlikely(tstate->curexc_type))
24127#else
24128 if (unlikely(PyErr_Occurred()))
24129#endif
24130 goto bad;
24131 #if PY_MAJOR_VERSION >= 3
24132 if (local_tb) {
24133 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
24134 goto bad;
24135 }
24136 #endif
24137 Py_XINCREF(local_tb);
24138 Py_XINCREF(local_type);
24139 Py_XINCREF(local_value);
24140 *type = local_type;
24141 *value = local_value;
24142 *tb = local_tb;
24143#if CYTHON_FAST_THREAD_STATE
24144 #if CYTHON_USE_EXC_INFO_STACK
24145 {
24146 _PyErr_StackItem *exc_info = tstate->exc_info;
24147 tmp_type = exc_info->exc_type;
24148 tmp_value = exc_info->exc_value;
24149 tmp_tb = exc_info->exc_traceback;
24150 exc_info->exc_type = local_type;
24151 exc_info->exc_value = local_value;
24152 exc_info->exc_traceback = local_tb;
24153 }
24154 #else
24155 tmp_type = tstate->exc_type;
24156 tmp_value = tstate->exc_value;
24157 tmp_tb = tstate->exc_traceback;
24158 tstate->exc_type = local_type;
24159 tstate->exc_value = local_value;
24160 tstate->exc_traceback = local_tb;
24161 #endif
24162 Py_XDECREF(tmp_type);
24163 Py_XDECREF(tmp_value);
24164 Py_XDECREF(tmp_tb);
24165#else
24166 PyErr_SetExcInfo(local_type, local_value, local_tb);
24167#endif
24168 return 0;
24169bad:
24170 *type = 0;
24171 *value = 0;
24172 *tb = 0;
24173 Py_XDECREF(local_type);
24174 Py_XDECREF(local_value);
24175 Py_XDECREF(local_tb);
24176 return -1;
24177}
24178
24179/* PyErrFetchRestore */
24180#if CYTHON_FAST_THREAD_STATE
24181static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24182 PyObject *tmp_type, *tmp_value, *tmp_tb;
24183 tmp_type = tstate->curexc_type;
24184 tmp_value = tstate->curexc_value;
24185 tmp_tb = tstate->curexc_traceback;
24186 tstate->curexc_type = type;
24187 tstate->curexc_value = value;
24188 tstate->curexc_traceback = tb;
24189 Py_XDECREF(tmp_type);
24190 Py_XDECREF(tmp_value);
24191 Py_XDECREF(tmp_tb);
24192}
24193static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24194 *type = tstate->curexc_type;
24195 *value = tstate->curexc_value;
24196 *tb = tstate->curexc_traceback;
24197 tstate->curexc_type = 0;
24198 tstate->curexc_value = 0;
24199 tstate->curexc_traceback = 0;
24200}
24201#endif
24202
24203/* RaiseException */
24204#if PY_MAJOR_VERSION < 3
24205static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
24206 CYTHON_UNUSED PyObject *cause) {
24207 __Pyx_PyThreadState_declare
24208 Py_XINCREF(type);
24209 if (!value || value == Py_None)
24210 value = NULL;
24211 else
24212 Py_INCREF(value);
24213 if (!tb || tb == Py_None)
24214 tb = NULL;
24215 else {
24216 Py_INCREF(tb);
24217 if (!PyTraceBack_Check(tb)) {
24218 PyErr_SetString(PyExc_TypeError,
24219 "raise: arg 3 must be a traceback or None");
24220 goto raise_error;
24221 }
24222 }
24223 if (PyType_Check(type)) {
24224#if CYTHON_COMPILING_IN_PYPY
24225 if (!value) {
24226 Py_INCREF(Py_None);
24227 value = Py_None;
24228 }
24229#endif
24230 PyErr_NormalizeException(&type, &value, &tb);
24231 } else {
24232 if (value) {
24233 PyErr_SetString(PyExc_TypeError,
24234 "instance exception may not have a separate value");
24235 goto raise_error;
24236 }
24237 value = type;
24238 type = (PyObject*) Py_TYPE(type);
24239 Py_INCREF(type);
24240 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
24241 PyErr_SetString(PyExc_TypeError,
24242 "raise: exception class must be a subclass of BaseException");
24243 goto raise_error;
24244 }
24245 }
24246 __Pyx_PyThreadState_assign
24247 __Pyx_ErrRestore(type, value, tb);
24248 return;
24249raise_error:
24250 Py_XDECREF(value);
24251 Py_XDECREF(type);
24252 Py_XDECREF(tb);
24253 return;
24254}
24255#else
24256static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
24257 PyObject* owned_instance = NULL;
24258 if (tb == Py_None) {
24259 tb = 0;
24260 } else if (tb && !PyTraceBack_Check(tb)) {
24261 PyErr_SetString(PyExc_TypeError,
24262 "raise: arg 3 must be a traceback or None");
24263 goto bad;
24264 }
24265 if (value == Py_None)
24266 value = 0;
24267 if (PyExceptionInstance_Check(type)) {
24268 if (value) {
24269 PyErr_SetString(PyExc_TypeError,
24270 "instance exception may not have a separate value");
24271 goto bad;
24272 }
24273 value = type;
24274 type = (PyObject*) Py_TYPE(value);
24275 } else if (PyExceptionClass_Check(type)) {
24276 PyObject *instance_class = NULL;
24277 if (value && PyExceptionInstance_Check(value)) {
24278 instance_class = (PyObject*) Py_TYPE(value);
24279 if (instance_class != type) {
24280 int is_subclass = PyObject_IsSubclass(instance_class, type);
24281 if (!is_subclass) {
24282 instance_class = NULL;
24283 } else if (unlikely(is_subclass == -1)) {
24284 goto bad;
24285 } else {
24286 type = instance_class;
24287 }
24288 }
24289 }
24290 if (!instance_class) {
24291 PyObject *args;
24292 if (!value)
24293 args = PyTuple_New(0);
24294 else if (PyTuple_Check(value)) {
24295 Py_INCREF(value);
24296 args = value;
24297 } else
24298 args = PyTuple_Pack(1, value);
24299 if (!args)
24300 goto bad;
24301 owned_instance = PyObject_Call(type, args, NULL);
24302 Py_DECREF(args);
24303 if (!owned_instance)
24304 goto bad;
24305 value = owned_instance;
24306 if (!PyExceptionInstance_Check(value)) {
24307 PyErr_Format(PyExc_TypeError,
24308 "calling %R should have returned an instance of "
24309 "BaseException, not %R",
24310 type, Py_TYPE(value));
24311 goto bad;
24312 }
24313 }
24314 } else {
24315 PyErr_SetString(PyExc_TypeError,
24316 "raise: exception class must be a subclass of BaseException");
24317 goto bad;
24318 }
24319 if (cause) {
24320 PyObject *fixed_cause;
24321 if (cause == Py_None) {
24322 fixed_cause = NULL;
24323 } else if (PyExceptionClass_Check(cause)) {
24324 fixed_cause = PyObject_CallObject(cause, NULL);
24325 if (fixed_cause == NULL)
24326 goto bad;
24327 } else if (PyExceptionInstance_Check(cause)) {
24328 fixed_cause = cause;
24329 Py_INCREF(fixed_cause);
24330 } else {
24331 PyErr_SetString(PyExc_TypeError,
24332 "exception causes must derive from "
24333 "BaseException");
24334 goto bad;
24335 }
24336 PyException_SetCause(value, fixed_cause);
24337 }
24338 PyErr_SetObject(type, value);
24339 if (tb) {
24340#if CYTHON_COMPILING_IN_PYPY
24341 PyObject *tmp_type, *tmp_value, *tmp_tb;
24342 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
24343 Py_INCREF(tb);
24344 PyErr_Restore(tmp_type, tmp_value, tb);
24345 Py_XDECREF(tmp_tb);
24346#else
24347 PyThreadState *tstate = __Pyx_PyThreadState_Current;
24348 PyObject* tmp_tb = tstate->curexc_traceback;
24349 if (tb != tmp_tb) {
24350 Py_INCREF(tb);
24351 tstate->curexc_traceback = tb;
24352 Py_XDECREF(tmp_tb);
24353 }
24354#endif
24355 }
24356bad:
24357 Py_XDECREF(owned_instance);
24358 return;
24359}
24360#endif
24361
24362/* ArgTypeTest */
24363static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
24364{
24365 if (unlikely(!type)) {
24366 PyErr_SetString(PyExc_SystemError, "Missing type object");
24367 return 0;
24368 }
24369 else if (exact) {
24370 #if PY_MAJOR_VERSION == 2
24371 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
24372 #endif
24373 }
24374 else {
24375 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
24376 }
24377 PyErr_Format(PyExc_TypeError,
24378 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
24379 name, type->tp_name, Py_TYPE(obj)->tp_name);
24380 return 0;
24381}
24382
24383/* BytesEquals */
24384static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
24385#if CYTHON_COMPILING_IN_PYPY
24386 return PyObject_RichCompareBool(s1, s2, equals);
24387#else
24388 if (s1 == s2) {
24389 return (equals == Py_EQ);
24390 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
24391 const char *ps1, *ps2;
24392 Py_ssize_t length = PyBytes_GET_SIZE(s1);
24393 if (length != PyBytes_GET_SIZE(s2))
24394 return (equals == Py_NE);
24395 ps1 = PyBytes_AS_STRING(s1);
24396 ps2 = PyBytes_AS_STRING(s2);
24397 if (ps1[0] != ps2[0]) {
24398 return (equals == Py_NE);
24399 } else if (length == 1) {
24400 return (equals == Py_EQ);
24401 } else {
24402 int result;
24403#if CYTHON_USE_UNICODE_INTERNALS
24404 Py_hash_t hash1, hash2;
24405 hash1 = ((PyBytesObject*)s1)->ob_shash;
24406 hash2 = ((PyBytesObject*)s2)->ob_shash;
24407 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
24408 return (equals == Py_NE);
24409 }
24410#endif
24411 result = memcmp(ps1, ps2, (size_t)length);
24412 return (equals == Py_EQ) ? (result == 0) : (result != 0);
24413 }
24414 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
24415 return (equals == Py_NE);
24416 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
24417 return (equals == Py_NE);
24418 } else {
24419 int result;
24420 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
24421 if (!py_result)
24422 return -1;
24423 result = __Pyx_PyObject_IsTrue(py_result);
24424 Py_DECREF(py_result);
24425 return result;
24426 }
24427#endif
24428}
24429
24430/* UnicodeEquals */
24431static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
24432#if CYTHON_COMPILING_IN_PYPY
24433 return PyObject_RichCompareBool(s1, s2, equals);
24434#else
24435#if PY_MAJOR_VERSION < 3
24436 PyObject* owned_ref = NULL;
24437#endif
24438 int s1_is_unicode, s2_is_unicode;
24439 if (s1 == s2) {
24440 goto return_eq;
24441 }
24442 s1_is_unicode = PyUnicode_CheckExact(s1);
24443 s2_is_unicode = PyUnicode_CheckExact(s2);
24444#if PY_MAJOR_VERSION < 3
24445 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
24446 owned_ref = PyUnicode_FromObject(s2);
24447 if (unlikely(!owned_ref))
24448 return -1;
24449 s2 = owned_ref;
24450 s2_is_unicode = 1;
24451 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
24452 owned_ref = PyUnicode_FromObject(s1);
24453 if (unlikely(!owned_ref))
24454 return -1;
24455 s1 = owned_ref;
24456 s1_is_unicode = 1;
24457 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
24458 return __Pyx_PyBytes_Equals(s1, s2, equals);
24459 }
24460#endif
24461 if (s1_is_unicode & s2_is_unicode) {
24462 Py_ssize_t length;
24463 int kind;
24464 void *data1, *data2;
24465 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
24466 return -1;
24467 length = __Pyx_PyUnicode_GET_LENGTH(s1);
24468 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
24469 goto return_ne;
24470 }
24471#if CYTHON_USE_UNICODE_INTERNALS
24472 {
24473 Py_hash_t hash1, hash2;
24474 #if CYTHON_PEP393_ENABLED
24475 hash1 = ((PyASCIIObject*)s1)->hash;
24476 hash2 = ((PyASCIIObject*)s2)->hash;
24477 #else
24478 hash1 = ((PyUnicodeObject*)s1)->hash;
24479 hash2 = ((PyUnicodeObject*)s2)->hash;
24480 #endif
24481 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
24482 goto return_ne;
24483 }
24484 }
24485#endif
24486 kind = __Pyx_PyUnicode_KIND(s1);
24487 if (kind != __Pyx_PyUnicode_KIND(s2)) {
24488 goto return_ne;
24489 }
24490 data1 = __Pyx_PyUnicode_DATA(s1);
24491 data2 = __Pyx_PyUnicode_DATA(s2);
24492 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
24493 goto return_ne;
24494 } else if (length == 1) {
24495 goto return_eq;
24496 } else {
24497 int result = memcmp(data1, data2, (size_t)(length * kind));
24498 #if PY_MAJOR_VERSION < 3
24499 Py_XDECREF(owned_ref);
24500 #endif
24501 return (equals == Py_EQ) ? (result == 0) : (result != 0);
24502 }
24503 } else if ((s1 == Py_None) & s2_is_unicode) {
24504 goto return_ne;
24505 } else if ((s2 == Py_None) & s1_is_unicode) {
24506 goto return_ne;
24507 } else {
24508 int result;
24509 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
24510 #if PY_MAJOR_VERSION < 3
24511 Py_XDECREF(owned_ref);
24512 #endif
24513 if (!py_result)
24514 return -1;
24515 result = __Pyx_PyObject_IsTrue(py_result);
24516 Py_DECREF(py_result);
24517 return result;
24518 }
24519return_eq:
24520 #if PY_MAJOR_VERSION < 3
24521 Py_XDECREF(owned_ref);
24522 #endif
24523 return (equals == Py_EQ);
24524return_ne:
24525 #if PY_MAJOR_VERSION < 3
24526 Py_XDECREF(owned_ref);
24527 #endif
24528 return (equals == Py_NE);
24529#endif
24530}
24531
24532/* GetAttr */
24533static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
24534#if CYTHON_USE_TYPE_SLOTS
24535#if PY_MAJOR_VERSION >= 3
24536 if (likely(PyUnicode_Check(n)))
24537#else
24538 if (likely(PyString_Check(n)))
24539#endif
24540 return __Pyx_PyObject_GetAttrStr(o, n);
24541#endif
24542 return PyObject_GetAttr(o, n);
24543}
24544
24545/* decode_c_string */
24546static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
24547 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
24548 const char* encoding, const char* errors,
24549 PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
24550 Py_ssize_t length;
24551 if (unlikely((start < 0) | (stop < 0))) {
24552 size_t slen = strlen(cstring);
24553 if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
24554 PyErr_SetString(PyExc_OverflowError,
24555 "c-string too long to convert to Python");
24556 return NULL;
24557 }
24558 length = (Py_ssize_t) slen;
24559 if (start < 0) {
24560 start += length;
24561 if (start < 0)
24562 start = 0;
24563 }
24564 if (stop < 0)
24565 stop += length;
24566 }
24567 if (unlikely(stop <= start))
24568 return __Pyx_NewRef(__pyx_empty_unicode);
24569 length = stop - start;
24570 cstring += start;
24571 if (decode_func) {
24572 return decode_func(cstring, length, errors);
24573 } else {
24574 return PyUnicode_Decode(cstring, length, encoding, errors);
24575 }
24576}
24577
24578/* GetAttr3 */
24579static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
24580 __Pyx_PyThreadState_declare
24581 __Pyx_PyThreadState_assign
24582 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24583 return NULL;
24584 __Pyx_PyErr_Clear();
24585 Py_INCREF(d);
24586 return d;
24587}
24588static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
24589 PyObject *r = __Pyx_GetAttr(o, n);
24590 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
24591}
24592
24593/* RaiseNoneIterError */
24594static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
24595 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
24596}
24597
24598/* ExtTypeTest */
24599static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
24600 if (unlikely(!type)) {
24601 PyErr_SetString(PyExc_SystemError, "Missing type object");
24602 return 0;
24603 }
24604 if (likely(__Pyx_TypeCheck(obj, type)))
24605 return 1;
24606 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
24607 Py_TYPE(obj)->tp_name, type->tp_name);
24608 return 0;
24609}
24610
24611/* SwapException */
24612#if CYTHON_FAST_THREAD_STATE
24613static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24614 PyObject *tmp_type, *tmp_value, *tmp_tb;
24615 #if CYTHON_USE_EXC_INFO_STACK
24616 _PyErr_StackItem *exc_info = tstate->exc_info;
24617 tmp_type = exc_info->exc_type;
24618 tmp_value = exc_info->exc_value;
24619 tmp_tb = exc_info->exc_traceback;
24620 exc_info->exc_type = *type;
24621 exc_info->exc_value = *value;
24622 exc_info->exc_traceback = *tb;
24623 #else
24624 tmp_type = tstate->exc_type;
24625 tmp_value = tstate->exc_value;
24626 tmp_tb = tstate->exc_traceback;
24627 tstate->exc_type = *type;
24628 tstate->exc_value = *value;
24629 tstate->exc_traceback = *tb;
24630 #endif
24631 *type = tmp_type;
24632 *value = tmp_value;
24633 *tb = tmp_tb;
24634}
24635#else
24636static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
24637 PyObject *tmp_type, *tmp_value, *tmp_tb;
24638 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
24639 PyErr_SetExcInfo(*type, *value, *tb);
24640 *type = tmp_type;
24641 *value = tmp_value;
24642 *tb = tmp_tb;
24643}
24644#endif
24645
24646/* Import */
24647static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
24648 PyObject *empty_list = 0;
24649 PyObject *module = 0;
24650 PyObject *global_dict = 0;
24651 PyObject *empty_dict = 0;
24652 PyObject *list;
24653 #if PY_MAJOR_VERSION < 3
24654 PyObject *py_import;
24655 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
24656 if (!py_import)
24657 goto bad;
24658 #endif
24659 if (from_list)
24660 list = from_list;
24661 else {
24662 empty_list = PyList_New(0);
24663 if (!empty_list)
24664 goto bad;
24665 list = empty_list;
24666 }
24667 global_dict = PyModule_GetDict(__pyx_m);
24668 if (!global_dict)
24669 goto bad;
24670 empty_dict = PyDict_New();
24671 if (!empty_dict)
24672 goto bad;
24673 {
24674 #if PY_MAJOR_VERSION >= 3
24675 if (level == -1) {
24676 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
24677 module = PyImport_ImportModuleLevelObject(
24678 name, global_dict, empty_dict, list, 1);
24679 if (!module) {
24680 if (!PyErr_ExceptionMatches(PyExc_ImportError))
24681 goto bad;
24682 PyErr_Clear();
24683 }
24684 }
24685 level = 0;
24686 }
24687 #endif
24688 if (!module) {
24689 #if PY_MAJOR_VERSION < 3
24690 PyObject *py_level = PyInt_FromLong(level);
24691 if (!py_level)
24692 goto bad;
24693 module = PyObject_CallFunctionObjArgs(py_import,
24694 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
24695 Py_DECREF(py_level);
24696 #else
24697 module = PyImport_ImportModuleLevelObject(
24698 name, global_dict, empty_dict, list, level);
24699 #endif
24700 }
24701 }
24702bad:
24703 #if PY_MAJOR_VERSION < 3
24704 Py_XDECREF(py_import);
24705 #endif
24706 Py_XDECREF(empty_list);
24707 Py_XDECREF(empty_dict);
24708 return module;
24709}
24710
24711/* FastTypeChecks */
24712#if CYTHON_COMPILING_IN_CPYTHON
24713static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
24714 while (a) {
24715 a = a->tp_base;
24716 if (a == b)
24717 return 1;
24718 }
24719 return b == &PyBaseObject_Type;
24720}
24721static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
24722 PyObject *mro;
24723 if (a == b) return 1;
24724 mro = a->tp_mro;
24725 if (likely(mro)) {
24726 Py_ssize_t i, n;
24727 n = PyTuple_GET_SIZE(mro);
24728 for (i = 0; i < n; i++) {
24729 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
24730 return 1;
24731 }
24732 return 0;
24733 }
24734 return __Pyx_InBases(a, b);
24735}
24736#if PY_MAJOR_VERSION == 2
24737static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
24738 PyObject *exception, *value, *tb;
24739 int res;
24740 __Pyx_PyThreadState_declare
24741 __Pyx_PyThreadState_assign
24742 __Pyx_ErrFetch(&exception, &value, &tb);
24743 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
24744 if (unlikely(res == -1)) {
24745 PyErr_WriteUnraisable(err);
24746 res = 0;
24747 }
24748 if (!res) {
24749 res = PyObject_IsSubclass(err, exc_type2);
24750 if (unlikely(res == -1)) {
24751 PyErr_WriteUnraisable(err);
24752 res = 0;
24753 }
24754 }
24755 __Pyx_ErrRestore(exception, value, tb);
24756 return res;
24757}
24758#else
24759static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
24760 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
24761 if (!res) {
24762 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
24763 }
24764 return res;
24765}
24766#endif
24767static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24768 Py_ssize_t i, n;
24769 assert(PyExceptionClass_Check(exc_type));
24770 n = PyTuple_GET_SIZE(tuple);
24771#if PY_MAJOR_VERSION >= 3
24772 for (i=0; i<n; i++) {
24773 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
24774 }
24775#endif
24776 for (i=0; i<n; i++) {
24777 PyObject *t = PyTuple_GET_ITEM(tuple, i);
24778 #if PY_MAJOR_VERSION < 3
24779 if (likely(exc_type == t)) return 1;
24780 #endif
24781 if (likely(PyExceptionClass_Check(t))) {
24782 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
24783 } else {
24784 }
24785 }
24786 return 0;
24787}
24788static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
24789 if (likely(err == exc_type)) return 1;
24790 if (likely(PyExceptionClass_Check(err))) {
24791 if (likely(PyExceptionClass_Check(exc_type))) {
24792 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
24793 } else if (likely(PyTuple_Check(exc_type))) {
24794 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
24795 } else {
24796 }
24797 }
24798 return PyErr_GivenExceptionMatches(err, exc_type);
24799}
24800static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
24801 assert(PyExceptionClass_Check(exc_type1));
24802 assert(PyExceptionClass_Check(exc_type2));
24803 if (likely(err == exc_type1 || err == exc_type2)) return 1;
24804 if (likely(PyExceptionClass_Check(err))) {
24805 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
24806 }
24807 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
24808}
24809#endif
24810
24811/* PyIntBinop */
24812#if !CYTHON_COMPILING_IN_PYPY
24813static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
24814 (void)inplace;
24815 (void)zerodivision_check;
24816 #if PY_MAJOR_VERSION < 3
24817 if (likely(PyInt_CheckExact(op1))) {
24818 const long b = intval;
24819 long x;
24820 long a = PyInt_AS_LONG(op1);
24821 x = (long)((unsigned long)a + b);
24822 if (likely((x^a) >= 0 || (x^b) >= 0))
24823 return PyInt_FromLong(x);
24824 return PyLong_Type.tp_as_number->nb_add(op1, op2);
24825 }
24826 #endif
24827 #if CYTHON_USE_PYLONG_INTERNALS
24828 if (likely(PyLong_CheckExact(op1))) {
24829 const long b = intval;
24830 long a, x;
24831#ifdef HAVE_LONG_LONG
24832 const PY_LONG_LONG llb = intval;
24833 PY_LONG_LONG lla, llx;
24834#endif
24835 const digit* digits = ((PyLongObject*)op1)->ob_digit;
24836 const Py_ssize_t size = Py_SIZE(op1);
24837 if (likely(__Pyx_sst_abs(size) <= 1)) {
24838 a = likely(size) ? digits[0] : 0;
24839 if (size == -1) a = -a;
24840 } else {
24841 switch (size) {
24842 case -2:
24843 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24844 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24845 break;
24846#ifdef HAVE_LONG_LONG
24847 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24848 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
24849 goto long_long;
24850#endif
24851 }
24852 CYTHON_FALLTHROUGH;
24853 case 2:
24854 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24855 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24856 break;
24857#ifdef HAVE_LONG_LONG
24858 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24859 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
24860 goto long_long;
24861#endif
24862 }
24863 CYTHON_FALLTHROUGH;
24864 case -3:
24865 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24866 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24867 break;
24868#ifdef HAVE_LONG_LONG
24869 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24870 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]));
24871 goto long_long;
24872#endif
24873 }
24874 CYTHON_FALLTHROUGH;
24875 case 3:
24876 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24877 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24878 break;
24879#ifdef HAVE_LONG_LONG
24880 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24881 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]));
24882 goto long_long;
24883#endif
24884 }
24885 CYTHON_FALLTHROUGH;
24886 case -4:
24887 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24888 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24889 break;
24890#ifdef HAVE_LONG_LONG
24891 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24892 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]));
24893 goto long_long;
24894#endif
24895 }
24896 CYTHON_FALLTHROUGH;
24897 case 4:
24898 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24899 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24900 break;
24901#ifdef HAVE_LONG_LONG
24902 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24903 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]));
24904 goto long_long;
24905#endif
24906 }
24907 CYTHON_FALLTHROUGH;
24908 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
24909 }
24910 }
24911 x = a + b;
24912 return PyLong_FromLong(x);
24913#ifdef HAVE_LONG_LONG
24914 long_long:
24915 llx = lla + llb;
24916 return PyLong_FromLongLong(llx);
24917#endif
24918
24919
24920 }
24921 #endif
24922 if (PyFloat_CheckExact(op1)) {
24923 const long b = intval;
24924 double a = PyFloat_AS_DOUBLE(op1);
24925 double result;
24926 PyFPE_START_PROTECT("add", return NULL)
24927 result = ((double)a) + (double)b;
24928 PyFPE_END_PROTECT(result)
24929 return PyFloat_FromDouble(result);
24930 }
24931 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
24932}
24933#endif
24934
24935/* ImportFrom */
24936static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
24937 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
24938 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
24939 PyErr_Format(PyExc_ImportError,
24940 #if PY_MAJOR_VERSION < 3
24941 "cannot import name %.230s", PyString_AS_STRING(name));
24942 #else
24943 "cannot import name %S", name);
24944 #endif
24945 }
24946 return value;
24947}
24948
24949/* HasAttr */
24950static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
24951 PyObject *r;
24952 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
24953 PyErr_SetString(PyExc_TypeError,
24954 "hasattr(): attribute name must be string");
24955 return -1;
24956 }
24957 r = __Pyx_GetAttr(o, n);
24958 if (unlikely(!r)) {
24959 PyErr_Clear();
24960 return 0;
24961 } else {
24962 Py_DECREF(r);
24963 return 1;
24964 }
24965}
24966
24967/* PyObject_GenericGetAttrNoDict */
24968#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24969static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
24970 PyErr_Format(PyExc_AttributeError,
24971#if PY_MAJOR_VERSION >= 3
24972 "'%.50s' object has no attribute '%U'",
24973 tp->tp_name, attr_name);
24974#else
24975 "'%.50s' object has no attribute '%.400s'",
24976 tp->tp_name, PyString_AS_STRING(attr_name));
24977#endif
24978 return NULL;
24979}
24980static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
24981 PyObject *descr;
24982 PyTypeObject *tp = Py_TYPE(obj);
24983 if (unlikely(!PyString_Check(attr_name))) {
24984 return PyObject_GenericGetAttr(obj, attr_name);
24985 }
24986 assert(!tp->tp_dictoffset);
24987 descr = _PyType_Lookup(tp, attr_name);
24988 if (unlikely(!descr)) {
24989 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
24990 }
24991 Py_INCREF(descr);
24992 #if PY_MAJOR_VERSION < 3
24993 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
24994 #endif
24995 {
24996 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
24997 if (unlikely(f)) {
24998 PyObject *res = f(descr, obj, (PyObject *)tp);
24999 Py_DECREF(descr);
25000 return res;
25001 }
25002 }
25003 return descr;
25004}
25005#endif
25006
25007/* PyObject_GenericGetAttr */
25008#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
25009static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
25010 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
25011 return PyObject_GenericGetAttr(obj, attr_name);
25012 }
25013 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
25014}
25015#endif
25016
25017/* SetVTable */
25018static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
25019#if PY_VERSION_HEX >= 0x02070000
25020 PyObject *ob = PyCapsule_New(vtable, 0, 0);
25021#else
25022 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
25023#endif
25024 if (!ob)
25025 goto bad;
25026 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
25027 goto bad;
25028 Py_DECREF(ob);
25029 return 0;
25030bad:
25031 Py_XDECREF(ob);
25032 return -1;
25033}
25034
25035/* PyObjectGetAttrStrNoError */
25036static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
25037 __Pyx_PyThreadState_declare
25038 __Pyx_PyThreadState_assign
25039 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
25040 __Pyx_PyErr_Clear();
25041}
25042static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
25043 PyObject *result;
25044#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
25045 PyTypeObject* tp = Py_TYPE(obj);
25046 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
25047 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
25048 }
25049#endif
25050 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
25051 if (unlikely(!result)) {
25052 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
25053 }
25054 return result;
25055}
25056
25057/* SetupReduce */
25058static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
25059 int ret;
25060 PyObject *name_attr;
25061 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
25062 if (likely(name_attr)) {
25063 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
25064 } else {
25065 ret = -1;
25066 }
25067 if (unlikely(ret < 0)) {
25068 PyErr_Clear();
25069 ret = 0;
25070 }
25071 Py_XDECREF(name_attr);
25072 return ret;
25073}
25074static int __Pyx_setup_reduce(PyObject* type_obj) {
25075 int ret = 0;
25076 PyObject *object_reduce = NULL;
25077 PyObject *object_reduce_ex = NULL;
25078 PyObject *reduce = NULL;
25079 PyObject *reduce_ex = NULL;
25080 PyObject *reduce_cython = NULL;
25081 PyObject *setstate = NULL;
25082 PyObject *setstate_cython = NULL;
25083#if CYTHON_USE_PYTYPE_LOOKUP
25084 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
25085#else
25086 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
25087#endif
25088#if CYTHON_USE_PYTYPE_LOOKUP
25089 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
25090#else
25091 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
25092#endif
25093 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
25094 if (reduce_ex == object_reduce_ex) {
25095#if CYTHON_USE_PYTYPE_LOOKUP
25096 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
25097#else
25098 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
25099#endif
25100 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
25101 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
25102 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
25103 if (likely(reduce_cython)) {
25104 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
25105 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
25106 } else if (reduce == object_reduce || PyErr_Occurred()) {
25107 goto __PYX_BAD;
25108 }
25109 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
25110 if (!setstate) PyErr_Clear();
25111 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
25112 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
25113 if (likely(setstate_cython)) {
25114 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
25115 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
25116 } else if (!setstate || PyErr_Occurred()) {
25117 goto __PYX_BAD;
25118 }
25119 }
25120 PyType_Modified((PyTypeObject*)type_obj);
25121 }
25122 }
25123 goto __PYX_GOOD;
25124__PYX_BAD:
25125 if (!PyErr_Occurred())
25126 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
25127 ret = -1;
25128__PYX_GOOD:
25129#if !CYTHON_USE_PYTYPE_LOOKUP
25130 Py_XDECREF(object_reduce);
25131 Py_XDECREF(object_reduce_ex);
25132#endif
25133 Py_XDECREF(reduce);
25134 Py_XDECREF(reduce_ex);
25135 Py_XDECREF(reduce_cython);
25136 Py_XDECREF(setstate);
25137 Py_XDECREF(setstate_cython);
25138 return ret;
25139}
25140
25141/* TypeImport */
25142#ifndef __PYX_HAVE_RT_ImportType
25143#define __PYX_HAVE_RT_ImportType
25144static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
25145 size_t size, enum __Pyx_ImportType_CheckSize check_size)
25146{
25147 PyObject *result = 0;
25148 char warning[200];
25149 Py_ssize_t basicsize;
25150#ifdef Py_LIMITED_API
25151 PyObject *py_basicsize;
25152#endif
25153 result = PyObject_GetAttrString(module, class_name);
25154 if (!result)
25155 goto bad;
25156 if (!PyType_Check(result)) {
25157 PyErr_Format(PyExc_TypeError,
25158 "%.200s.%.200s is not a type object",
25159 module_name, class_name);
25160 goto bad;
25161 }
25162#ifndef Py_LIMITED_API
25163 basicsize = ((PyTypeObject *)result)->tp_basicsize;
25164#else
25165 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
25166 if (!py_basicsize)
25167 goto bad;
25168 basicsize = PyLong_AsSsize_t(py_basicsize);
25169 Py_DECREF(py_basicsize);
25170 py_basicsize = 0;
25171 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
25172 goto bad;
25173#endif
25174 if ((size_t)basicsize < size) {
25175 PyErr_Format(PyExc_ValueError,
25176 "%.200s.%.200s size changed, may indicate binary incompatibility. "
25177 "Expected %zd from C header, got %zd from PyObject",
25178 module_name, class_name, size, basicsize);
25179 goto bad;
25180 }
25181 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
25182 PyErr_Format(PyExc_ValueError,
25183 "%.200s.%.200s size changed, may indicate binary incompatibility. "
25184 "Expected %zd from C header, got %zd from PyObject",
25185 module_name, class_name, size, basicsize);
25186 goto bad;
25187 }
25188 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
25189 PyOS_snprintf(warning, sizeof(warning),
25190 "%s.%s size changed, may indicate binary incompatibility. "
25191 "Expected %zd from C header, got %zd from PyObject",
25192 module_name, class_name, size, basicsize);
25193 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
25194 }
25195 return (PyTypeObject *)result;
25196bad:
25197 Py_XDECREF(result);
25198 return NULL;
25199}
25200#endif
25201
25202/* CLineInTraceback */
25203#ifndef CYTHON_CLINE_IN_TRACEBACK
25204static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
25205 PyObject *use_cline;
25206 PyObject *ptype, *pvalue, *ptraceback;
25207#if CYTHON_COMPILING_IN_CPYTHON
25208 PyObject **cython_runtime_dict;
25209#endif
25210 if (unlikely(!__pyx_cython_runtime)) {
25211 return c_line;
25212 }
25213 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25214#if CYTHON_COMPILING_IN_CPYTHON
25215 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
25216 if (likely(cython_runtime_dict)) {
25217 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
25218 use_cline, *cython_runtime_dict,
25219 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
25220 } else
25221#endif
25222 {
25223 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
25224 if (use_cline_obj) {
25225 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
25226 Py_DECREF(use_cline_obj);
25227 } else {
25228 PyErr_Clear();
25229 use_cline = NULL;
25230 }
25231 }
25232 if (!use_cline) {
25233 c_line = 0;
25234 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
25235 }
25236 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
25237 c_line = 0;
25238 }
25239 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25240 return c_line;
25241}
25242#endif
25243
25244/* CodeObjectCache */
25245static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
25246 int start = 0, mid = 0, end = count - 1;
25247 if (end >= 0 && code_line > entries[end].code_line) {
25248 return count;
25249 }
25250 while (start < end) {
25251 mid = start + (end - start) / 2;
25252 if (code_line < entries[mid].code_line) {
25253 end = mid;
25254 } else if (code_line > entries[mid].code_line) {
25255 start = mid + 1;
25256 } else {
25257 return mid;
25258 }
25259 }
25260 if (code_line <= entries[mid].code_line) {
25261 return mid;
25262 } else {
25263 return mid + 1;
25264 }
25265}
25266static PyCodeObject *__pyx_find_code_object(int code_line) {
25267 PyCodeObject* code_object;
25268 int pos;
25269 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25270 return NULL;
25271 }
25272 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25273 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
25274 return NULL;
25275 }
25276 code_object = __pyx_code_cache.entries[pos].code_object;
25277 Py_INCREF(code_object);
25278 return code_object;
25279}
25280static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
25281 int pos, i;
25282 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
25283 if (unlikely(!code_line)) {
25284 return;
25285 }
25286 if (unlikely(!entries)) {
25287 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
25288 if (likely(entries)) {
25289 __pyx_code_cache.entries = entries;
25290 __pyx_code_cache.max_count = 64;
25291 __pyx_code_cache.count = 1;
25292 entries[0].code_line = code_line;
25293 entries[0].code_object = code_object;
25294 Py_INCREF(code_object);
25295 }
25296 return;
25297 }
25298 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25299 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
25300 PyCodeObject* tmp = entries[pos].code_object;
25301 entries[pos].code_object = code_object;
25302 Py_DECREF(tmp);
25303 return;
25304 }
25305 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
25306 int new_max = __pyx_code_cache.max_count + 64;
25307 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
25308 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
25309 if (unlikely(!entries)) {
25310 return;
25311 }
25312 __pyx_code_cache.entries = entries;
25313 __pyx_code_cache.max_count = new_max;
25314 }
25315 for (i=__pyx_code_cache.count; i>pos; i--) {
25316 entries[i] = entries[i-1];
25317 }
25318 entries[pos].code_line = code_line;
25319 entries[pos].code_object = code_object;
25320 __pyx_code_cache.count++;
25321 Py_INCREF(code_object);
25322}
25323
25324/* AddTraceback */
25325#include "compile.h"
25326#include "frameobject.h"
25327#include "traceback.h"
25328static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
25329 const char *funcname, int c_line,
25330 int py_line, const char *filename) {
25331 PyCodeObject *py_code = NULL;
25332 PyObject *py_funcname = NULL;
25333 #if PY_MAJOR_VERSION < 3
25334 PyObject *py_srcfile = NULL;
25335 py_srcfile = PyString_FromString(filename);
25336 if (!py_srcfile) goto bad;
25337 #endif
25338 if (c_line) {
25339 #if PY_MAJOR_VERSION < 3
25340 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25341 if (!py_funcname) goto bad;
25342 #else
25343 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25344 if (!py_funcname) goto bad;
25345 funcname = PyUnicode_AsUTF8(py_funcname);
25346 if (!funcname) goto bad;
25347 #endif
25348 }
25349 else {
25350 #if PY_MAJOR_VERSION < 3
25351 py_funcname = PyString_FromString(funcname);
25352 if (!py_funcname) goto bad;
25353 #endif
25354 }
25355 #if PY_MAJOR_VERSION < 3
25356 py_code = __Pyx_PyCode_New(
25357 0,
25358 0,
25359 0,
25360 0,
25361 0,
25362 __pyx_empty_bytes, /*PyObject *code,*/
25363 __pyx_empty_tuple, /*PyObject *consts,*/
25364 __pyx_empty_tuple, /*PyObject *names,*/
25365 __pyx_empty_tuple, /*PyObject *varnames,*/
25366 __pyx_empty_tuple, /*PyObject *freevars,*/
25367 __pyx_empty_tuple, /*PyObject *cellvars,*/
25368 py_srcfile, /*PyObject *filename,*/
25369 py_funcname, /*PyObject *name,*/
25370 py_line,
25371 __pyx_empty_bytes /*PyObject *lnotab*/
25372 );
25373 Py_DECREF(py_srcfile);
25374 #else
25375 py_code = PyCode_NewEmpty(filename, funcname, py_line);
25376 #endif
25377 Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
25378 return py_code;
25379bad:
25380 Py_XDECREF(py_funcname);
25381 #if PY_MAJOR_VERSION < 3
25382 Py_XDECREF(py_srcfile);
25383 #endif
25384 return NULL;
25385}
25386static void __Pyx_AddTraceback(const char *funcname, int c_line,
25387 int py_line, const char *filename) {
25388 PyCodeObject *py_code = 0;
25389 PyFrameObject *py_frame = 0;
25390 PyThreadState *tstate = __Pyx_PyThreadState_Current;
25391 if (c_line) {
25392 c_line = __Pyx_CLineForTraceback(tstate, c_line);
25393 }
25394 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
25395 if (!py_code) {
25396 py_code = __Pyx_CreateCodeObjectForTraceback(
25397 funcname, c_line, py_line, filename);
25398 if (!py_code) goto bad;
25399 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
25400 }
25401 py_frame = PyFrame_New(
25402 tstate, /*PyThreadState *tstate,*/
25403 py_code, /*PyCodeObject *code,*/
25404 __pyx_d, /*PyObject *globals,*/
25405 0 /*PyObject *locals*/
25406 );
25407 if (!py_frame) goto bad;
25408 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
25409 PyTraceBack_Here(py_frame);
25410bad:
25411 Py_XDECREF(py_code);
25412 Py_XDECREF(py_frame);
25413}
25414
25415#if PY_MAJOR_VERSION < 3
25416static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
25417 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
25418 if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
25419 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
25420 PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
25421 return -1;
25422}
25423static void __Pyx_ReleaseBuffer(Py_buffer *view) {
25424 PyObject *obj = view->obj;
25425 if (!obj) return;
25426 if (PyObject_CheckBuffer(obj)) {
25427 PyBuffer_Release(view);
25428 return;
25429 }
25430 if ((0)) {}
25431 view->obj = NULL;
25432 Py_DECREF(obj);
25433}
25434#endif
25435
25436
25437/* MemviewSliceIsContig */
25438static int
25439__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
25440{
25441 int i, index, step, start;
25442 Py_ssize_t itemsize = mvs.memview->view.itemsize;
25443 if (order == 'F') {
25444 step = 1;
25445 start = 0;
25446 } else {
25447 step = -1;
25448 start = ndim - 1;
25449 }
25450 for (i = 0; i < ndim; i++) {
25451 index = start + step * i;
25452 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
25453 return 0;
25454 itemsize *= mvs.shape[index];
25455 }
25456 return 1;
25457}
25458
25459/* OverlappingSlices */
25460static void
25461__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
25462 void **out_start, void **out_end,
25463 int ndim, size_t itemsize)
25464{
25465 char *start, *end;
25466 int i;
25467 start = end = slice->data;
25468 for (i = 0; i < ndim; i++) {
25469 Py_ssize_t stride = slice->strides[i];
25470 Py_ssize_t extent = slice->shape[i];
25471 if (extent == 0) {
25472 *out_start = *out_end = start;
25473 return;
25474 } else {
25475 if (stride > 0)
25476 end += stride * (extent - 1);
25477 else
25478 start += stride * (extent - 1);
25479 }
25480 }
25481 *out_start = start;
25482 *out_end = end + itemsize;
25483}
25484static int
25485__pyx_slices_overlap(__Pyx_memviewslice *slice1,
25486 __Pyx_memviewslice *slice2,
25487 int ndim, size_t itemsize)
25488{
25489 void *start1, *end1, *start2, *end2;
25490 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
25491 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
25492 return (start1 < end2) && (start2 < end1);
25493}
25494
25495/* Capsule */
25496static CYTHON_INLINE PyObject *
25497__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
25498{
25499 PyObject *cobj;
25500#if PY_VERSION_HEX >= 0x02070000
25501 cobj = PyCapsule_New(p, sig, NULL);
25502#else
25503 cobj = PyCObject_FromVoidPtr(p, NULL);
25504#endif
25505 return cobj;
25506}
25507
25508/* IsLittleEndian */
25509static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
25510{
25511 union {
25512 uint32_t u32;
25513 uint8_t u8[4];
25514 } S;
25515 S.u32 = 0x01020304;
25516 return S.u8[0] == 4;
25517}
25518
25519/* BufferFormatCheck */
25520static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
25521 __Pyx_BufFmt_StackElem* stack,
25522 __Pyx_TypeInfo* type) {
25523 stack[0].field = &ctx->root;
25524 stack[0].parent_offset = 0;
25525 ctx->root.type = type;
25526 ctx->root.name = "buffer dtype";
25527 ctx->root.offset = 0;
25528 ctx->head = stack;
25529 ctx->head->field = &ctx->root;
25530 ctx->fmt_offset = 0;
25531 ctx->head->parent_offset = 0;
25532 ctx->new_packmode = '@';
25533 ctx->enc_packmode = '@';
25534 ctx->new_count = 1;
25535 ctx->enc_count = 0;
25536 ctx->enc_type = 0;
25537 ctx->is_complex = 0;
25538 ctx->is_valid_array = 0;
25539 ctx->struct_alignment = 0;
25540 while (type->typegroup == 'S') {
25541 ++ctx->head;
25542 ctx->head->field = type->fields;
25543 ctx->head->parent_offset = 0;
25544 type = type->fields->type;
25545 }
25546}
25547static int __Pyx_BufFmt_ParseNumber(const char** ts) {
25548 int count;
25549 const char* t = *ts;
25550 if (*t < '0' || *t > '9') {
25551 return -1;
25552 } else {
25553 count = *t++ - '0';
25554 while (*t >= '0' && *t <= '9') {
25555 count *= 10;
25556 count += *t++ - '0';
25557 }
25558 }
25559 *ts = t;
25560 return count;
25561}
25562static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
25563 int number = __Pyx_BufFmt_ParseNumber(ts);
25564 if (number == -1)
25565 PyErr_Format(PyExc_ValueError,\
25566 "Does not understand character buffer dtype format string ('%c')", **ts);
25567 return number;
25568}
25569static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
25570 PyErr_Format(PyExc_ValueError,
25571 "Unexpected format string character: '%c'", ch);
25572}
25573static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
25574 switch (ch) {
25575 case '?': return "'bool'";
25576 case 'c': return "'char'";
25577 case 'b': return "'signed char'";
25578 case 'B': return "'unsigned char'";
25579 case 'h': return "'short'";
25580 case 'H': return "'unsigned short'";
25581 case 'i': return "'int'";
25582 case 'I': return "'unsigned int'";
25583 case 'l': return "'long'";
25584 case 'L': return "'unsigned long'";
25585 case 'q': return "'long long'";
25586 case 'Q': return "'unsigned long long'";
25587 case 'f': return (is_complex ? "'complex float'" : "'float'");
25588 case 'd': return (is_complex ? "'complex double'" : "'double'");
25589 case 'g': return (is_complex ? "'complex long double'" : "'long double'");
25590 case 'T': return "a struct";
25591 case 'O': return "Python object";
25592 case 'P': return "a pointer";
25593 case 's': case 'p': return "a string";
25594 case 0: return "end";
25595 default: return "unparseable format string";
25596 }
25597}
25598static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
25599 switch (ch) {
25600 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25601 case 'h': case 'H': return 2;
25602 case 'i': case 'I': case 'l': case 'L': return 4;
25603 case 'q': case 'Q': return 8;
25604 case 'f': return (is_complex ? 8 : 4);
25605 case 'd': return (is_complex ? 16 : 8);
25606 case 'g': {
25607 PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
25608 return 0;
25609 }
25610 case 'O': case 'P': return sizeof(void*);
25611 default:
25612 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25613 return 0;
25614 }
25615}
25616static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
25617 switch (ch) {
25618 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25619 case 'h': case 'H': return sizeof(short);
25620 case 'i': case 'I': return sizeof(int);
25621 case 'l': case 'L': return sizeof(long);
25622 #ifdef HAVE_LONG_LONG
25623 case 'q': case 'Q': return sizeof(PY_LONG_LONG);
25624 #endif
25625 case 'f': return sizeof(float) * (is_complex ? 2 : 1);
25626 case 'd': return sizeof(double) * (is_complex ? 2 : 1);
25627 case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
25628 case 'O': case 'P': return sizeof(void*);
25629 default: {
25630 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25631 return 0;
25632 }
25633 }
25634}
25635typedef struct { char c; short x; } __Pyx_st_short;
25636typedef struct { char c; int x; } __Pyx_st_int;
25637typedef struct { char c; long x; } __Pyx_st_long;
25638typedef struct { char c; float x; } __Pyx_st_float;
25639typedef struct { char c; double x; } __Pyx_st_double;
25640typedef struct { char c; long double x; } __Pyx_st_longdouble;
25641typedef struct { char c; void *x; } __Pyx_st_void_p;
25642#ifdef HAVE_LONG_LONG
25643typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
25644#endif
25645static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
25646 switch (ch) {
25647 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25648 case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
25649 case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
25650 case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
25651#ifdef HAVE_LONG_LONG
25652 case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
25653#endif
25654 case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
25655 case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
25656 case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
25657 case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
25658 default:
25659 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25660 return 0;
25661 }
25662}
25663/* These are for computing the padding at the end of the struct to align
25664 on the first member of the struct. This will probably the same as above,
25665 but we don't have any guarantees.
25666 */
25667typedef struct { short x; char c; } __Pyx_pad_short;
25668typedef struct { int x; char c; } __Pyx_pad_int;
25669typedef struct { long x; char c; } __Pyx_pad_long;
25670typedef struct { float x; char c; } __Pyx_pad_float;
25671typedef struct { double x; char c; } __Pyx_pad_double;
25672typedef struct { long double x; char c; } __Pyx_pad_longdouble;
25673typedef struct { void *x; char c; } __Pyx_pad_void_p;
25674#ifdef HAVE_LONG_LONG
25675typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
25676#endif
25677static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
25678 switch (ch) {
25679 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25680 case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
25681 case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
25682 case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
25683#ifdef HAVE_LONG_LONG
25684 case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
25685#endif
25686 case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
25687 case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
25688 case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
25689 case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
25690 default:
25691 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25692 return 0;
25693 }
25694}
25695static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
25696 switch (ch) {
25697 case 'c':
25698 return 'H';
25699 case 'b': case 'h': case 'i':
25700 case 'l': case 'q': case 's': case 'p':
25701 return 'I';
25702 case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
25703 return 'U';
25704 case 'f': case 'd': case 'g':
25705 return (is_complex ? 'C' : 'R');
25706 case 'O':
25707 return 'O';
25708 case 'P':
25709 return 'P';
25710 default: {
25711 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25712 return 0;
25713 }
25714 }
25715}
25716static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
25717 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
25718 const char* expected;
25719 const char* quote;
25720 if (ctx->head == NULL) {
25721 expected = "end";
25722 quote = "";
25723 } else {
25724 expected = ctx->head->field->type->name;
25725 quote = "'";
25726 }
25727 PyErr_Format(PyExc_ValueError,
25728 "Buffer dtype mismatch, expected %s%s%s but got %s",
25729 quote, expected, quote,
25730 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
25731 } else {
25732 __Pyx_StructField* field = ctx->head->field;
25733 __Pyx_StructField* parent = (ctx->head - 1)->field;
25734 PyErr_Format(PyExc_ValueError,
25735 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
25736 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
25737 parent->type->name, field->name);
25738 }
25739}
25740static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
25741 char group;
25742 size_t size, offset, arraysize = 1;
25743 if (ctx->enc_type == 0) return 0;
25744 if (ctx->head->field->type->arraysize[0]) {
25745 int i, ndim = 0;
25746 if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
25747 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
25748 ndim = 1;
25749 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
25750 PyErr_Format(PyExc_ValueError,
25751 "Expected a dimension of size %zu, got %zu",
25752 ctx->head->field->type->arraysize[0], ctx->enc_count);
25753 return -1;
25754 }
25755 }
25756 if (!ctx->is_valid_array) {
25757 PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
25758 ctx->head->field->type->ndim, ndim);
25759 return -1;
25760 }
25761 for (i = 0; i < ctx->head->field->type->ndim; i++) {
25762 arraysize *= ctx->head->field->type->arraysize[i];
25763 }
25764 ctx->is_valid_array = 0;
25765 ctx->enc_count = 1;
25766 }
25767 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
25768 do {
25769 __Pyx_StructField* field = ctx->head->field;
25770 __Pyx_TypeInfo* type = field->type;
25771 if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
25772 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
25773 } else {
25774 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
25775 }
25776 if (ctx->enc_packmode == '@') {
25777 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
25778 size_t align_mod_offset;
25779 if (align_at == 0) return -1;
25780 align_mod_offset = ctx->fmt_offset % align_at;
25781 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
25782 if (ctx->struct_alignment == 0)
25783 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
25784 ctx->is_complex);
25785 }
25786 if (type->size != size || type->typegroup != group) {
25787 if (type->typegroup == 'C' && type->fields != NULL) {
25788 size_t parent_offset = ctx->head->parent_offset + field->offset;
25789 ++ctx->head;
25790 ctx->head->field = type->fields;
25791 ctx->head->parent_offset = parent_offset;
25792 continue;
25793 }
25794 if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
25795 } else {
25796 __Pyx_BufFmt_RaiseExpected(ctx);
25797 return -1;
25798 }
25799 }
25800 offset = ctx->head->parent_offset + field->offset;
25801 if (ctx->fmt_offset != offset) {
25802 PyErr_Format(PyExc_ValueError,
25803 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
25804 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
25805 return -1;
25806 }
25807 ctx->fmt_offset += size;
25808 if (arraysize)
25809 ctx->fmt_offset += (arraysize - 1) * size;
25810 --ctx->enc_count;
25811 while (1) {
25812 if (field == &ctx->root) {
25813 ctx->head = NULL;
25814 if (ctx->enc_count != 0) {
25815 __Pyx_BufFmt_RaiseExpected(ctx);
25816 return -1;
25817 }
25818 break;
25819 }
25820 ctx->head->field = ++field;
25821 if (field->type == NULL) {
25822 --ctx->head;
25823 field = ctx->head->field;
25824 continue;
25825 } else if (field->type->typegroup == 'S') {
25826 size_t parent_offset = ctx->head->parent_offset + field->offset;
25827 if (field->type->fields->type == NULL) continue;
25828 field = field->type->fields;
25829 ++ctx->head;
25830 ctx->head->field = field;
25831 ctx->head->parent_offset = parent_offset;
25832 break;
25833 } else {
25834 break;
25835 }
25836 }
25837 } while (ctx->enc_count);
25838 ctx->enc_type = 0;
25839 ctx->is_complex = 0;
25840 return 0;
25841}
25842static PyObject *
25843__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
25844{
25845 const char *ts = *tsp;
25846 int i = 0, number, ndim;
25847 ++ts;
25848 if (ctx->new_count != 1) {
25849 PyErr_SetString(PyExc_ValueError,
25850 "Cannot handle repeated arrays in format string");
25851 return NULL;
25852 }
25853 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25854 ndim = ctx->head->field->type->ndim;
25855 while (*ts && *ts != ')') {
25856 switch (*ts) {
25857 case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
25858 default: break;
25859 }
25860 number = __Pyx_BufFmt_ExpectNumber(&ts);
25861 if (number == -1) return NULL;
25862 if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
25863 return PyErr_Format(PyExc_ValueError,
25864 "Expected a dimension of size %zu, got %d",
25865 ctx->head->field->type->arraysize[i], number);
25866 if (*ts != ',' && *ts != ')')
25867 return PyErr_Format(PyExc_ValueError,
25868 "Expected a comma in format string, got '%c'", *ts);
25869 if (*ts == ',') ts++;
25870 i++;
25871 }
25872 if (i != ndim)
25873 return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
25874 ctx->head->field->type->ndim, i);
25875 if (!*ts) {
25876 PyErr_SetString(PyExc_ValueError,
25877 "Unexpected end of format string, expected ')'");
25878 return NULL;
25879 }
25880 ctx->is_valid_array = 1;
25881 ctx->new_count = 1;
25882 *tsp = ++ts;
25883 return Py_None;
25884}
25885static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
25886 int got_Z = 0;
25887 while (1) {
25888 switch(*ts) {
25889 case 0:
25890 if (ctx->enc_type != 0 && ctx->head == NULL) {
25891 __Pyx_BufFmt_RaiseExpected(ctx);
25892 return NULL;
25893 }
25894 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25895 if (ctx->head != NULL) {
25896 __Pyx_BufFmt_RaiseExpected(ctx);
25897 return NULL;
25898 }
25899 return ts;
25900 case ' ':
25901 case '\r':
25902 case '\n':
25903 ++ts;
25904 break;
25905 case '<':
25906 if (!__Pyx_Is_Little_Endian()) {
25907 PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
25908 return NULL;
25909 }
25910 ctx->new_packmode = '=';
25911 ++ts;
25912 break;
25913 case '>':
25914 case '!':
25915 if (__Pyx_Is_Little_Endian()) {
25916 PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
25917 return NULL;
25918 }
25919 ctx->new_packmode = '=';
25920 ++ts;
25921 break;
25922 case '=':
25923 case '@':
25924 case '^':
25925 ctx->new_packmode = *ts++;
25926 break;
25927 case 'T':
25928 {
25929 const char* ts_after_sub;
25930 size_t i, struct_count = ctx->new_count;
25931 size_t struct_alignment = ctx->struct_alignment;
25932 ctx->new_count = 1;
25933 ++ts;
25934 if (*ts != '{') {
25935 PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
25936 return NULL;
25937 }
25938 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25939 ctx->enc_type = 0;
25940 ctx->enc_count = 0;
25941 ctx->struct_alignment = 0;
25942 ++ts;
25943 ts_after_sub = ts;
25944 for (i = 0; i != struct_count; ++i) {
25945 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
25946 if (!ts_after_sub) return NULL;
25947 }
25948 ts = ts_after_sub;
25949 if (struct_alignment) ctx->struct_alignment = struct_alignment;
25950 }
25951 break;
25952 case '}':
25953 {
25954 size_t alignment = ctx->struct_alignment;
25955 ++ts;
25956 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25957 ctx->enc_type = 0;
25958 if (alignment && ctx->fmt_offset % alignment) {
25959 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
25960 }
25961 }
25962 return ts;
25963 case 'x':
25964 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25965 ctx->fmt_offset += ctx->new_count;
25966 ctx->new_count = 1;
25967 ctx->enc_count = 0;
25968 ctx->enc_type = 0;
25969 ctx->enc_packmode = ctx->new_packmode;
25970 ++ts;
25971 break;
25972 case 'Z':
25973 got_Z = 1;
25974 ++ts;
25975 if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
25976 __Pyx_BufFmt_RaiseUnexpectedChar('Z');
25977 return NULL;
25978 }
25979 CYTHON_FALLTHROUGH;
25980 case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
25981 case 'l': case 'L': case 'q': case 'Q':
25982 case 'f': case 'd': case 'g':
25983 case 'O': case 'p':
25984 if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
25985 (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
25986 ctx->enc_count += ctx->new_count;
25987 ctx->new_count = 1;
25988 got_Z = 0;
25989 ++ts;
25990 break;
25991 }
25992 CYTHON_FALLTHROUGH;
25993 case 's':
25994 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25995 ctx->enc_count = ctx->new_count;
25996 ctx->enc_packmode = ctx->new_packmode;
25997 ctx->enc_type = *ts;
25998 ctx->is_complex = got_Z;
25999 ++ts;
26000 ctx->new_count = 1;
26001 got_Z = 0;
26002 break;
26003 case ':':
26004 ++ts;
26005 while(*ts != ':') ++ts;
26006 ++ts;
26007 break;
26008 case '(':
26009 if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
26010 break;
26011 default:
26012 {
26013 int number = __Pyx_BufFmt_ExpectNumber(&ts);
26014 if (number == -1) return NULL;
26015 ctx->new_count = (size_t)number;
26016 }
26017 }
26018 }
26019}
26020
26021/* TypeInfoCompare */
26022 static int
26023__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
26024{
26025 int i;
26026 if (!a || !b)
26027 return 0;
26028 if (a == b)
26029 return 1;
26030 if (a->size != b->size || a->typegroup != b->typegroup ||
26031 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
26032 if (a->typegroup == 'H' || b->typegroup == 'H') {
26033 return a->size == b->size;
26034 } else {
26035 return 0;
26036 }
26037 }
26038 if (a->ndim) {
26039 for (i = 0; i < a->ndim; i++)
26040 if (a->arraysize[i] != b->arraysize[i])
26041 return 0;
26042 }
26043 if (a->typegroup == 'S') {
26044 if (a->flags != b->flags)
26045 return 0;
26046 if (a->fields || b->fields) {
26047 if (!(a->fields && b->fields))
26048 return 0;
26049 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
26050 __Pyx_StructField *field_a = a->fields + i;
26051 __Pyx_StructField *field_b = b->fields + i;
26052 if (field_a->offset != field_b->offset ||
26053 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
26054 return 0;
26055 }
26056 return !a->fields[i].type && !b->fields[i].type;
26057 }
26058 }
26059 return 1;
26060}
26061
26062/* MemviewSliceValidateAndInit */
26063 static int
26064__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
26065{
26066 if (buf->shape[dim] <= 1)
26067 return 1;
26068 if (buf->strides) {
26069 if (spec & __Pyx_MEMVIEW_CONTIG) {
26070 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
26071 if (unlikely(buf->strides[dim] != sizeof(void *))) {
26072 PyErr_Format(PyExc_ValueError,
26073 "Buffer is not indirectly contiguous "
26074 "in dimension %d.", dim);
26075 goto fail;
26076 }
26077 } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
26078 PyErr_SetString(PyExc_ValueError,
26079 "Buffer and memoryview are not contiguous "
26080 "in the same dimension.");
26081 goto fail;
26082 }
26083 }
26084 if (spec & __Pyx_MEMVIEW_FOLLOW) {
26085 Py_ssize_t stride = buf->strides[dim];
26086 if (stride < 0)
26087 stride = -stride;
26088 if (unlikely(stride < buf->itemsize)) {
26089 PyErr_SetString(PyExc_ValueError,
26090 "Buffer and memoryview are not contiguous "
26091 "in the same dimension.");
26092 goto fail;
26093 }
26094 }
26095 } else {
26096 if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
26097 PyErr_Format(PyExc_ValueError,
26098 "C-contiguous buffer is not contiguous in "
26099 "dimension %d", dim);
26100 goto fail;
26101 } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
26102 PyErr_Format(PyExc_ValueError,
26103 "C-contiguous buffer is not indirect in "
26104 "dimension %d", dim);
26105 goto fail;
26106 } else if (unlikely(buf->suboffsets)) {
26107 PyErr_SetString(PyExc_ValueError,
26108 "Buffer exposes suboffsets but no strides");
26109 goto fail;
26110 }
26111 }
26112 return 1;
26113fail:
26114 return 0;
26115}
26116static int
26117__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
26118{
26119 if (spec & __Pyx_MEMVIEW_DIRECT) {
26120 if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
26121 PyErr_Format(PyExc_ValueError,
26122 "Buffer not compatible with direct access "
26123 "in dimension %d.", dim);
26124 goto fail;
26125 }
26126 }
26127 if (spec & __Pyx_MEMVIEW_PTR) {
26128 if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
26129 PyErr_Format(PyExc_ValueError,
26130 "Buffer is not indirectly accessible "
26131 "in dimension %d.", dim);
26132 goto fail;
26133 }
26134 }
26135 return 1;
26136fail:
26137 return 0;
26138}
26139static int
26140__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
26141{
26142 int i;
26143 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
26144 Py_ssize_t stride = 1;
26145 for (i = 0; i < ndim; i++) {
26146 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26147 PyErr_SetString(PyExc_ValueError,
26148 "Buffer not fortran contiguous.");
26149 goto fail;
26150 }
26151 stride = stride * buf->shape[i];
26152 }
26153 } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
26154 Py_ssize_t stride = 1;
26155 for (i = ndim - 1; i >- 1; i--) {
26156 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26157 PyErr_SetString(PyExc_ValueError,
26158 "Buffer not C contiguous.");
26159 goto fail;
26160 }
26161 stride = stride * buf->shape[i];
26162 }
26163 }
26164 return 1;
26165fail:
26166 return 0;
26167}
26168static int __Pyx_ValidateAndInit_memviewslice(
26169 int *axes_specs,
26170 int c_or_f_flag,
26171 int buf_flags,
26172 int ndim,
26173 __Pyx_TypeInfo *dtype,
26174 __Pyx_BufFmt_StackElem stack[],
26175 __Pyx_memviewslice *memviewslice,
26176 PyObject *original_obj)
26177{
26178 struct __pyx_memoryview_obj *memview, *new_memview;
26179 __Pyx_RefNannyDeclarations
26180 Py_buffer *buf;
26181 int i, spec = 0, retval = -1;
26182 __Pyx_BufFmt_Context ctx;
26183 int from_memoryview = __pyx_memoryview_check(original_obj);
26184 __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
26185 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
26186 original_obj)->typeinfo)) {
26187 memview = (struct __pyx_memoryview_obj *) original_obj;
26188 new_memview = NULL;
26189 } else {
26190 memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26191 original_obj, buf_flags, 0, dtype);
26192 new_memview = memview;
26193 if (unlikely(!memview))
26194 goto fail;
26195 }
26196 buf = &memview->view;
26197 if (unlikely(buf->ndim != ndim)) {
26198 PyErr_Format(PyExc_ValueError,
26199 "Buffer has wrong number of dimensions (expected %d, got %d)",
26200 ndim, buf->ndim);
26201 goto fail;
26202 }
26203 if (new_memview) {
26204 __Pyx_BufFmt_Init(&ctx, stack, dtype);
26205 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
26206 }
26207 if (unlikely((unsigned) buf->itemsize != dtype->size)) {
26208 PyErr_Format(PyExc_ValueError,
26209 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
26210 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
26211 buf->itemsize,
26212 (buf->itemsize > 1) ? "s" : "",
26213 dtype->name,
26214 dtype->size,
26215 (dtype->size > 1) ? "s" : "");
26216 goto fail;
26217 }
26218 if (buf->len > 0) {
26219 for (i = 0; i < ndim; i++) {
26220 spec = axes_specs[i];
26221 if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
26222 goto fail;
26223 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
26224 goto fail;
26225 }
26226 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
26227 goto fail;
26228 }
26229 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
26230 new_memview != NULL) == -1)) {
26231 goto fail;
26232 }
26233 retval = 0;
26234 goto no_fail;
26235fail:
26236 Py_XDECREF(new_memview);
26237 retval = -1;
26238no_fail:
26239 __Pyx_RefNannyFinishContext();
26240 return retval;
26241}
26242
26243/* ObjectToMemviewSlice */
26244 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj, int writable_flag) {
26245 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26246 __Pyx_BufFmt_StackElem stack[1];
26247 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26248 int retcode;
26249 if (obj == Py_None) {
26250 result.memview = (struct __pyx_memoryview_obj *) Py_None;
26251 return result;
26252 }
26253 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26254 PyBUF_RECORDS_RO | writable_flag, 2,
26255 &__Pyx_TypeInfo_float, stack,
26256 &result, obj);
26257 if (unlikely(retcode == -1))
26258 goto __pyx_fail;
26259 return result;
26260__pyx_fail:
26261 result.memview = NULL;
26262 result.data = NULL;
26263 return result;
26264}
26265
26266/* ObjectToMemviewSlice */
26267 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_long(PyObject *obj, int writable_flag) {
26268 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26269 __Pyx_BufFmt_StackElem stack[1];
26270 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26271 int retcode;
26272 if (obj == Py_None) {
26273 result.memview = (struct __pyx_memoryview_obj *) Py_None;
26274 return result;
26275 }
26276 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26277 PyBUF_RECORDS_RO | writable_flag, 1,
26278 &__Pyx_TypeInfo_long, stack,
26279 &result, obj);
26280 if (unlikely(retcode == -1))
26281 goto __pyx_fail;
26282 return result;
26283__pyx_fail:
26284 result.memview = NULL;
26285 result.data = NULL;
26286 return result;
26287}
26288
26289/* CIntFromPyVerify */
26290 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
26291 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
26292#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
26293 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
26294#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
26295 {\
26296 func_type value = func_value;\
26297 if (sizeof(target_type) < sizeof(func_type)) {\
26298 if (unlikely(value != (func_type) (target_type) value)) {\
26299 func_type zero = 0;\
26300 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
26301 return (target_type) -1;\
26302 if (is_unsigned && unlikely(value < zero))\
26303 goto raise_neg_overflow;\
26304 else\
26305 goto raise_overflow;\
26306 }\
26307 }\
26308 return (target_type) value;\
26309 }
26310
26311/* Declarations */
26312 #if CYTHON_CCOMPLEX
26313 #ifdef __cplusplus
26314 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
26315 return ::std::complex< float >(x, y);
26316 }
26317 #else
26318 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
26319 return x + y*(__pyx_t_float_complex)_Complex_I;
26320 }
26321 #endif
26322#else
26323 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
26324 __pyx_t_float_complex z;
26325 z.real = x;
26326 z.imag = y;
26327 return z;
26328 }
26329#endif
26330
26331/* Arithmetic */
26332 #if CYTHON_CCOMPLEX
26333#else
26334 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26335 return (a.real == b.real) && (a.imag == b.imag);
26336 }
26337 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26338 __pyx_t_float_complex z;
26339 z.real = a.real + b.real;
26340 z.imag = a.imag + b.imag;
26341 return z;
26342 }
26343 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26344 __pyx_t_float_complex z;
26345 z.real = a.real - b.real;
26346 z.imag = a.imag - b.imag;
26347 return z;
26348 }
26349 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26350 __pyx_t_float_complex z;
26351 z.real = a.real * b.real - a.imag * b.imag;
26352 z.imag = a.real * b.imag + a.imag * b.real;
26353 return z;
26354 }
26355 #if 1
26356 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26357 if (b.imag == 0) {
26358 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26359 } else if (fabsf(b.real) >= fabsf(b.imag)) {
26360 if (b.real == 0 && b.imag == 0) {
26361 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
26362 } else {
26363 float r = b.imag / b.real;
26364 float s = (float)(1.0) / (b.real + b.imag * r);
26365 return __pyx_t_float_complex_from_parts(
26366 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26367 }
26368 } else {
26369 float r = b.real / b.imag;
26370 float s = (float)(1.0) / (b.imag + b.real * r);
26371 return __pyx_t_float_complex_from_parts(
26372 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26373 }
26374 }
26375 #else
26376 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26377 if (b.imag == 0) {
26378 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26379 } else {
26380 float denom = b.real * b.real + b.imag * b.imag;
26381 return __pyx_t_float_complex_from_parts(
26382 (a.real * b.real + a.imag * b.imag) / denom,
26383 (a.imag * b.real - a.real * b.imag) / denom);
26384 }
26385 }
26386 #endif
26387 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
26388 __pyx_t_float_complex z;
26389 z.real = -a.real;
26390 z.imag = -a.imag;
26391 return z;
26392 }
26393 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
26394 return (a.real == 0) && (a.imag == 0);
26395 }
26396 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
26397 __pyx_t_float_complex z;
26398 z.real = a.real;
26399 z.imag = -a.imag;
26400 return z;
26401 }
26402 #if 1
26403 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
26404 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26405 return sqrtf(z.real*z.real + z.imag*z.imag);
26406 #else
26407 return hypotf(z.real, z.imag);
26408 #endif
26409 }
26410 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26411 __pyx_t_float_complex z;
26412 float r, lnr, theta, z_r, z_theta;
26413 if (b.imag == 0 && b.real == (int)b.real) {
26414 if (b.real < 0) {
26415 float denom = a.real * a.real + a.imag * a.imag;
26416 a.real = a.real / denom;
26417 a.imag = -a.imag / denom;
26418 b.real = -b.real;
26419 }
26420 switch ((int)b.real) {
26421 case 0:
26422 z.real = 1;
26423 z.imag = 0;
26424 return z;
26425 case 1:
26426 return a;
26427 case 2:
26428 return __Pyx_c_prod_float(a, a);
26429 case 3:
26430 z = __Pyx_c_prod_float(a, a);
26431 return __Pyx_c_prod_float(z, a);
26432 case 4:
26433 z = __Pyx_c_prod_float(a, a);
26434 return __Pyx_c_prod_float(z, z);
26435 }
26436 }
26437 if (a.imag == 0) {
26438 if (a.real == 0) {
26439 return a;
26440 } else if (b.imag == 0) {
26441 z.real = powf(a.real, b.real);
26442 z.imag = 0;
26443 return z;
26444 } else if (a.real > 0) {
26445 r = a.real;
26446 theta = 0;
26447 } else {
26448 r = -a.real;
26449 theta = atan2f(0.0, -1.0);
26450 }
26451 } else {
26452 r = __Pyx_c_abs_float(a);
26453 theta = atan2f(a.imag, a.real);
26454 }
26455 lnr = logf(r);
26456 z_r = expf(lnr * b.real - theta * b.imag);
26457 z_theta = theta * b.real + lnr * b.imag;
26458 z.real = z_r * cosf(z_theta);
26459 z.imag = z_r * sinf(z_theta);
26460 return z;
26461 }
26462 #endif
26463#endif
26464
26465/* Declarations */
26466 #if CYTHON_CCOMPLEX
26467 #ifdef __cplusplus
26468 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
26469 return ::std::complex< double >(x, y);
26470 }
26471 #else
26472 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
26473 return x + y*(__pyx_t_double_complex)_Complex_I;
26474 }
26475 #endif
26476#else
26477 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
26478 __pyx_t_double_complex z;
26479 z.real = x;
26480 z.imag = y;
26481 return z;
26482 }
26483#endif
26484
26485/* Arithmetic */
26486 #if CYTHON_CCOMPLEX
26487#else
26488 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26489 return (a.real == b.real) && (a.imag == b.imag);
26490 }
26491 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26492 __pyx_t_double_complex z;
26493 z.real = a.real + b.real;
26494 z.imag = a.imag + b.imag;
26495 return z;
26496 }
26497 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26498 __pyx_t_double_complex z;
26499 z.real = a.real - b.real;
26500 z.imag = a.imag - b.imag;
26501 return z;
26502 }
26503 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26504 __pyx_t_double_complex z;
26505 z.real = a.real * b.real - a.imag * b.imag;
26506 z.imag = a.real * b.imag + a.imag * b.real;
26507 return z;
26508 }
26509 #if 1
26510 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26511 if (b.imag == 0) {
26512 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26513 } else if (fabs(b.real) >= fabs(b.imag)) {
26514 if (b.real == 0 && b.imag == 0) {
26515 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
26516 } else {
26517 double r = b.imag / b.real;
26518 double s = (double)(1.0) / (b.real + b.imag * r);
26519 return __pyx_t_double_complex_from_parts(
26520 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26521 }
26522 } else {
26523 double r = b.real / b.imag;
26524 double s = (double)(1.0) / (b.imag + b.real * r);
26525 return __pyx_t_double_complex_from_parts(
26526 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26527 }
26528 }
26529 #else
26530 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26531 if (b.imag == 0) {
26532 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26533 } else {
26534 double denom = b.real * b.real + b.imag * b.imag;
26535 return __pyx_t_double_complex_from_parts(
26536 (a.real * b.real + a.imag * b.imag) / denom,
26537 (a.imag * b.real - a.real * b.imag) / denom);
26538 }
26539 }
26540 #endif
26541 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
26542 __pyx_t_double_complex z;
26543 z.real = -a.real;
26544 z.imag = -a.imag;
26545 return z;
26546 }
26547 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
26548 return (a.real == 0) && (a.imag == 0);
26549 }
26550 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
26551 __pyx_t_double_complex z;
26552 z.real = a.real;
26553 z.imag = -a.imag;
26554 return z;
26555 }
26556 #if 1
26557 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
26558 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26559 return sqrt(z.real*z.real + z.imag*z.imag);
26560 #else
26561 return hypot(z.real, z.imag);
26562 #endif
26563 }
26564 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26565 __pyx_t_double_complex z;
26566 double r, lnr, theta, z_r, z_theta;
26567 if (b.imag == 0 && b.real == (int)b.real) {
26568 if (b.real < 0) {
26569 double denom = a.real * a.real + a.imag * a.imag;
26570 a.real = a.real / denom;
26571 a.imag = -a.imag / denom;
26572 b.real = -b.real;
26573 }
26574 switch ((int)b.real) {
26575 case 0:
26576 z.real = 1;
26577 z.imag = 0;
26578 return z;
26579 case 1:
26580 return a;
26581 case 2:
26582 return __Pyx_c_prod_double(a, a);
26583 case 3:
26584 z = __Pyx_c_prod_double(a, a);
26585 return __Pyx_c_prod_double(z, a);
26586 case 4:
26587 z = __Pyx_c_prod_double(a, a);
26588 return __Pyx_c_prod_double(z, z);
26589 }
26590 }
26591 if (a.imag == 0) {
26592 if (a.real == 0) {
26593 return a;
26594 } else if (b.imag == 0) {
26595 z.real = pow(a.real, b.real);
26596 z.imag = 0;
26597 return z;
26598 } else if (a.real > 0) {
26599 r = a.real;
26600 theta = 0;
26601 } else {
26602 r = -a.real;
26603 theta = atan2(0.0, -1.0);
26604 }
26605 } else {
26606 r = __Pyx_c_abs_double(a);
26607 theta = atan2(a.imag, a.real);
26608 }
26609 lnr = log(r);
26610 z_r = exp(lnr * b.real - theta * b.imag);
26611 z_theta = theta * b.real + lnr * b.imag;
26612 z.real = z_r * cos(z_theta);
26613 z.imag = z_r * sin(z_theta);
26614 return z;
26615 }
26616 #endif
26617#endif
26618
26619/* MemviewDtypeToObject */
26620 static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp) {
26621 return (PyObject *) PyFloat_FromDouble(*(float *) itemp);
26622}
26623static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *obj) {
26624 float value = __pyx_PyFloat_AsFloat(obj);
26625 if ((value == (float)-1) && PyErr_Occurred())
26626 return 0;
26627 *(float *) itemp = value;
26628 return 1;
26629}
26630
26631/* ObjectToMemviewSlice */
26632 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_long(PyObject *obj, int writable_flag) {
26633 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26634 __Pyx_BufFmt_StackElem stack[1];
26635 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26636 int retcode;
26637 if (obj == Py_None) {
26638 result.memview = (struct __pyx_memoryview_obj *) Py_None;
26639 return result;
26640 }
26641 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26642 PyBUF_RECORDS_RO | writable_flag, 2,
26643 &__Pyx_TypeInfo_long, stack,
26644 &result, obj);
26645 if (unlikely(retcode == -1))
26646 goto __pyx_fail;
26647 return result;
26648__pyx_fail:
26649 result.memview = NULL;
26650 result.data = NULL;
26651 return result;
26652}
26653
26654/* Print */
26655 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
26656static PyObject *__Pyx_GetStdout(void) {
26657 PyObject *f = PySys_GetObject((char *)"stdout");
26658 if (!f) {
26659 PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
26660 }
26661 return f;
26662}
26663static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
26664 int i;
26665 if (!f) {
26666 if (!(f = __Pyx_GetStdout()))
26667 return -1;
26668 }
26669 Py_INCREF(f);
26670 for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
26671 PyObject* v;
26672 if (PyFile_SoftSpace(f, 1)) {
26673 if (PyFile_WriteString(" ", f) < 0)
26674 goto error;
26675 }
26676 v = PyTuple_GET_ITEM(arg_tuple, i);
26677 if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
26678 goto error;
26679 if (PyString_Check(v)) {
26680 char *s = PyString_AsString(v);
26681 Py_ssize_t len = PyString_Size(v);
26682 if (len > 0) {
26683 switch (s[len-1]) {
26684 case ' ': break;
26685 case '\f': case '\r': case '\n': case '\t': case '\v':
26686 PyFile_SoftSpace(f, 0);
26687 break;
26688 default: break;
26689 }
26690 }
26691 }
26692 }
26693 if (newline) {
26694 if (PyFile_WriteString("\n", f) < 0)
26695 goto error;
26696 PyFile_SoftSpace(f, 0);
26697 }
26698 Py_DECREF(f);
26699 return 0;
26700error:
26701 Py_DECREF(f);
26702 return -1;
26703}
26704#else
26705static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
26706 PyObject* kwargs = 0;
26707 PyObject* result = 0;
26708 PyObject* end_string;
26709 if (unlikely(!__pyx_print)) {
26710 __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
26711 if (!__pyx_print)
26712 return -1;
26713 }
26714 if (stream) {
26715 kwargs = PyDict_New();
26716 if (unlikely(!kwargs))
26717 return -1;
26718 if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
26719 goto bad;
26720 if (!newline) {
26721 end_string = PyUnicode_FromStringAndSize(" ", 1);
26722 if (unlikely(!end_string))
26723 goto bad;
26724 if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
26725 Py_DECREF(end_string);
26726 goto bad;
26727 }
26728 Py_DECREF(end_string);
26729 }
26730 } else if (!newline) {
26731 if (unlikely(!__pyx_print_kwargs)) {
26732 __pyx_print_kwargs = PyDict_New();
26733 if (unlikely(!__pyx_print_kwargs))
26734 return -1;
26735 end_string = PyUnicode_FromStringAndSize(" ", 1);
26736 if (unlikely(!end_string))
26737 return -1;
26738 if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
26739 Py_DECREF(end_string);
26740 return -1;
26741 }
26742 Py_DECREF(end_string);
26743 }
26744 kwargs = __pyx_print_kwargs;
26745 }
26746 result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
26747 if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
26748 Py_DECREF(kwargs);
26749 if (!result)
26750 return -1;
26751 Py_DECREF(result);
26752 return 0;
26753bad:
26754 if (kwargs != __pyx_print_kwargs)
26755 Py_XDECREF(kwargs);
26756 return -1;
26757}
26758#endif
26759
26760/* MemviewDtypeToObject */
26761 static CYTHON_INLINE PyObject *__pyx_memview_get_long(const char *itemp) {
26762 return (PyObject *) __Pyx_PyInt_From_long(*(long *) itemp);
26763}
26764static CYTHON_INLINE int __pyx_memview_set_long(const char *itemp, PyObject *obj) {
26765 long value = __Pyx_PyInt_As_long(obj);
26766 if ((value == (long)-1) && PyErr_Occurred())
26767 return 0;
26768 *(long *) itemp = value;
26769 return 1;
26770}
26771
26772/* ObjectToMemviewSlice */
26773 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj, int writable_flag) {
26774 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26775 __Pyx_BufFmt_StackElem stack[1];
26776 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26777 int retcode;
26778 if (obj == Py_None) {
26779 result.memview = (struct __pyx_memoryview_obj *) Py_None;
26780 return result;
26781 }
26782 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26783 PyBUF_RECORDS_RO | writable_flag, 1,
26784 &__Pyx_TypeInfo_float, stack,
26785 &result, obj);
26786 if (unlikely(retcode == -1))
26787 goto __pyx_fail;
26788 return result;
26789__pyx_fail:
26790 result.memview = NULL;
26791 result.data = NULL;
26792 return result;
26793}
26794
26795/* MemviewSliceCopyTemplate */
26796 static __Pyx_memviewslice
26797__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
26798 const char *mode, int ndim,
26799 size_t sizeof_dtype, int contig_flag,
26800 int dtype_is_object)
26801{
26802 __Pyx_RefNannyDeclarations
26803 int i;
26804 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
26805 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
26806 Py_buffer *buf = &from_memview->view;
26807 PyObject *shape_tuple = NULL;
26808 PyObject *temp_int = NULL;
26809 struct __pyx_array_obj *array_obj = NULL;
26810 struct __pyx_memoryview_obj *memview_obj = NULL;
26811 __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
26812 for (i = 0; i < ndim; i++) {
26813 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
26814 PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
26815 "indirect dimensions (axis %d)", i);
26816 goto fail;
26817 }
26818 }
26819 shape_tuple = PyTuple_New(ndim);
26820 if (unlikely(!shape_tuple)) {
26821 goto fail;
26822 }
26823 __Pyx_GOTREF(shape_tuple);
26824 for(i = 0; i < ndim; i++) {
26825 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
26826 if(unlikely(!temp_int)) {
26827 goto fail;
26828 } else {
26829 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
26830 temp_int = NULL;
26831 }
26832 }
26833 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
26834 if (unlikely(!array_obj)) {
26835 goto fail;
26836 }
26837 __Pyx_GOTREF(array_obj);
26838 memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26839 (PyObject *) array_obj, contig_flag,
26840 dtype_is_object,
26841 from_mvs->memview->typeinfo);
26842 if (unlikely(!memview_obj))
26843 goto fail;
26844 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
26845 goto fail;
26846 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
26847 dtype_is_object) < 0))
26848 goto fail;
26849 goto no_fail;
26850fail:
26851 __Pyx_XDECREF(new_mvs.memview);
26852 new_mvs.memview = NULL;
26853 new_mvs.data = NULL;
26854no_fail:
26855 __Pyx_XDECREF(shape_tuple);
26856 __Pyx_XDECREF(temp_int);
26857 __Pyx_XDECREF(array_obj);
26858 __Pyx_RefNannyFinishContext();
26859 return new_mvs;
26860}
26861
26862/* CIntFromPy */
26863 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
26864#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26865#pragma GCC diagnostic push
26866#pragma GCC diagnostic ignored "-Wconversion"
26867#endif
26868 const long neg_one = (long) -1, const_zero = (long) 0;
26869#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26870#pragma GCC diagnostic pop
26871#endif
26872 const int is_unsigned = neg_one > const_zero;
26873#if PY_MAJOR_VERSION < 3
26874 if (likely(PyInt_Check(x))) {
26875 if (sizeof(long) < sizeof(long)) {
26876 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
26877 } else {
26878 long val = PyInt_AS_LONG(x);
26879 if (is_unsigned && unlikely(val < 0)) {
26880 goto raise_neg_overflow;
26881 }
26882 return (long) val;
26883 }
26884 } else
26885#endif
26886 if (likely(PyLong_Check(x))) {
26887 if (is_unsigned) {
26888#if CYTHON_USE_PYLONG_INTERNALS
26889 const digit* digits = ((PyLongObject*)x)->ob_digit;
26890 switch (Py_SIZE(x)) {
26891 case 0: return (long) 0;
26892 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
26893 case 2:
26894 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26895 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26896 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26897 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
26898 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26899 }
26900 }
26901 break;
26902 case 3:
26903 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26904 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26905 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26906 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
26907 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26908 }
26909 }
26910 break;
26911 case 4:
26912 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26913 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26914 __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])))
26915 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
26916 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26917 }
26918 }
26919 break;
26920 }
26921#endif
26922#if CYTHON_COMPILING_IN_CPYTHON
26923 if (unlikely(Py_SIZE(x) < 0)) {
26924 goto raise_neg_overflow;
26925 }
26926#else
26927 {
26928 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26929 if (unlikely(result < 0))
26930 return (long) -1;
26931 if (unlikely(result == 1))
26932 goto raise_neg_overflow;
26933 }
26934#endif
26935 if (sizeof(long) <= sizeof(unsigned long)) {
26936 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
26937#ifdef HAVE_LONG_LONG
26938 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26939 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26940#endif
26941 }
26942 } else {
26943#if CYTHON_USE_PYLONG_INTERNALS
26944 const digit* digits = ((PyLongObject*)x)->ob_digit;
26945 switch (Py_SIZE(x)) {
26946 case 0: return (long) 0;
26947 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
26948 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
26949 case -2:
26950 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
26951 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26952 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26953 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26954 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26955 }
26956 }
26957 break;
26958 case 2:
26959 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26960 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26961 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26962 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26963 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26964 }
26965 }
26966 break;
26967 case -3:
26968 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26969 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26970 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26971 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26972 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26973 }
26974 }
26975 break;
26976 case 3:
26977 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26978 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26979 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26980 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26981 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26982 }
26983 }
26984 break;
26985 case -4:
26986 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26987 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26988 __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])))
26989 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26990 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26991 }
26992 }
26993 break;
26994 case 4:
26995 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26996 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26997 __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])))
26998 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26999 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27000 }
27001 }
27002 break;
27003 }
27004#endif
27005 if (sizeof(long) <= sizeof(long)) {
27006 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
27007#ifdef HAVE_LONG_LONG
27008 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
27009 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
27010#endif
27011 }
27012 }
27013 {
27014#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27015 PyErr_SetString(PyExc_RuntimeError,
27016 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27017#else
27018 long val;
27019 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27020 #if PY_MAJOR_VERSION < 3
27021 if (likely(v) && !PyLong_Check(v)) {
27022 PyObject *tmp = v;
27023 v = PyNumber_Long(tmp);
27024 Py_DECREF(tmp);
27025 }
27026 #endif
27027 if (likely(v)) {
27028 int one = 1; int is_little = (int)*(unsigned char *)&one;
27029 unsigned char *bytes = (unsigned char *)&val;
27030 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27031 bytes, sizeof(val),
27032 is_little, !is_unsigned);
27033 Py_DECREF(v);
27034 if (likely(!ret))
27035 return val;
27036 }
27037#endif
27038 return (long) -1;
27039 }
27040 } else {
27041 long val;
27042 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27043 if (!tmp) return (long) -1;
27044 val = __Pyx_PyInt_As_long(tmp);
27045 Py_DECREF(tmp);
27046 return val;
27047 }
27048raise_overflow:
27049 PyErr_SetString(PyExc_OverflowError,
27050 "value too large to convert to long");
27051 return (long) -1;
27052raise_neg_overflow:
27053 PyErr_SetString(PyExc_OverflowError,
27054 "can't convert negative value to long");
27055 return (long) -1;
27056}
27057
27058/* CIntToPy */
27059 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
27060#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27061#pragma GCC diagnostic push
27062#pragma GCC diagnostic ignored "-Wconversion"
27063#endif
27064 const long neg_one = (long) -1, const_zero = (long) 0;
27065#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27066#pragma GCC diagnostic pop
27067#endif
27068 const int is_unsigned = neg_one > const_zero;
27069 if (is_unsigned) {
27070 if (sizeof(long) < sizeof(long)) {
27071 return PyInt_FromLong((long) value);
27072 } else if (sizeof(long) <= sizeof(unsigned long)) {
27073 return PyLong_FromUnsignedLong((unsigned long) value);
27074#ifdef HAVE_LONG_LONG
27075 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
27076 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27077#endif
27078 }
27079 } else {
27080 if (sizeof(long) <= sizeof(long)) {
27081 return PyInt_FromLong((long) value);
27082#ifdef HAVE_LONG_LONG
27083 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
27084 return PyLong_FromLongLong((PY_LONG_LONG) value);
27085#endif
27086 }
27087 }
27088 {
27089 int one = 1; int little = (int)*(unsigned char *)&one;
27090 unsigned char *bytes = (unsigned char *)&value;
27091 return _PyLong_FromByteArray(bytes, sizeof(long),
27092 little, !is_unsigned);
27093 }
27094}
27095
27096/* PrintOne */
27097 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
27098static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
27099 if (!f) {
27100 if (!(f = __Pyx_GetStdout()))
27101 return -1;
27102 }
27103 Py_INCREF(f);
27104 if (PyFile_SoftSpace(f, 0)) {
27105 if (PyFile_WriteString(" ", f) < 0)
27106 goto error;
27107 }
27108 if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
27109 goto error;
27110 if (PyFile_WriteString("\n", f) < 0)
27111 goto error;
27112 Py_DECREF(f);
27113 return 0;
27114error:
27115 Py_DECREF(f);
27116 return -1;
27117 /* the line below is just to avoid C compiler
27118 * warnings about unused functions */
27119 return __Pyx_Print(f, NULL, 0);
27120}
27121#else
27122static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
27123 int res;
27124 PyObject* arg_tuple = PyTuple_Pack(1, o);
27125 if (unlikely(!arg_tuple))
27126 return -1;
27127 res = __Pyx_Print(stream, arg_tuple, 1);
27128 Py_DECREF(arg_tuple);
27129 return res;
27130}
27131#endif
27132
27133/* CIntFromPy */
27134 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
27135#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27136#pragma GCC diagnostic push
27137#pragma GCC diagnostic ignored "-Wconversion"
27138#endif
27139 const int neg_one = (int) -1, const_zero = (int) 0;
27140#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27141#pragma GCC diagnostic pop
27142#endif
27143 const int is_unsigned = neg_one > const_zero;
27144#if PY_MAJOR_VERSION < 3
27145 if (likely(PyInt_Check(x))) {
27146 if (sizeof(int) < sizeof(long)) {
27147 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
27148 } else {
27149 long val = PyInt_AS_LONG(x);
27150 if (is_unsigned && unlikely(val < 0)) {
27151 goto raise_neg_overflow;
27152 }
27153 return (int) val;
27154 }
27155 } else
27156#endif
27157 if (likely(PyLong_Check(x))) {
27158 if (is_unsigned) {
27159#if CYTHON_USE_PYLONG_INTERNALS
27160 const digit* digits = ((PyLongObject*)x)->ob_digit;
27161 switch (Py_SIZE(x)) {
27162 case 0: return (int) 0;
27163 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
27164 case 2:
27165 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
27166 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27167 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27168 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
27169 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27170 }
27171 }
27172 break;
27173 case 3:
27174 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
27175 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27176 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27177 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
27178 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27179 }
27180 }
27181 break;
27182 case 4:
27183 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
27184 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27185 __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])))
27186 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
27187 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27188 }
27189 }
27190 break;
27191 }
27192#endif
27193#if CYTHON_COMPILING_IN_CPYTHON
27194 if (unlikely(Py_SIZE(x) < 0)) {
27195 goto raise_neg_overflow;
27196 }
27197#else
27198 {
27199 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27200 if (unlikely(result < 0))
27201 return (int) -1;
27202 if (unlikely(result == 1))
27203 goto raise_neg_overflow;
27204 }
27205#endif
27206 if (sizeof(int) <= sizeof(unsigned long)) {
27207 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
27208#ifdef HAVE_LONG_LONG
27209 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
27210 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27211#endif
27212 }
27213 } else {
27214#if CYTHON_USE_PYLONG_INTERNALS
27215 const digit* digits = ((PyLongObject*)x)->ob_digit;
27216 switch (Py_SIZE(x)) {
27217 case 0: return (int) 0;
27218 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
27219 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
27220 case -2:
27221 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
27222 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27223 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27224 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
27225 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27226 }
27227 }
27228 break;
27229 case 2:
27230 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
27231 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27232 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27233 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
27234 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27235 }
27236 }
27237 break;
27238 case -3:
27239 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
27240 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27241 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27242 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
27243 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27244 }
27245 }
27246 break;
27247 case 3:
27248 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
27249 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27250 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27251 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
27252 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27253 }
27254 }
27255 break;
27256 case -4:
27257 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
27258 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27259 __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])))
27260 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
27261 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27262 }
27263 }
27264 break;
27265 case 4:
27266 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
27267 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27268 __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])))
27269 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
27270 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27271 }
27272 }
27273 break;
27274 }
27275#endif
27276 if (sizeof(int) <= sizeof(long)) {
27277 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
27278#ifdef HAVE_LONG_LONG
27279 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
27280 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
27281#endif
27282 }
27283 }
27284 {
27285#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27286 PyErr_SetString(PyExc_RuntimeError,
27287 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27288#else
27289 int val;
27290 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27291 #if PY_MAJOR_VERSION < 3
27292 if (likely(v) && !PyLong_Check(v)) {
27293 PyObject *tmp = v;
27294 v = PyNumber_Long(tmp);
27295 Py_DECREF(tmp);
27296 }
27297 #endif
27298 if (likely(v)) {
27299 int one = 1; int is_little = (int)*(unsigned char *)&one;
27300 unsigned char *bytes = (unsigned char *)&val;
27301 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27302 bytes, sizeof(val),
27303 is_little, !is_unsigned);
27304 Py_DECREF(v);
27305 if (likely(!ret))
27306 return val;
27307 }
27308#endif
27309 return (int) -1;
27310 }
27311 } else {
27312 int val;
27313 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27314 if (!tmp) return (int) -1;
27315 val = __Pyx_PyInt_As_int(tmp);
27316 Py_DECREF(tmp);
27317 return val;
27318 }
27319raise_overflow:
27320 PyErr_SetString(PyExc_OverflowError,
27321 "value too large to convert to int");
27322 return (int) -1;
27323raise_neg_overflow:
27324 PyErr_SetString(PyExc_OverflowError,
27325 "can't convert negative value to int");
27326 return (int) -1;
27327}
27328
27329/* CIntToPy */
27330 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
27331#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27332#pragma GCC diagnostic push
27333#pragma GCC diagnostic ignored "-Wconversion"
27334#endif
27335 const int neg_one = (int) -1, const_zero = (int) 0;
27336#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27337#pragma GCC diagnostic pop
27338#endif
27339 const int is_unsigned = neg_one > const_zero;
27340 if (is_unsigned) {
27341 if (sizeof(int) < sizeof(long)) {
27342 return PyInt_FromLong((long) value);
27343 } else if (sizeof(int) <= sizeof(unsigned long)) {
27344 return PyLong_FromUnsignedLong((unsigned long) value);
27345#ifdef HAVE_LONG_LONG
27346 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
27347 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27348#endif
27349 }
27350 } else {
27351 if (sizeof(int) <= sizeof(long)) {
27352 return PyInt_FromLong((long) value);
27353#ifdef HAVE_LONG_LONG
27354 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
27355 return PyLong_FromLongLong((PY_LONG_LONG) value);
27356#endif
27357 }
27358 }
27359 {
27360 int one = 1; int little = (int)*(unsigned char *)&one;
27361 unsigned char *bytes = (unsigned char *)&value;
27362 return _PyLong_FromByteArray(bytes, sizeof(int),
27363 little, !is_unsigned);
27364 }
27365}
27366
27367/* CIntFromPy */
27368 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
27369#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27370#pragma GCC diagnostic push
27371#pragma GCC diagnostic ignored "-Wconversion"
27372#endif
27373 const char neg_one = (char) -1, const_zero = (char) 0;
27374#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27375#pragma GCC diagnostic pop
27376#endif
27377 const int is_unsigned = neg_one > const_zero;
27378#if PY_MAJOR_VERSION < 3
27379 if (likely(PyInt_Check(x))) {
27380 if (sizeof(char) < sizeof(long)) {
27381 __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
27382 } else {
27383 long val = PyInt_AS_LONG(x);
27384 if (is_unsigned && unlikely(val < 0)) {
27385 goto raise_neg_overflow;
27386 }
27387 return (char) val;
27388 }
27389 } else
27390#endif
27391 if (likely(PyLong_Check(x))) {
27392 if (is_unsigned) {
27393#if CYTHON_USE_PYLONG_INTERNALS
27394 const digit* digits = ((PyLongObject*)x)->ob_digit;
27395 switch (Py_SIZE(x)) {
27396 case 0: return (char) 0;
27397 case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
27398 case 2:
27399 if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
27400 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27401 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27402 } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
27403 return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
27404 }
27405 }
27406 break;
27407 case 3:
27408 if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
27409 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27410 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27411 } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
27412 return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
27413 }
27414 }
27415 break;
27416 case 4:
27417 if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
27418 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27419 __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])))
27420 } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
27421 return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
27422 }
27423 }
27424 break;
27425 }
27426#endif
27427#if CYTHON_COMPILING_IN_CPYTHON
27428 if (unlikely(Py_SIZE(x) < 0)) {
27429 goto raise_neg_overflow;
27430 }
27431#else
27432 {
27433 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27434 if (unlikely(result < 0))
27435 return (char) -1;
27436 if (unlikely(result == 1))
27437 goto raise_neg_overflow;
27438 }
27439#endif
27440 if (sizeof(char) <= sizeof(unsigned long)) {
27441 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
27442#ifdef HAVE_LONG_LONG
27443 } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
27444 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27445#endif
27446 }
27447 } else {
27448#if CYTHON_USE_PYLONG_INTERNALS
27449 const digit* digits = ((PyLongObject*)x)->ob_digit;
27450 switch (Py_SIZE(x)) {
27451 case 0: return (char) 0;
27452 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
27453 case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
27454 case -2:
27455 if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
27456 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27457 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27458 } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
27459 return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27460 }
27461 }
27462 break;
27463 case 2:
27464 if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
27465 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27466 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27467 } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
27468 return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27469 }
27470 }
27471 break;
27472 case -3:
27473 if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
27474 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27475 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27476 } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
27477 return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27478 }
27479 }
27480 break;
27481 case 3:
27482 if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
27483 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27484 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27485 } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
27486 return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27487 }
27488 }
27489 break;
27490 case -4:
27491 if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
27492 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27493 __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])))
27494 } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
27495 return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27496 }
27497 }
27498 break;
27499 case 4:
27500 if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
27501 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27502 __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])))
27503 } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
27504 return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27505 }
27506 }
27507 break;
27508 }
27509#endif
27510 if (sizeof(char) <= sizeof(long)) {
27511 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
27512#ifdef HAVE_LONG_LONG
27513 } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
27514 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
27515#endif
27516 }
27517 }
27518 {
27519#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27520 PyErr_SetString(PyExc_RuntimeError,
27521 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27522#else
27523 char val;
27524 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27525 #if PY_MAJOR_VERSION < 3
27526 if (likely(v) && !PyLong_Check(v)) {
27527 PyObject *tmp = v;
27528 v = PyNumber_Long(tmp);
27529 Py_DECREF(tmp);
27530 }
27531 #endif
27532 if (likely(v)) {
27533 int one = 1; int is_little = (int)*(unsigned char *)&one;
27534 unsigned char *bytes = (unsigned char *)&val;
27535 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27536 bytes, sizeof(val),
27537 is_little, !is_unsigned);
27538 Py_DECREF(v);
27539 if (likely(!ret))
27540 return val;
27541 }
27542#endif
27543 return (char) -1;
27544 }
27545 } else {
27546 char val;
27547 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27548 if (!tmp) return (char) -1;
27549 val = __Pyx_PyInt_As_char(tmp);
27550 Py_DECREF(tmp);
27551 return val;
27552 }
27553raise_overflow:
27554 PyErr_SetString(PyExc_OverflowError,
27555 "value too large to convert to char");
27556 return (char) -1;
27557raise_neg_overflow:
27558 PyErr_SetString(PyExc_OverflowError,
27559 "can't convert negative value to char");
27560 return (char) -1;
27561}
27562
27563/* CheckBinaryVersion */
27564 static int __Pyx_check_binary_version(void) {
27565 char ctversion[4], rtversion[4];
27566 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
27567 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
27568 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
27569 char message[200];
27570 PyOS_snprintf(message, sizeof(message),
27571 "compiletime version %s of module '%.100s' "
27572 "does not match runtime version %s",
27573 ctversion, __Pyx_MODULE_NAME, rtversion);
27574 return PyErr_WarnEx(NULL, message, 1);
27575 }
27576 return 0;
27577}
27578
27579/* InitStrings */
27580 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
27581 while (t->p) {
27582 #if PY_MAJOR_VERSION < 3
27583 if (t->is_unicode) {
27584 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
27585 } else if (t->intern) {
27586 *t->p = PyString_InternFromString(t->s);
27587 } else {
27588 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
27589 }
27590 #else
27591 if (t->is_unicode | t->is_str) {
27592 if (t->intern) {
27593 *t->p = PyUnicode_InternFromString(t->s);
27594 } else if (t->encoding) {
27595 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
27596 } else {
27597 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
27598 }
27599 } else {
27600 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
27601 }
27602 #endif
27603 if (!*t->p)
27604 return -1;
27605 if (PyObject_Hash(*t->p) == -1)
27606 return -1;
27607 ++t;
27608 }
27609 return 0;
27610}
27611
27612static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
27613 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
27614}
27615static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
27616 Py_ssize_t ignore;
27617 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
27618}
27619#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27620#if !CYTHON_PEP393_ENABLED
27621static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27622 char* defenc_c;
27623 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
27624 if (!defenc) return NULL;
27625 defenc_c = PyBytes_AS_STRING(defenc);
27626#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27627 {
27628 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
27629 char* c;
27630 for (c = defenc_c; c < end; c++) {
27631 if ((unsigned char) (*c) >= 128) {
27632 PyUnicode_AsASCIIString(o);
27633 return NULL;
27634 }
27635 }
27636 }
27637#endif
27638 *length = PyBytes_GET_SIZE(defenc);
27639 return defenc_c;
27640}
27641#else
27642static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27643 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
27644#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27645 if (likely(PyUnicode_IS_ASCII(o))) {
27646 *length = PyUnicode_GET_LENGTH(o);
27647 return PyUnicode_AsUTF8(o);
27648 } else {
27649 PyUnicode_AsASCIIString(o);
27650 return NULL;
27651 }
27652#else
27653 return PyUnicode_AsUTF8AndSize(o, length);
27654#endif
27655}
27656#endif
27657#endif
27658static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27659#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27660 if (
27661#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27662 __Pyx_sys_getdefaultencoding_not_ascii &&
27663#endif
27664 PyUnicode_Check(o)) {
27665 return __Pyx_PyUnicode_AsStringAndSize(o, length);
27666 } else
27667#endif
27668#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
27669 if (PyByteArray_Check(o)) {
27670 *length = PyByteArray_GET_SIZE(o);
27671 return PyByteArray_AS_STRING(o);
27672 } else
27673#endif
27674 {
27675 char* result;
27676 int r = PyBytes_AsStringAndSize(o, &result, length);
27677 if (unlikely(r < 0)) {
27678 return NULL;
27679 } else {
27680 return result;
27681 }
27682 }
27683}
27684static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
27685 int is_true = x == Py_True;
27686 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
27687 else return PyObject_IsTrue(x);
27688}
27689static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
27690 int retval;
27691 if (unlikely(!x)) return -1;
27692 retval = __Pyx_PyObject_IsTrue(x);
27693 Py_DECREF(x);
27694 return retval;
27695}
27696static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
27697#if PY_MAJOR_VERSION >= 3
27698 if (PyLong_Check(result)) {
27699 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
27700 "__int__ returned non-int (type %.200s). "
27701 "The ability to return an instance of a strict subclass of int "
27702 "is deprecated, and may be removed in a future version of Python.",
27703 Py_TYPE(result)->tp_name)) {
27704 Py_DECREF(result);
27705 return NULL;
27706 }
27707 return result;
27708 }
27709#endif
27710 PyErr_Format(PyExc_TypeError,
27711 "__%.4s__ returned non-%.4s (type %.200s)",
27712 type_name, type_name, Py_TYPE(result)->tp_name);
27713 Py_DECREF(result);
27714 return NULL;
27715}
27716static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
27717#if CYTHON_USE_TYPE_SLOTS
27718 PyNumberMethods *m;
27719#endif
27720 const char *name = NULL;
27721 PyObject *res = NULL;
27722#if PY_MAJOR_VERSION < 3
27723 if (likely(PyInt_Check(x) || PyLong_Check(x)))
27724#else
27725 if (likely(PyLong_Check(x)))
27726#endif
27727 return __Pyx_NewRef(x);
27728#if CYTHON_USE_TYPE_SLOTS
27729 m = Py_TYPE(x)->tp_as_number;
27730 #if PY_MAJOR_VERSION < 3
27731 if (m && m->nb_int) {
27732 name = "int";
27733 res = m->nb_int(x);
27734 }
27735 else if (m && m->nb_long) {
27736 name = "long";
27737 res = m->nb_long(x);
27738 }
27739 #else
27740 if (likely(m && m->nb_int)) {
27741 name = "int";
27742 res = m->nb_int(x);
27743 }
27744 #endif
27745#else
27746 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
27747 res = PyNumber_Int(x);
27748 }
27749#endif
27750 if (likely(res)) {
27751#if PY_MAJOR_VERSION < 3
27752 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
27753#else
27754 if (unlikely(!PyLong_CheckExact(res))) {
27755#endif
27756 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
27757 }
27758 }
27759 else if (!PyErr_Occurred()) {
27760 PyErr_SetString(PyExc_TypeError,
27761 "an integer is required");
27762 }
27763 return res;
27764}
27765static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
27766 Py_ssize_t ival;
27767 PyObject *x;
27768#if PY_MAJOR_VERSION < 3
27769 if (likely(PyInt_CheckExact(b))) {
27770 if (sizeof(Py_ssize_t) >= sizeof(long))
27771 return PyInt_AS_LONG(b);
27772 else
27773 return PyInt_AsSsize_t(b);
27774 }
27775#endif
27776 if (likely(PyLong_CheckExact(b))) {
27777 #if CYTHON_USE_PYLONG_INTERNALS
27778 const digit* digits = ((PyLongObject*)b)->ob_digit;
27779 const Py_ssize_t size = Py_SIZE(b);
27780 if (likely(__Pyx_sst_abs(size) <= 1)) {
27781 ival = likely(size) ? digits[0] : 0;
27782 if (size == -1) ival = -ival;
27783 return ival;
27784 } else {
27785 switch (size) {
27786 case 2:
27787 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27788 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27789 }
27790 break;
27791 case -2:
27792 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27793 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27794 }
27795 break;
27796 case 3:
27797 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27798 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27799 }
27800 break;
27801 case -3:
27802 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27803 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27804 }
27805 break;
27806 case 4:
27807 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27808 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]));
27809 }
27810 break;
27811 case -4:
27812 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27813 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]));
27814 }
27815 break;
27816 }
27817 }
27818 #endif
27819 return PyLong_AsSsize_t(b);
27820 }
27821 x = PyNumber_Index(b);
27822 if (!x) return -1;
27823 ival = PyInt_AsSsize_t(x);
27824 Py_DECREF(x);
27825 return ival;
27826}
27827static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
27828 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
27829 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
27830#if PY_MAJOR_VERSION < 3
27831 } else if (likely(PyInt_CheckExact(o))) {
27832 return PyInt_AS_LONG(o);
27833#endif
27834 } else {
27835 Py_ssize_t ival;
27836 PyObject *x;
27837 x = PyNumber_Index(o);
27838 if (!x) return -1;
27839 ival = PyInt_AsLong(x);
27840 Py_DECREF(x);
27841 return ival;
27842 }
27843}
27844static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
27845 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
27846}
27847static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
27848 return PyInt_FromSize_t(ival);
27849}
27850
27851
27852#endif /* Py_PYTHON_H */