1 /* Generated by Cython 0.29.12 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "depends": [],
7         "libraries": [
8             "m"
9         ],
10         "name": "yt.utilities.lib.distance_queue",
11         "sources": [
12             "yt/utilities/lib/distance_queue.pyx"
13         ]
14     },
15     "module_name": "yt.utilities.lib.distance_queue"
16 }
17 END: Cython Metadata */
18 
19 #define PY_SSIZE_T_CLEAN
20 #include "Python.h"
21 #ifndef Py_PYTHON_H
22     #error Python headers needed to compile C extensions, please install development version of Python.
23 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
24     #error Cython requires Python 2.6+ or Python 3.3+.
25 #else
26 #define CYTHON_ABI "0_29_12"
27 #define CYTHON_HEX_VERSION 0x001D0CF0
28 #define CYTHON_FUTURE_DIVISION 0
29 #include <stddef.h>
30 #ifndef offsetof
31   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
32 #endif
33 #if !defined(WIN32) && !defined(MS_WINDOWS)
34   #ifndef __stdcall
35     #define __stdcall
36   #endif
37   #ifndef __cdecl
38     #define __cdecl
39   #endif
40   #ifndef __fastcall
41     #define __fastcall
42   #endif
43 #endif
44 #ifndef DL_IMPORT
45   #define DL_IMPORT(t) t
46 #endif
47 #ifndef DL_EXPORT
48   #define DL_EXPORT(t) t
49 #endif
50 #define __PYX_COMMA ,
51 #ifndef HAVE_LONG_LONG
52   #if PY_VERSION_HEX >= 0x02070000
53     #define HAVE_LONG_LONG
54   #endif
55 #endif
56 #ifndef PY_LONG_LONG
57   #define PY_LONG_LONG LONG_LONG
58 #endif
59 #ifndef Py_HUGE_VAL
60   #define Py_HUGE_VAL HUGE_VAL
61 #endif
62 #ifdef PYPY_VERSION
63   #define CYTHON_COMPILING_IN_PYPY 1
64   #define CYTHON_COMPILING_IN_PYSTON 0
65   #define CYTHON_COMPILING_IN_CPYTHON 0
66   #undef CYTHON_USE_TYPE_SLOTS
67   #define CYTHON_USE_TYPE_SLOTS 0
68   #undef CYTHON_USE_PYTYPE_LOOKUP
69   #define CYTHON_USE_PYTYPE_LOOKUP 0
70   #if PY_VERSION_HEX < 0x03050000
71     #undef CYTHON_USE_ASYNC_SLOTS
72     #define CYTHON_USE_ASYNC_SLOTS 0
73   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
74     #define CYTHON_USE_ASYNC_SLOTS 1
75   #endif
76   #undef CYTHON_USE_PYLIST_INTERNALS
77   #define CYTHON_USE_PYLIST_INTERNALS 0
78   #undef CYTHON_USE_UNICODE_INTERNALS
79   #define CYTHON_USE_UNICODE_INTERNALS 0
80   #undef CYTHON_USE_UNICODE_WRITER
81   #define CYTHON_USE_UNICODE_WRITER 0
82   #undef CYTHON_USE_PYLONG_INTERNALS
83   #define CYTHON_USE_PYLONG_INTERNALS 0
84   #undef CYTHON_AVOID_BORROWED_REFS
85   #define CYTHON_AVOID_BORROWED_REFS 1
86   #undef CYTHON_ASSUME_SAFE_MACROS
87   #define CYTHON_ASSUME_SAFE_MACROS 0
88   #undef CYTHON_UNPACK_METHODS
89   #define CYTHON_UNPACK_METHODS 0
90   #undef CYTHON_FAST_THREAD_STATE
91   #define CYTHON_FAST_THREAD_STATE 0
92   #undef CYTHON_FAST_PYCALL
93   #define CYTHON_FAST_PYCALL 0
94   #undef CYTHON_PEP489_MULTI_PHASE_INIT
95   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
96   #undef CYTHON_USE_TP_FINALIZE
97   #define CYTHON_USE_TP_FINALIZE 0
98   #undef CYTHON_USE_DICT_VERSIONS
99   #define CYTHON_USE_DICT_VERSIONS 0
100   #undef CYTHON_USE_EXC_INFO_STACK
101   #define CYTHON_USE_EXC_INFO_STACK 0
102 #elif defined(PYSTON_VERSION)
103   #define CYTHON_COMPILING_IN_PYPY 0
104   #define CYTHON_COMPILING_IN_PYSTON 1
105   #define CYTHON_COMPILING_IN_CPYTHON 0
106   #ifndef CYTHON_USE_TYPE_SLOTS
107     #define CYTHON_USE_TYPE_SLOTS 1
108   #endif
109   #undef CYTHON_USE_PYTYPE_LOOKUP
110   #define CYTHON_USE_PYTYPE_LOOKUP 0
111   #undef CYTHON_USE_ASYNC_SLOTS
112   #define CYTHON_USE_ASYNC_SLOTS 0
113   #undef CYTHON_USE_PYLIST_INTERNALS
114   #define CYTHON_USE_PYLIST_INTERNALS 0
115   #ifndef CYTHON_USE_UNICODE_INTERNALS
116     #define CYTHON_USE_UNICODE_INTERNALS 1
117   #endif
118   #undef CYTHON_USE_UNICODE_WRITER
119   #define CYTHON_USE_UNICODE_WRITER 0
120   #undef CYTHON_USE_PYLONG_INTERNALS
121   #define CYTHON_USE_PYLONG_INTERNALS 0
122   #ifndef CYTHON_AVOID_BORROWED_REFS
123     #define CYTHON_AVOID_BORROWED_REFS 0
124   #endif
125   #ifndef CYTHON_ASSUME_SAFE_MACROS
126     #define CYTHON_ASSUME_SAFE_MACROS 1
127   #endif
128   #ifndef CYTHON_UNPACK_METHODS
129     #define CYTHON_UNPACK_METHODS 1
130   #endif
131   #undef CYTHON_FAST_THREAD_STATE
132   #define CYTHON_FAST_THREAD_STATE 0
133   #undef CYTHON_FAST_PYCALL
134   #define CYTHON_FAST_PYCALL 0
135   #undef CYTHON_PEP489_MULTI_PHASE_INIT
136   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
137   #undef CYTHON_USE_TP_FINALIZE
138   #define CYTHON_USE_TP_FINALIZE 0
139   #undef CYTHON_USE_DICT_VERSIONS
140   #define CYTHON_USE_DICT_VERSIONS 0
141   #undef CYTHON_USE_EXC_INFO_STACK
142   #define CYTHON_USE_EXC_INFO_STACK 0
143 #else
144   #define CYTHON_COMPILING_IN_PYPY 0
145   #define CYTHON_COMPILING_IN_PYSTON 0
146   #define CYTHON_COMPILING_IN_CPYTHON 1
147   #ifndef CYTHON_USE_TYPE_SLOTS
148     #define CYTHON_USE_TYPE_SLOTS 1
149   #endif
150   #if PY_VERSION_HEX < 0x02070000
151     #undef CYTHON_USE_PYTYPE_LOOKUP
152     #define CYTHON_USE_PYTYPE_LOOKUP 0
153   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
154     #define CYTHON_USE_PYTYPE_LOOKUP 1
155   #endif
156   #if PY_MAJOR_VERSION < 3
157     #undef CYTHON_USE_ASYNC_SLOTS
158     #define CYTHON_USE_ASYNC_SLOTS 0
159   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
160     #define CYTHON_USE_ASYNC_SLOTS 1
161   #endif
162   #if PY_VERSION_HEX < 0x02070000
163     #undef CYTHON_USE_PYLONG_INTERNALS
164     #define CYTHON_USE_PYLONG_INTERNALS 0
165   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
166     #define CYTHON_USE_PYLONG_INTERNALS 1
167   #endif
168   #ifndef CYTHON_USE_PYLIST_INTERNALS
169     #define CYTHON_USE_PYLIST_INTERNALS 1
170   #endif
171   #ifndef CYTHON_USE_UNICODE_INTERNALS
172     #define CYTHON_USE_UNICODE_INTERNALS 1
173   #endif
174   #if PY_VERSION_HEX < 0x030300F0
175     #undef CYTHON_USE_UNICODE_WRITER
176     #define CYTHON_USE_UNICODE_WRITER 0
177   #elif !defined(CYTHON_USE_UNICODE_WRITER)
178     #define CYTHON_USE_UNICODE_WRITER 1
179   #endif
180   #ifndef CYTHON_AVOID_BORROWED_REFS
181     #define CYTHON_AVOID_BORROWED_REFS 0
182   #endif
183   #ifndef CYTHON_ASSUME_SAFE_MACROS
184     #define CYTHON_ASSUME_SAFE_MACROS 1
185   #endif
186   #ifndef CYTHON_UNPACK_METHODS
187     #define CYTHON_UNPACK_METHODS 1
188   #endif
189   #ifndef CYTHON_FAST_THREAD_STATE
190     #define CYTHON_FAST_THREAD_STATE 1
191   #endif
192   #ifndef CYTHON_FAST_PYCALL
193     #define CYTHON_FAST_PYCALL 1
194   #endif
195   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
196     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
197   #endif
198   #ifndef CYTHON_USE_TP_FINALIZE
199     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
200   #endif
201   #ifndef CYTHON_USE_DICT_VERSIONS
202     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
203   #endif
204   #ifndef CYTHON_USE_EXC_INFO_STACK
205     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
206   #endif
207 #endif
208 #if !defined(CYTHON_FAST_PYCCALL)
209 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
210 #endif
211 #if CYTHON_USE_PYLONG_INTERNALS
212   #include "longintrepr.h"
213   #undef SHIFT
214   #undef BASE
215   #undef MASK
216   #ifdef SIZEOF_VOID_P
217     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
218   #endif
219 #endif
220 #ifndef __has_attribute
221   #define __has_attribute(x) 0
222 #endif
223 #ifndef __has_cpp_attribute
224   #define __has_cpp_attribute(x) 0
225 #endif
226 #ifndef CYTHON_RESTRICT
227   #if defined(__GNUC__)
228     #define CYTHON_RESTRICT __restrict__
229   #elif defined(_MSC_VER) && _MSC_VER >= 1400
230     #define CYTHON_RESTRICT __restrict
231   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
232     #define CYTHON_RESTRICT restrict
233   #else
234     #define CYTHON_RESTRICT
235   #endif
236 #endif
237 #ifndef CYTHON_UNUSED
238 # if defined(__GNUC__)
239 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
240 #     define CYTHON_UNUSED __attribute__ ((__unused__))
241 #   else
242 #     define CYTHON_UNUSED
243 #   endif
244 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
245 #   define CYTHON_UNUSED __attribute__ ((__unused__))
246 # else
247 #   define CYTHON_UNUSED
248 # endif
249 #endif
250 #ifndef CYTHON_MAYBE_UNUSED_VAR
251 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)252      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
253 #  else
254 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
255 #  endif
256 #endif
257 #ifndef CYTHON_NCP_UNUSED
258 # if CYTHON_COMPILING_IN_CPYTHON
259 #  define CYTHON_NCP_UNUSED
260 # else
261 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
262 # endif
263 #endif
264 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
265 #ifdef _MSC_VER
266     #ifndef _MSC_STDINT_H_
267         #if _MSC_VER < 1300
268            typedef unsigned char     uint8_t;
269            typedef unsigned int      uint32_t;
270         #else
271            typedef unsigned __int8   uint8_t;
272            typedef unsigned __int32  uint32_t;
273         #endif
274     #endif
275 #else
276    #include <stdint.h>
277 #endif
278 #ifndef CYTHON_FALLTHROUGH
279   #if defined(__cplusplus) && __cplusplus >= 201103L
280     #if __has_cpp_attribute(fallthrough)
281       #define CYTHON_FALLTHROUGH [[fallthrough]]
282     #elif __has_cpp_attribute(clang::fallthrough)
283       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
284     #elif __has_cpp_attribute(gnu::fallthrough)
285       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
286     #endif
287   #endif
288   #ifndef CYTHON_FALLTHROUGH
289     #if __has_attribute(fallthrough)
290       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
291     #else
292       #define CYTHON_FALLTHROUGH
293     #endif
294   #endif
295   #if defined(__clang__ ) && defined(__apple_build_version__)
296     #if __apple_build_version__ < 7000000
297       #undef  CYTHON_FALLTHROUGH
298       #define CYTHON_FALLTHROUGH
299     #endif
300   #endif
301 #endif
302 
303 #ifndef CYTHON_INLINE
304   #if defined(__clang__)
305     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
306   #elif defined(__GNUC__)
307     #define CYTHON_INLINE __inline__
308   #elif defined(_MSC_VER)
309     #define CYTHON_INLINE __inline
310   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
311     #define CYTHON_INLINE inline
312   #else
313     #define CYTHON_INLINE
314   #endif
315 #endif
316 
317 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
318   #define Py_OptimizeFlag 0
319 #endif
320 #define __PYX_BUILD_PY_SSIZE_T "n"
321 #define CYTHON_FORMAT_SSIZE_T "z"
322 #if PY_MAJOR_VERSION < 3
323   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
324   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
325           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
326   #define __Pyx_DefaultClassType PyClass_Type
327 #else
328   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
329 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
330   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
331           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
332 #else
333   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
334           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
335 #endif
336   #define __Pyx_DefaultClassType PyType_Type
337 #endif
338 #ifndef Py_TPFLAGS_CHECKTYPES
339   #define Py_TPFLAGS_CHECKTYPES 0
340 #endif
341 #ifndef Py_TPFLAGS_HAVE_INDEX
342   #define Py_TPFLAGS_HAVE_INDEX 0
343 #endif
344 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
345   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
346 #endif
347 #ifndef Py_TPFLAGS_HAVE_FINALIZE
348   #define Py_TPFLAGS_HAVE_FINALIZE 0
349 #endif
350 #ifndef METH_STACKLESS
351   #define METH_STACKLESS 0
352 #endif
353 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
354   #ifndef METH_FASTCALL
355      #define METH_FASTCALL 0x80
356   #endif
357   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
358   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
359                                                           Py_ssize_t nargs, PyObject *kwnames);
360 #else
361   #define __Pyx_PyCFunctionFast _PyCFunctionFast
362   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
363 #endif
364 #if CYTHON_FAST_PYCCALL
365 #define __Pyx_PyFastCFunction_Check(func)\
366     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
367 #else
368 #define __Pyx_PyFastCFunction_Check(func) 0
369 #endif
370 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
371   #define PyObject_Malloc(s)   PyMem_Malloc(s)
372   #define PyObject_Free(p)     PyMem_Free(p)
373   #define PyObject_Realloc(p)  PyMem_Realloc(p)
374 #endif
375 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
376   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
377   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
378   #define PyMem_RawFree(p)             PyMem_Free(p)
379 #endif
380 #if CYTHON_COMPILING_IN_PYSTON
381   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
382   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
383 #else
384   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
385   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
386 #endif
387 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
388   #define __Pyx_PyThreadState_Current PyThreadState_GET()
389 #elif PY_VERSION_HEX >= 0x03060000
390   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
391 #elif PY_VERSION_HEX >= 0x03000000
392   #define __Pyx_PyThreadState_Current PyThreadState_GET()
393 #else
394   #define __Pyx_PyThreadState_Current _PyThreadState_Current
395 #endif
396 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
397 #include "pythread.h"
398 #define Py_tss_NEEDS_INIT 0
399 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)400 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
401   *key = PyThread_create_key();
402   return 0;
403 }
PyThread_tss_alloc(void)404 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
405   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
406   *key = Py_tss_NEEDS_INIT;
407   return key;
408 }
PyThread_tss_free(Py_tss_t * key)409 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
410   PyObject_Free(key);
411 }
PyThread_tss_is_created(Py_tss_t * key)412 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
413   return *key != Py_tss_NEEDS_INIT;
414 }
PyThread_tss_delete(Py_tss_t * key)415 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
416   PyThread_delete_key(*key);
417   *key = Py_tss_NEEDS_INIT;
418 }
PyThread_tss_set(Py_tss_t * key,void * value)419 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
420   return PyThread_set_key_value(*key, value);
421 }
PyThread_tss_get(Py_tss_t * key)422 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
423   return PyThread_get_key_value(*key);
424 }
425 #endif
426 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
427 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
428 #else
429 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
430 #endif
431 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
432   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
433   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
434 #else
435   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
436   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
437 #endif
438 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
439 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
440 #else
441 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
442 #endif
443 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
444   #define CYTHON_PEP393_ENABLED 1
445   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
446                                               0 : _PyUnicode_Ready((PyObject *)(op)))
447   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
448   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
449   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
450   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
451   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
452   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
453   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
454   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
455 #else
456   #define CYTHON_PEP393_ENABLED 0
457   #define PyUnicode_1BYTE_KIND  1
458   #define PyUnicode_2BYTE_KIND  2
459   #define PyUnicode_4BYTE_KIND  4
460   #define __Pyx_PyUnicode_READY(op)       (0)
461   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
462   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
463   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
464   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
465   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
466   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
467   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
468   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
469 #endif
470 #if CYTHON_COMPILING_IN_PYPY
471   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
472   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
473 #else
474   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
475   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
476       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
477 #endif
478 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
479   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
480 #endif
481 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
482   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
483 #endif
484 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
485   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
486 #endif
487 #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))
488 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
489 #if PY_MAJOR_VERSION >= 3
490   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
491 #else
492   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
493 #endif
494 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
495   #define PyObject_ASCII(o)            PyObject_Repr(o)
496 #endif
497 #if PY_MAJOR_VERSION >= 3
498   #define PyBaseString_Type            PyUnicode_Type
499   #define PyStringObject               PyUnicodeObject
500   #define PyString_Type                PyUnicode_Type
501   #define PyString_Check               PyUnicode_Check
502   #define PyString_CheckExact          PyUnicode_CheckExact
503   #define PyObject_Unicode             PyObject_Str
504 #endif
505 #if PY_MAJOR_VERSION >= 3
506   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
507   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
508 #else
509   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
510   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
511 #endif
512 #ifndef PySet_CheckExact
513   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
514 #endif
515 #if CYTHON_ASSUME_SAFE_MACROS
516   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
517 #else
518   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
519 #endif
520 #if PY_MAJOR_VERSION >= 3
521   #define PyIntObject                  PyLongObject
522   #define PyInt_Type                   PyLong_Type
523   #define PyInt_Check(op)              PyLong_Check(op)
524   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
525   #define PyInt_FromString             PyLong_FromString
526   #define PyInt_FromUnicode            PyLong_FromUnicode
527   #define PyInt_FromLong               PyLong_FromLong
528   #define PyInt_FromSize_t             PyLong_FromSize_t
529   #define PyInt_FromSsize_t            PyLong_FromSsize_t
530   #define PyInt_AsLong                 PyLong_AsLong
531   #define PyInt_AS_LONG                PyLong_AS_LONG
532   #define PyInt_AsSsize_t              PyLong_AsSsize_t
533   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
534   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
535   #define PyNumber_Int                 PyNumber_Long
536 #endif
537 #if PY_MAJOR_VERSION >= 3
538   #define PyBoolObject                 PyLongObject
539 #endif
540 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
541   #ifndef PyUnicode_InternFromString
542     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
543   #endif
544 #endif
545 #if PY_VERSION_HEX < 0x030200A4
546   typedef long Py_hash_t;
547   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
548   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
549 #else
550   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
551   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
552 #endif
553 #if PY_MAJOR_VERSION >= 3
554   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
555 #else
556   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
557 #endif
558 #if CYTHON_USE_ASYNC_SLOTS
559   #if PY_VERSION_HEX >= 0x030500B1
560     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
561     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
562   #else
563     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
564   #endif
565 #else
566   #define __Pyx_PyType_AsAsync(obj) NULL
567 #endif
568 #ifndef __Pyx_PyAsyncMethodsStruct
569     typedef struct {
570         unaryfunc am_await;
571         unaryfunc am_aiter;
572         unaryfunc am_anext;
573     } __Pyx_PyAsyncMethodsStruct;
574 #endif
575 
576 #if defined(WIN32) || defined(MS_WINDOWS)
577   #define _USE_MATH_DEFINES
578 #endif
579 #include <math.h>
580 #ifdef NAN
581 #define __PYX_NAN() ((float) NAN)
582 #else
__PYX_NAN()583 static CYTHON_INLINE float __PYX_NAN() {
584   float value;
585   memset(&value, 0xFF, sizeof(value));
586   return value;
587 }
588 #endif
589 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
590 #define __Pyx_truncl trunc
591 #else
592 #define __Pyx_truncl truncl
593 #endif
594 
595 
596 #define __PYX_ERR(f_index, lineno, Ln_error) \
597 { \
598   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
599 }
600 
601 #ifndef __PYX_EXTERN_C
602   #ifdef __cplusplus
603     #define __PYX_EXTERN_C extern "C"
604   #else
605     #define __PYX_EXTERN_C extern
606   #endif
607 #endif
608 
609 #define __PYX_HAVE__yt__utilities__lib__distance_queue
610 #define __PYX_HAVE_API__yt__utilities__lib__distance_queue
611 /* Early includes */
612 #include <string.h>
613 #include <stdio.h>
614 #include "numpy/arrayobject.h"
615 #include "numpy/ufuncobject.h"
616 #include <stdlib.h>
617 #include "pythread.h"
618 #include "pystate.h"
619 #ifdef _OPENMP
620 #include <omp.h>
621 #endif /* _OPENMP */
622 
623 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
624 #define CYTHON_WITHOUT_ASSERTIONS
625 #endif
626 
627 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
628                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
629 
630 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
631 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
632 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
633 #define __PYX_DEFAULT_STRING_ENCODING ""
634 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
635 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
636 #define __Pyx_uchar_cast(c) ((unsigned char)c)
637 #define __Pyx_long_cast(x) ((long)x)
638 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
639     (sizeof(type) < sizeof(Py_ssize_t))  ||\
640     (sizeof(type) > sizeof(Py_ssize_t) &&\
641           likely(v < (type)PY_SSIZE_T_MAX ||\
642                  v == (type)PY_SSIZE_T_MAX)  &&\
643           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
644                                 v == (type)PY_SSIZE_T_MIN)))  ||\
645     (sizeof(type) == sizeof(Py_ssize_t) &&\
646           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
647                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)648 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
649     return (size_t) i < (size_t) limit;
650 }
651 #if defined (__cplusplus) && __cplusplus >= 201103L
652     #include <cstdlib>
653     #define __Pyx_sst_abs(value) std::abs(value)
654 #elif SIZEOF_INT >= SIZEOF_SIZE_T
655     #define __Pyx_sst_abs(value) abs(value)
656 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
657     #define __Pyx_sst_abs(value) labs(value)
658 #elif defined (_MSC_VER)
659     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
660 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
661     #define __Pyx_sst_abs(value) llabs(value)
662 #elif defined (__GNUC__)
663     #define __Pyx_sst_abs(value) __builtin_llabs(value)
664 #else
665     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
666 #endif
667 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
668 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
669 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
670 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
671 #define __Pyx_PyBytes_FromString        PyBytes_FromString
672 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
673 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
674 #if PY_MAJOR_VERSION < 3
675     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
676     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
677 #else
678     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
679     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
680 #endif
681 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
682 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
683 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
684 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
685 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
688 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
689 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
690 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
691 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
693 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
694 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
695 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
696 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)697 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
698     const Py_UNICODE *u_end = u;
699     while (*u_end++) ;
700     return (size_t)(u_end - u - 1);
701 }
702 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
703 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
704 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
705 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
706 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
707 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
708 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
709 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
710 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
711 #define __Pyx_PySequence_Tuple(obj)\
712     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
713 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
714 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
715 #if CYTHON_ASSUME_SAFE_MACROS
716 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
717 #else
718 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
719 #endif
720 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
721 #if PY_MAJOR_VERSION >= 3
722 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
723 #else
724 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
725 #endif
726 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
727 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
728 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)729 static int __Pyx_init_sys_getdefaultencoding_params(void) {
730     PyObject* sys;
731     PyObject* default_encoding = NULL;
732     PyObject* ascii_chars_u = NULL;
733     PyObject* ascii_chars_b = NULL;
734     const char* default_encoding_c;
735     sys = PyImport_ImportModule("sys");
736     if (!sys) goto bad;
737     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
738     Py_DECREF(sys);
739     if (!default_encoding) goto bad;
740     default_encoding_c = PyBytes_AsString(default_encoding);
741     if (!default_encoding_c) goto bad;
742     if (strcmp(default_encoding_c, "ascii") == 0) {
743         __Pyx_sys_getdefaultencoding_not_ascii = 0;
744     } else {
745         char ascii_chars[128];
746         int c;
747         for (c = 0; c < 128; c++) {
748             ascii_chars[c] = c;
749         }
750         __Pyx_sys_getdefaultencoding_not_ascii = 1;
751         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
752         if (!ascii_chars_u) goto bad;
753         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
754         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
755             PyErr_Format(
756                 PyExc_ValueError,
757                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
758                 default_encoding_c);
759             goto bad;
760         }
761         Py_DECREF(ascii_chars_u);
762         Py_DECREF(ascii_chars_b);
763     }
764     Py_DECREF(default_encoding);
765     return 0;
766 bad:
767     Py_XDECREF(default_encoding);
768     Py_XDECREF(ascii_chars_u);
769     Py_XDECREF(ascii_chars_b);
770     return -1;
771 }
772 #endif
773 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
774 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
775 #else
776 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
778 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)779 static int __Pyx_init_sys_getdefaultencoding_params(void) {
780     PyObject* sys;
781     PyObject* default_encoding = NULL;
782     char* default_encoding_c;
783     sys = PyImport_ImportModule("sys");
784     if (!sys) goto bad;
785     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
786     Py_DECREF(sys);
787     if (!default_encoding) goto bad;
788     default_encoding_c = PyBytes_AsString(default_encoding);
789     if (!default_encoding_c) goto bad;
790     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
791     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
792     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
793     Py_DECREF(default_encoding);
794     return 0;
795 bad:
796     Py_XDECREF(default_encoding);
797     return -1;
798 }
799 #endif
800 #endif
801 
802 
803 /* Test for GCC > 2.95 */
804 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
805   #define likely(x)   __builtin_expect(!!(x), 1)
806   #define unlikely(x) __builtin_expect(!!(x), 0)
807 #else /* !__GNUC__ or GCC < 2.95 */
808   #define likely(x)   (x)
809   #define unlikely(x) (x)
810 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)811 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
812 
813 static PyObject *__pyx_m = NULL;
814 static PyObject *__pyx_d;
815 static PyObject *__pyx_b;
816 static PyObject *__pyx_cython_runtime = NULL;
817 static PyObject *__pyx_empty_tuple;
818 static PyObject *__pyx_empty_bytes;
819 static PyObject *__pyx_empty_unicode;
820 static int __pyx_lineno;
821 static int __pyx_clineno = 0;
822 static const char * __pyx_cfilenm= __FILE__;
823 static const char *__pyx_filename;
824 
825 /* Header.proto */
826 #if !defined(CYTHON_CCOMPLEX)
827   #if defined(__cplusplus)
828     #define CYTHON_CCOMPLEX 1
829   #elif defined(_Complex_I)
830     #define CYTHON_CCOMPLEX 1
831   #else
832     #define CYTHON_CCOMPLEX 0
833   #endif
834 #endif
835 #if CYTHON_CCOMPLEX
836   #ifdef __cplusplus
837     #include <complex>
838   #else
839     #include <complex.h>
840   #endif
841 #endif
842 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
843   #undef _Complex_I
844   #define _Complex_I 1.0fj
845 #endif
846 
847 
848 static const char *__pyx_f[] = {
849   "yt/utilities/lib/distance_queue.pyx",
850   "stringsource",
851   "__init__.pxd",
852   "type.pxd",
853 };
854 /* MemviewSliceStruct.proto */
855 struct __pyx_memoryview_obj;
856 typedef struct {
857   struct __pyx_memoryview_obj *memview;
858   char *data;
859   Py_ssize_t shape[8];
860   Py_ssize_t strides[8];
861   Py_ssize_t suboffsets[8];
862 } __Pyx_memviewslice;
863 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
864 
865 /* Atomics.proto */
866 #include <pythread.h>
867 #ifndef CYTHON_ATOMICS
868     #define CYTHON_ATOMICS 1
869 #endif
870 #define __pyx_atomic_int_type int
871 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
872                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
873                     !defined(__i386__)
874     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
875     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
876     #ifdef __PYX_DEBUG_ATOMICS
877         #warning "Using GNU atomics"
878     #endif
879 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
880     #include <Windows.h>
881     #undef __pyx_atomic_int_type
882     #define __pyx_atomic_int_type LONG
883     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
884     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
885     #ifdef __PYX_DEBUG_ATOMICS
886         #pragma message ("Using MSVC atomics")
887     #endif
888 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
889     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
890     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
891     #ifdef __PYX_DEBUG_ATOMICS
892         #warning "Using Intel atomics"
893     #endif
894 #else
895     #undef CYTHON_ATOMICS
896     #define CYTHON_ATOMICS 0
897     #ifdef __PYX_DEBUG_ATOMICS
898         #warning "Not using atomics"
899     #endif
900 #endif
901 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
902 #if CYTHON_ATOMICS
903     #define __pyx_add_acquisition_count(memview)\
904              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
905     #define __pyx_sub_acquisition_count(memview)\
906             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
907 #else
908     #define __pyx_add_acquisition_count(memview)\
909             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
910     #define __pyx_sub_acquisition_count(memview)\
911             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
912 #endif
913 
914 /* ForceInitThreads.proto */
915 #ifndef __PYX_FORCE_INIT_THREADS
916   #define __PYX_FORCE_INIT_THREADS 0
917 #endif
918 
919 /* NoFastGil.proto */
920 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
921 #define __Pyx_PyGILState_Release PyGILState_Release
922 #define __Pyx_FastGIL_Remember()
923 #define __Pyx_FastGIL_Forget()
924 #define __Pyx_FastGilFuncInit()
925 
926 /* BufferFormatStructs.proto */
927 #define IS_UNSIGNED(type) (((type) -1) > 0)
928 struct __Pyx_StructField_;
929 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
930 typedef struct {
931   const char* name;
932   struct __Pyx_StructField_* fields;
933   size_t size;
934   size_t arraysize[8];
935   int ndim;
936   char typegroup;
937   char is_unsigned;
938   int flags;
939 } __Pyx_TypeInfo;
940 typedef struct __Pyx_StructField_ {
941   __Pyx_TypeInfo* type;
942   const char* name;
943   size_t offset;
944 } __Pyx_StructField;
945 typedef struct {
946   __Pyx_StructField* field;
947   size_t parent_offset;
948 } __Pyx_BufFmt_StackElem;
949 typedef struct {
950   __Pyx_StructField root;
951   __Pyx_BufFmt_StackElem* head;
952   size_t fmt_offset;
953   size_t new_count, enc_count;
954   size_t struct_alignment;
955   int is_complex;
956   char enc_type;
957   char new_packmode;
958   char enc_packmode;
959   char is_valid_array;
960 } __Pyx_BufFmt_Context;
961 
962 
963 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
964  * # in Cython to enable them only on the right systems.
965  *
966  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
967  * ctypedef npy_int16      int16_t
968  * ctypedef npy_int32      int32_t
969  */
970 typedef npy_int8 __pyx_t_5numpy_int8_t;
971 
972 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777
973  *
974  * ctypedef npy_int8       int8_t
975  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
976  * ctypedef npy_int32      int32_t
977  * ctypedef npy_int64      int64_t
978  */
979 typedef npy_int16 __pyx_t_5numpy_int16_t;
980 
981 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
982  * ctypedef npy_int8       int8_t
983  * ctypedef npy_int16      int16_t
984  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
985  * ctypedef npy_int64      int64_t
986  * #ctypedef npy_int96      int96_t
987  */
988 typedef npy_int32 __pyx_t_5numpy_int32_t;
989 
990 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
991  * ctypedef npy_int16      int16_t
992  * ctypedef npy_int32      int32_t
993  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
994  * #ctypedef npy_int96      int96_t
995  * #ctypedef npy_int128     int128_t
996  */
997 typedef npy_int64 __pyx_t_5numpy_int64_t;
998 
999 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
1000  * #ctypedef npy_int128     int128_t
1001  *
1002  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
1003  * ctypedef npy_uint16     uint16_t
1004  * ctypedef npy_uint32     uint32_t
1005  */
1006 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1007 
1008 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
1009  *
1010  * ctypedef npy_uint8      uint8_t
1011  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
1012  * ctypedef npy_uint32     uint32_t
1013  * ctypedef npy_uint64     uint64_t
1014  */
1015 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1016 
1017 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785
1018  * ctypedef npy_uint8      uint8_t
1019  * ctypedef npy_uint16     uint16_t
1020  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
1021  * ctypedef npy_uint64     uint64_t
1022  * #ctypedef npy_uint96     uint96_t
1023  */
1024 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1025 
1026 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
1027  * ctypedef npy_uint16     uint16_t
1028  * ctypedef npy_uint32     uint32_t
1029  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
1030  * #ctypedef npy_uint96     uint96_t
1031  * #ctypedef npy_uint128    uint128_t
1032  */
1033 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1034 
1035 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790
1036  * #ctypedef npy_uint128    uint128_t
1037  *
1038  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
1039  * ctypedef npy_float64    float64_t
1040  * #ctypedef npy_float80    float80_t
1041  */
1042 typedef npy_float32 __pyx_t_5numpy_float32_t;
1043 
1044 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
1045  *
1046  * ctypedef npy_float32    float32_t
1047  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
1048  * #ctypedef npy_float80    float80_t
1049  * #ctypedef npy_float128   float128_t
1050  */
1051 typedef npy_float64 __pyx_t_5numpy_float64_t;
1052 
1053 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
1054  * # The int types are mapped a bit surprising --
1055  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1056  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
1057  * ctypedef npy_longlong   long_t
1058  * ctypedef npy_longlong   longlong_t
1059  */
1060 typedef npy_long __pyx_t_5numpy_int_t;
1061 
1062 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
1063  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1064  * ctypedef npy_long       int_t
1065  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1066  * ctypedef npy_longlong   longlong_t
1067  *
1068  */
1069 typedef npy_longlong __pyx_t_5numpy_long_t;
1070 
1071 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802
1072  * ctypedef npy_long       int_t
1073  * ctypedef npy_longlong   long_t
1074  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1075  *
1076  * ctypedef npy_ulong      uint_t
1077  */
1078 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1079 
1080 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
1081  * ctypedef npy_longlong   longlong_t
1082  *
1083  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1084  * ctypedef npy_ulonglong  ulong_t
1085  * ctypedef npy_ulonglong  ulonglong_t
1086  */
1087 typedef npy_ulong __pyx_t_5numpy_uint_t;
1088 
1089 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
1090  *
1091  * ctypedef npy_ulong      uint_t
1092  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1093  * ctypedef npy_ulonglong  ulonglong_t
1094  *
1095  */
1096 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1097 
1098 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806
1099  * ctypedef npy_ulong      uint_t
1100  * ctypedef npy_ulonglong  ulong_t
1101  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1102  *
1103  * ctypedef npy_intp       intp_t
1104  */
1105 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1106 
1107 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808
1108  * ctypedef npy_ulonglong  ulonglong_t
1109  *
1110  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1111  * ctypedef npy_uintp      uintp_t
1112  *
1113  */
1114 typedef npy_intp __pyx_t_5numpy_intp_t;
1115 
1116 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
1117  *
1118  * ctypedef npy_intp       intp_t
1119  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1120  *
1121  * ctypedef npy_double     float_t
1122  */
1123 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1124 
1125 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811
1126  * ctypedef npy_uintp      uintp_t
1127  *
1128  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1129  * ctypedef npy_double     double_t
1130  * ctypedef npy_longdouble longdouble_t
1131  */
1132 typedef npy_double __pyx_t_5numpy_float_t;
1133 
1134 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812
1135  *
1136  * ctypedef npy_double     float_t
1137  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1138  * ctypedef npy_longdouble longdouble_t
1139  *
1140  */
1141 typedef npy_double __pyx_t_5numpy_double_t;
1142 
1143 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813
1144  * ctypedef npy_double     float_t
1145  * ctypedef npy_double     double_t
1146  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1147  *
1148  * ctypedef npy_cfloat      cfloat_t
1149  */
1150 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1151 /* Declarations.proto */
1152 #if CYTHON_CCOMPLEX
1153   #ifdef __cplusplus
1154     typedef ::std::complex< float > __pyx_t_float_complex;
1155   #else
1156     typedef float _Complex __pyx_t_float_complex;
1157   #endif
1158 #else
1159     typedef struct { float real, imag; } __pyx_t_float_complex;
1160 #endif
1161 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1162 
1163 /* Declarations.proto */
1164 #if CYTHON_CCOMPLEX
1165   #ifdef __cplusplus
1166     typedef ::std::complex< double > __pyx_t_double_complex;
1167   #else
1168     typedef double _Complex __pyx_t_double_complex;
1169   #endif
1170 #else
1171     typedef struct { double real, imag; } __pyx_t_double_complex;
1172 #endif
1173 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1174 
1175 
1176 /*--- Type declarations ---*/
1177 struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue;
1178 struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue;
1179 struct __pyx_array_obj;
1180 struct __pyx_MemviewEnum_obj;
1181 struct __pyx_memoryview_obj;
1182 struct __pyx_memoryviewslice_obj;
1183 
1184 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815
1185  * ctypedef npy_longdouble longdouble_t
1186  *
1187  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1188  * ctypedef npy_cdouble     cdouble_t
1189  * ctypedef npy_clongdouble clongdouble_t
1190  */
1191 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1192 
1193 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816
1194  *
1195  * ctypedef npy_cfloat      cfloat_t
1196  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1197  * ctypedef npy_clongdouble clongdouble_t
1198  *
1199  */
1200 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1201 
1202 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817
1203  * ctypedef npy_cfloat      cfloat_t
1204  * ctypedef npy_cdouble     cdouble_t
1205  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1206  *
1207  * ctypedef npy_cdouble     complex_t
1208  */
1209 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1210 
1211 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819
1212  * ctypedef npy_clongdouble clongdouble_t
1213  *
1214  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1215  *
1216  * cdef inline object PyArray_MultiIterNew1(a):
1217  */
1218 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1219 struct __pyx_t_2yt_9utilities_3lib_14distance_queue_ItemList;
1220 struct __pyx_t_2yt_9utilities_3lib_14distance_queue_NeighborList;
1221 
1222 /* "yt/utilities/lib/distance_queue.pxd":20
1223  * # THESE TWO STRUCTS MUST BE EQUIVALENT
1224  *
1225  * cdef struct ItemList:             # <<<<<<<<<<<<<<
1226  *     np.int64_t ind
1227  *     np.float64_t value
1228  */
1229 struct __pyx_t_2yt_9utilities_3lib_14distance_queue_ItemList {
1230   __pyx_t_5numpy_int64_t ind;
1231   __pyx_t_5numpy_float64_t value;
1232 };
1233 
1234 /* "yt/utilities/lib/distance_queue.pxd":24
1235  *     np.float64_t value
1236  *
1237  * cdef struct NeighborList:             # <<<<<<<<<<<<<<
1238  *     np.int64_t pn       # Particle number
1239  *     np.float64_t r2     # radius**2
1240  */
1241 struct __pyx_t_2yt_9utilities_3lib_14distance_queue_NeighborList {
1242   __pyx_t_5numpy_int64_t pn;
1243   __pyx_t_5numpy_float64_t r2;
1244 };
1245 
1246 /* "yt/utilities/lib/distance_queue.pxd":35
1247  *                          np.float64_t max_dist2)
1248  *
1249  * cdef class PriorityQueue:             # <<<<<<<<<<<<<<
1250  *     cdef int maxn
1251  *     cdef int curn
1252  */
1253 struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue {
1254   PyObject_HEAD
1255   struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_vtab;
1256   int maxn;
1257   int curn;
1258   struct __pyx_t_2yt_9utilities_3lib_14distance_queue_ItemList *items;
1259 };
1260 
1261 
1262 /* "yt/utilities/lib/distance_queue.pxd":42
1263  *     cdef int item_insert(self, np.int64_t i, np.float64_t value)
1264  *
1265  * cdef class DistanceQueue(PriorityQueue):             # <<<<<<<<<<<<<<
1266  *     cdef np.float64_t DW[3]
1267  *     cdef bint periodicity[3]
1268  */
1269 struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue {
1270   struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue __pyx_base;
1271   __pyx_t_5numpy_float64_t DW[3];
1272   int periodicity[3];
1273   struct __pyx_t_2yt_9utilities_3lib_14distance_queue_NeighborList *neighbors;
1274 };
1275 
1276 
1277 /* "View.MemoryView":105
1278  *
1279  * @cname("__pyx_array")
1280  * cdef class array:             # <<<<<<<<<<<<<<
1281  *
1282  *     cdef:
1283  */
1284 struct __pyx_array_obj {
1285   PyObject_HEAD
1286   struct __pyx_vtabstruct_array *__pyx_vtab;
1287   char *data;
1288   Py_ssize_t len;
1289   char *format;
1290   int ndim;
1291   Py_ssize_t *_shape;
1292   Py_ssize_t *_strides;
1293   Py_ssize_t itemsize;
1294   PyObject *mode;
1295   PyObject *_format;
1296   void (*callback_free_data)(void *);
1297   int free_data;
1298   int dtype_is_object;
1299 };
1300 
1301 
1302 /* "View.MemoryView":279
1303  *
1304  * @cname('__pyx_MemviewEnum')
1305  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1306  *     cdef object name
1307  *     def __init__(self, name):
1308  */
1309 struct __pyx_MemviewEnum_obj {
1310   PyObject_HEAD
1311   PyObject *name;
1312 };
1313 
1314 
1315 /* "View.MemoryView":330
1316  *
1317  * @cname('__pyx_memoryview')
1318  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1319  *
1320  *     cdef object obj
1321  */
1322 struct __pyx_memoryview_obj {
1323   PyObject_HEAD
1324   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1325   PyObject *obj;
1326   PyObject *_size;
1327   PyObject *_array_interface;
1328   PyThread_type_lock lock;
1329   __pyx_atomic_int acquisition_count[2];
1330   __pyx_atomic_int *acquisition_count_aligned_p;
1331   Py_buffer view;
1332   int flags;
1333   int dtype_is_object;
1334   __Pyx_TypeInfo *typeinfo;
1335 };
1336 
1337 
1338 /* "View.MemoryView":961
1339  *
1340  * @cname('__pyx_memoryviewslice')
1341  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1342  *     "Internal class for passing memoryview slices to Python"
1343  *
1344  */
1345 struct __pyx_memoryviewslice_obj {
1346   struct __pyx_memoryview_obj __pyx_base;
1347   __Pyx_memviewslice from_slice;
1348   PyObject *from_object;
1349   PyObject *(*to_object_func)(char *);
1350   int (*to_dtype_func)(char *, PyObject *);
1351 };
1352 
1353 
1354 
1355 /* "yt/utilities/lib/distance_queue.pyx":57
1356  *     return r2
1357  *
1358  * cdef class PriorityQueue:             # <<<<<<<<<<<<<<
1359  *     """This class acts as a "priority-queue."  It was extracted from the
1360  *     DistanceQueue object so that it could serve as a general-purpose method for
1361  */
1362 
1363 struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_PriorityQueue {
1364   void (*item_reset)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *);
1365   int (*item_insert)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_float64_t);
1366 };
1367 static struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_vtabptr_2yt_9utilities_3lib_14distance_queue_PriorityQueue;
1368 
1369 
1370 /* "yt/utilities/lib/distance_queue.pyx":109
1371  *         return di + 1
1372  *
1373  * cdef class DistanceQueue:             # <<<<<<<<<<<<<<
1374  *     """This is a distance queue object, designed to incrementally evaluate N
1375  *     positions against a reference point.  It is initialized with the maximum
1376  */
1377 
1378 struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_DistanceQueue {
1379   struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_PriorityQueue __pyx_base;
1380   void (*_setup)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *, __pyx_t_5numpy_float64_t *, int *);
1381   void (*neighbor_eval)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *);
1382   void (*neighbor_reset)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *);
1383 };
1384 static struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_vtabptr_2yt_9utilities_3lib_14distance_queue_DistanceQueue;
1385 
1386 
1387 /* "View.MemoryView":105
1388  *
1389  * @cname("__pyx_array")
1390  * cdef class array:             # <<<<<<<<<<<<<<
1391  *
1392  *     cdef:
1393  */
1394 
1395 struct __pyx_vtabstruct_array {
1396   PyObject *(*get_memview)(struct __pyx_array_obj *);
1397 };
1398 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1399 
1400 
1401 /* "View.MemoryView":330
1402  *
1403  * @cname('__pyx_memoryview')
1404  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1405  *
1406  *     cdef object obj
1407  */
1408 
1409 struct __pyx_vtabstruct_memoryview {
1410   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1411   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1412   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1413   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1414   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1415   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1416   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1417 };
1418 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1419 
1420 
1421 /* "View.MemoryView":961
1422  *
1423  * @cname('__pyx_memoryviewslice')
1424  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1425  *     "Internal class for passing memoryview slices to Python"
1426  *
1427  */
1428 
1429 struct __pyx_vtabstruct__memoryviewslice {
1430   struct __pyx_vtabstruct_memoryview __pyx_base;
1431 };
1432 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1433 
1434 /* --- Runtime support code (head) --- */
1435 /* Refnanny.proto */
1436 #ifndef CYTHON_REFNANNY
1437   #define CYTHON_REFNANNY 0
1438 #endif
1439 #if CYTHON_REFNANNY
1440   typedef struct {
1441     void (*INCREF)(void*, PyObject*, int);
1442     void (*DECREF)(void*, PyObject*, int);
1443     void (*GOTREF)(void*, PyObject*, int);
1444     void (*GIVEREF)(void*, PyObject*, int);
1445     void* (*SetupContext)(const char*, int, const char*);
1446     void (*FinishContext)(void**);
1447   } __Pyx_RefNannyAPIStruct;
1448   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1449   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1450   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1451 #ifdef WITH_THREAD
1452   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1453           if (acquire_gil) {\
1454               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1455               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1456               PyGILState_Release(__pyx_gilstate_save);\
1457           } else {\
1458               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1459           }
1460 #else
1461   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1462           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1463 #endif
1464   #define __Pyx_RefNannyFinishContext()\
1465           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1466   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1467   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1468   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1469   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1470   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1471   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1472   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1473   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1474 #else
1475   #define __Pyx_RefNannyDeclarations
1476   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1477   #define __Pyx_RefNannyFinishContext()
1478   #define __Pyx_INCREF(r) Py_INCREF(r)
1479   #define __Pyx_DECREF(r) Py_DECREF(r)
1480   #define __Pyx_GOTREF(r)
1481   #define __Pyx_GIVEREF(r)
1482   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1483   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1484   #define __Pyx_XGOTREF(r)
1485   #define __Pyx_XGIVEREF(r)
1486 #endif
1487 #define __Pyx_XDECREF_SET(r, v) do {\
1488         PyObject *tmp = (PyObject *) r;\
1489         r = v; __Pyx_XDECREF(tmp);\
1490     } while (0)
1491 #define __Pyx_DECREF_SET(r, v) do {\
1492         PyObject *tmp = (PyObject *) r;\
1493         r = v; __Pyx_DECREF(tmp);\
1494     } while (0)
1495 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1496 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1497 
1498 /* PyObjectGetAttrStr.proto */
1499 #if CYTHON_USE_TYPE_SLOTS
1500 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1501 #else
1502 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1503 #endif
1504 
1505 /* GetBuiltinName.proto */
1506 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1507 
1508 /* RaiseDoubleKeywords.proto */
1509 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1510 
1511 /* ParseKeywords.proto */
1512 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1513     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1514     const char* function_name);
1515 
1516 /* RaiseArgTupleInvalid.proto */
1517 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1518     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1519 
1520 /* PyObjectCall.proto */
1521 #if CYTHON_COMPILING_IN_CPYTHON
1522 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1523 #else
1524 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1525 #endif
1526 
1527 /* PyThreadStateGet.proto */
1528 #if CYTHON_FAST_THREAD_STATE
1529 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1530 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1531 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1532 #else
1533 #define __Pyx_PyThreadState_declare
1534 #define __Pyx_PyThreadState_assign
1535 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1536 #endif
1537 
1538 /* PyErrFetchRestore.proto */
1539 #if CYTHON_FAST_THREAD_STATE
1540 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1541 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1542 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1543 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1544 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1545 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1546 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1547 #if CYTHON_COMPILING_IN_CPYTHON
1548 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1549 #else
1550 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1551 #endif
1552 #else
1553 #define __Pyx_PyErr_Clear() PyErr_Clear()
1554 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1555 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1556 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1557 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1558 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1559 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1560 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1561 #endif
1562 
1563 /* RaiseException.proto */
1564 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1565 
1566 /* BufferIndexError.proto */
1567 static void __Pyx_RaiseBufferIndexError(int axis);
1568 
1569 /* GetItemInt.proto */
1570 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1571     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1572     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1573     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1574                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1575 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1576     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1577     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1578     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1579 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1580                                                               int wraparound, int boundscheck);
1581 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1582     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1583     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1584     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1585 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1586                                                               int wraparound, int boundscheck);
1587 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1588 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1589                                                      int is_list, int wraparound, int boundscheck);
1590 
1591 /* MemviewSliceInit.proto */
1592 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1593 #define __Pyx_MEMVIEW_DIRECT   1
1594 #define __Pyx_MEMVIEW_PTR      2
1595 #define __Pyx_MEMVIEW_FULL     4
1596 #define __Pyx_MEMVIEW_CONTIG   8
1597 #define __Pyx_MEMVIEW_STRIDED  16
1598 #define __Pyx_MEMVIEW_FOLLOW   32
1599 #define __Pyx_IS_C_CONTIG 1
1600 #define __Pyx_IS_F_CONTIG 2
1601 static int __Pyx_init_memviewslice(
1602                 struct __pyx_memoryview_obj *memview,
1603                 int ndim,
1604                 __Pyx_memviewslice *memviewslice,
1605                 int memview_is_new_reference);
1606 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1607     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1608 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1609     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1610 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1611 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1612 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1613 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1614 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1615 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1616 
1617 /* PyDictVersioning.proto */
1618 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1619 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1620 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1621 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1622     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1623     (cache_var) = (value);
1624 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1625     static PY_UINT64_T __pyx_dict_version = 0;\
1626     static PyObject *__pyx_dict_cached_value = NULL;\
1627     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1628         (VAR) = __pyx_dict_cached_value;\
1629     } else {\
1630         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1631         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1632     }\
1633 }
1634 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1635 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1636 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1637 #else
1638 #define __PYX_GET_DICT_VERSION(dict)  (0)
1639 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1640 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1641 #endif
1642 
1643 /* GetModuleGlobalName.proto */
1644 #if CYTHON_USE_DICT_VERSIONS
1645 #define __Pyx_GetModuleGlobalName(var, name)  {\
1646     static PY_UINT64_T __pyx_dict_version = 0;\
1647     static PyObject *__pyx_dict_cached_value = NULL;\
1648     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1649         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1650         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1651 }
1652 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1653     PY_UINT64_T __pyx_dict_version;\
1654     PyObject *__pyx_dict_cached_value;\
1655     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1656 }
1657 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1658 #else
1659 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1660 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1661 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1662 #endif
1663 
1664 /* SetItemInt.proto */
1665 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1666     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1667     __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1668     (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1669                __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1670 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1671 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1672                                                int is_list, int wraparound, int boundscheck);
1673 
1674 /* PyCFunctionFastCall.proto */
1675 #if CYTHON_FAST_PYCCALL
1676 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1677 #else
1678 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1679 #endif
1680 
1681 /* PyFunctionFastCall.proto */
1682 #if CYTHON_FAST_PYCALL
1683 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1684     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1685 #if 1 || PY_VERSION_HEX < 0x030600B1
1686 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1687 #else
1688 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1689 #endif
1690 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1691     (sizeof(char [1 - 2*!(cond)]) - 1)
1692 #ifndef Py_MEMBER_SIZE
1693 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1694 #endif
1695   static size_t __pyx_pyframe_localsplus_offset = 0;
1696   #include "frameobject.h"
1697   #define __Pxy_PyFrame_Initialize_Offsets()\
1698     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1699      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1700   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1701     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1702 #endif
1703 
1704 /* PyObjectCallMethO.proto */
1705 #if CYTHON_COMPILING_IN_CPYTHON
1706 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1707 #endif
1708 
1709 /* PyObjectCallOneArg.proto */
1710 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1711 
1712 /* DictGetItem.proto */
1713 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1714 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1715 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1716     (likely(PyDict_CheckExact(obj)) ?\
1717      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1718 #else
1719 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1720 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1721 #endif
1722 
1723 /* RaiseTooManyValuesToUnpack.proto */
1724 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1725 
1726 /* RaiseNeedMoreValuesToUnpack.proto */
1727 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1728 
1729 /* RaiseNoneIterError.proto */
1730 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1731 
1732 /* ExtTypeTest.proto */
1733 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1734 
1735 /* GetTopmostException.proto */
1736 #if CYTHON_USE_EXC_INFO_STACK
1737 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1738 #endif
1739 
1740 /* SaveResetException.proto */
1741 #if CYTHON_FAST_THREAD_STATE
1742 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1743 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1744 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1745 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1746 #else
1747 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1748 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1749 #endif
1750 
1751 /* PyErrExceptionMatches.proto */
1752 #if CYTHON_FAST_THREAD_STATE
1753 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1754 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1755 #else
1756 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1757 #endif
1758 
1759 /* GetException.proto */
1760 #if CYTHON_FAST_THREAD_STATE
1761 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1762 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1763 #else
1764 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1765 #endif
1766 
1767 /* ArgTypeTest.proto */
1768 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1769     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1770         __Pyx__ArgTypeTest(obj, type, name, exact))
1771 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1772 
1773 /* PyObjectCall2Args.proto */
1774 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1775 
1776 /* IncludeStringH.proto */
1777 #include <string.h>
1778 
1779 /* BytesEquals.proto */
1780 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1781 
1782 /* UnicodeEquals.proto */
1783 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1784 
1785 /* StrEquals.proto */
1786 #if PY_MAJOR_VERSION >= 3
1787 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1788 #else
1789 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1790 #endif
1791 
1792 /* None.proto */
1793 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1794 
1795 /* UnaryNegOverflows.proto */
1796 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1797         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1798 
1799 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1800 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1801 /* GetAttr.proto */
1802 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1803 
1804 /* ObjectGetItem.proto */
1805 #if CYTHON_USE_TYPE_SLOTS
1806 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1807 #else
1808 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1809 #endif
1810 
1811 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1812 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1813     int byteorder = 0;
1814     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1815 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1816 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1817     int byteorder = -1;
1818     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1819 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1820 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1821     int byteorder = 1;
1822     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1823 }
1824 
1825 /* decode_c_string.proto */
1826 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1827          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1828          const char* encoding, const char* errors,
1829          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1830 
1831 /* GetAttr3.proto */
1832 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1833 
1834 /* SwapException.proto */
1835 #if CYTHON_FAST_THREAD_STATE
1836 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1837 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1838 #else
1839 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1840 #endif
1841 
1842 /* Import.proto */
1843 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1844 
1845 /* FastTypeChecks.proto */
1846 #if CYTHON_COMPILING_IN_CPYTHON
1847 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1848 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1849 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1850 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1851 #else
1852 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1853 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1854 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1855 #endif
1856 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1857 
1858 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1859 /* ListCompAppend.proto */
1860 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1861 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1862     PyListObject* L = (PyListObject*) list;
1863     Py_ssize_t len = Py_SIZE(list);
1864     if (likely(L->allocated > len)) {
1865         Py_INCREF(x);
1866         PyList_SET_ITEM(list, len, x);
1867         Py_SIZE(list) = len+1;
1868         return 0;
1869     }
1870     return PyList_Append(list, x);
1871 }
1872 #else
1873 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1874 #endif
1875 
1876 /* PyIntBinop.proto */
1877 #if !CYTHON_COMPILING_IN_PYPY
1878 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1879 #else
1880 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1881     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1882 #endif
1883 
1884 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)1885 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1886 #if CYTHON_COMPILING_IN_CPYTHON
1887     PyObject* none = _PyList_Extend((PyListObject*)L, v);
1888     if (unlikely(!none))
1889         return -1;
1890     Py_DECREF(none);
1891     return 0;
1892 #else
1893     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1894 #endif
1895 }
1896 
1897 /* ListAppend.proto */
1898 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1899 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1900     PyListObject* L = (PyListObject*) list;
1901     Py_ssize_t len = Py_SIZE(list);
1902     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1903         Py_INCREF(x);
1904         PyList_SET_ITEM(list, len, x);
1905         Py_SIZE(list) = len+1;
1906         return 0;
1907     }
1908     return PyList_Append(list, x);
1909 }
1910 #else
1911 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1912 #endif
1913 
1914 /* None.proto */
1915 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1916 
1917 /* None.proto */
1918 static CYTHON_INLINE long __Pyx_div_long(long, long);
1919 
1920 /* WriteUnraisableException.proto */
1921 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1922                                   int lineno, const char *filename,
1923                                   int full_traceback, int nogil);
1924 
1925 /* ImportFrom.proto */
1926 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1927 
1928 /* HasAttr.proto */
1929 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1930 
1931 /* PyObject_GenericGetAttrNoDict.proto */
1932 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1933 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1934 #else
1935 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1936 #endif
1937 
1938 /* PyObject_GenericGetAttr.proto */
1939 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1940 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1941 #else
1942 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1943 #endif
1944 
1945 /* SetVTable.proto */
1946 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1947 
1948 /* SetupReduce.proto */
1949 static int __Pyx_setup_reduce(PyObject* type_obj);
1950 
1951 /* TypeImport.proto */
1952 #ifndef __PYX_HAVE_RT_ImportType_proto
1953 #define __PYX_HAVE_RT_ImportType_proto
1954 enum __Pyx_ImportType_CheckSize {
1955    __Pyx_ImportType_CheckSize_Error = 0,
1956    __Pyx_ImportType_CheckSize_Warn = 1,
1957    __Pyx_ImportType_CheckSize_Ignore = 2
1958 };
1959 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1960 #endif
1961 
1962 /* CLineInTraceback.proto */
1963 #ifdef CYTHON_CLINE_IN_TRACEBACK
1964 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1965 #else
1966 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1967 #endif
1968 
1969 /* CodeObjectCache.proto */
1970 typedef struct {
1971     PyCodeObject* code_object;
1972     int code_line;
1973 } __Pyx_CodeObjectCacheEntry;
1974 struct __Pyx_CodeObjectCache {
1975     int count;
1976     int max_count;
1977     __Pyx_CodeObjectCacheEntry* entries;
1978 };
1979 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1980 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1981 static PyCodeObject *__pyx_find_code_object(int code_line);
1982 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1983 
1984 /* AddTraceback.proto */
1985 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1986                                int py_line, const char *filename);
1987 
1988 #if PY_MAJOR_VERSION < 3
1989     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1990     static void __Pyx_ReleaseBuffer(Py_buffer *view);
1991 #else
1992     #define __Pyx_GetBuffer PyObject_GetBuffer
1993     #define __Pyx_ReleaseBuffer PyBuffer_Release
1994 #endif
1995 
1996 
1997 /* BufferStructDeclare.proto */
1998 typedef struct {
1999   Py_ssize_t shape, strides, suboffsets;
2000 } __Pyx_Buf_DimInfo;
2001 typedef struct {
2002   size_t refcount;
2003   Py_buffer pybuffer;
2004 } __Pyx_Buffer;
2005 typedef struct {
2006   __Pyx_Buffer *rcbuffer;
2007   char *data;
2008   __Pyx_Buf_DimInfo diminfo[8];
2009 } __Pyx_LocalBuf_ND;
2010 
2011 /* MemviewSliceIsContig.proto */
2012 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2013 
2014 /* OverlappingSlices.proto */
2015 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2016                                 __Pyx_memviewslice *slice2,
2017                                 int ndim, size_t itemsize);
2018 
2019 /* Capsule.proto */
2020 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2021 
2022 /* IsLittleEndian.proto */
2023 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
2024 
2025 /* BufferFormatCheck.proto */
2026 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
2027 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2028                               __Pyx_BufFmt_StackElem* stack,
2029                               __Pyx_TypeInfo* type);
2030 
2031 /* TypeInfoCompare.proto */
2032 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2033 
2034 /* MemviewSliceValidateAndInit.proto */
2035 static int __Pyx_ValidateAndInit_memviewslice(
2036                 int *axes_specs,
2037                 int c_or_f_flag,
2038                 int buf_flags,
2039                 int ndim,
2040                 __Pyx_TypeInfo *dtype,
2041                 __Pyx_BufFmt_StackElem stack[],
2042                 __Pyx_memviewslice *memviewslice,
2043                 PyObject *original_obj);
2044 
2045 /* ObjectToMemviewSlice.proto */
2046 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *, int writable_flag);
2047 
2048 /* ObjectToMemviewSlice.proto */
2049 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(PyObject *, int writable_flag);
2050 
2051 /* CIntToPy.proto */
2052 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2053 
2054 /* CIntToPy.proto */
2055 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2056 
2057 /* CIntToPy.proto */
2058 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value);
2059 
2060 /* RealImag.proto */
2061 #if CYTHON_CCOMPLEX
2062   #ifdef __cplusplus
2063     #define __Pyx_CREAL(z) ((z).real())
2064     #define __Pyx_CIMAG(z) ((z).imag())
2065   #else
2066     #define __Pyx_CREAL(z) (__real__(z))
2067     #define __Pyx_CIMAG(z) (__imag__(z))
2068   #endif
2069 #else
2070     #define __Pyx_CREAL(z) ((z).real)
2071     #define __Pyx_CIMAG(z) ((z).imag)
2072 #endif
2073 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2074         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2075     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2076     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2077 #else
2078     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2079     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2080 #endif
2081 
2082 /* Arithmetic.proto */
2083 #if CYTHON_CCOMPLEX
2084     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
2085     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
2086     #define __Pyx_c_diff_float(a, b) ((a)-(b))
2087     #define __Pyx_c_prod_float(a, b) ((a)*(b))
2088     #define __Pyx_c_quot_float(a, b) ((a)/(b))
2089     #define __Pyx_c_neg_float(a)     (-(a))
2090   #ifdef __cplusplus
2091     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2092     #define __Pyx_c_conj_float(z)    (::std::conj(z))
2093     #if 1
2094         #define __Pyx_c_abs_float(z)     (::std::abs(z))
2095         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
2096     #endif
2097   #else
2098     #define __Pyx_c_is_zero_float(z) ((z)==0)
2099     #define __Pyx_c_conj_float(z)    (conjf(z))
2100     #if 1
2101         #define __Pyx_c_abs_float(z)     (cabsf(z))
2102         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
2103     #endif
2104  #endif
2105 #else
2106     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2107     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2108     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2109     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2110     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2111     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2112     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2113     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2114     #if 1
2115         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2116         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2117     #endif
2118 #endif
2119 
2120 /* Arithmetic.proto */
2121 #if CYTHON_CCOMPLEX
2122     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2123     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2124     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2125     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2126     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2127     #define __Pyx_c_neg_double(a)     (-(a))
2128   #ifdef __cplusplus
2129     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2130     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2131     #if 1
2132         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2133         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2134     #endif
2135   #else
2136     #define __Pyx_c_is_zero_double(z) ((z)==0)
2137     #define __Pyx_c_conj_double(z)    (conj(z))
2138     #if 1
2139         #define __Pyx_c_abs_double(z)     (cabs(z))
2140         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2141     #endif
2142  #endif
2143 #else
2144     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2145     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2146     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2147     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2148     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2149     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2150     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2151     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2152     #if 1
2153         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2154         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2155     #endif
2156 #endif
2157 
2158 /* CIntToPy.proto */
2159 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
2160 
2161 /* MemviewSliceCopyTemplate.proto */
2162 static __Pyx_memviewslice
2163 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2164                                  const char *mode, int ndim,
2165                                  size_t sizeof_dtype, int contig_flag,
2166                                  int dtype_is_object);
2167 
2168 /* CIntFromPy.proto */
2169 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2170 
2171 /* CIntFromPy.proto */
2172 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2173 
2174 /* CIntFromPy.proto */
2175 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2176 
2177 /* CheckBinaryVersion.proto */
2178 static int __Pyx_check_binary_version(void);
2179 
2180 /* FunctionExport.proto */
2181 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
2182 
2183 /* InitStrings.proto */
2184 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2185 
2186 static void __pyx_f_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_item_reset(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self); /* proto*/
2187 static int __pyx_f_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_item_insert(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_ind, __pyx_t_5numpy_float64_t __pyx_v_value); /* proto*/
2188 static void __pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue__setup(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_DW, int *__pyx_v_periodicity); /* proto*/
2189 static void __pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_neighbor_eval(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_pn, __pyx_t_5numpy_float64_t *__pyx_v_ppos, __pyx_t_5numpy_float64_t *__pyx_v_cpos); /* proto*/
2190 static void __pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_neighbor_reset(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self); /* proto*/
2191 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2192 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2193 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2194 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2195 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
2196 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2197 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2198 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2199 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2200 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2201 
2202 /* Module declarations from 'cython.view' */
2203 
2204 /* Module declarations from 'cython' */
2205 
2206 /* Module declarations from 'cpython.buffer' */
2207 
2208 /* Module declarations from 'libc.string' */
2209 
2210 /* Module declarations from 'libc.stdio' */
2211 
2212 /* Module declarations from '__builtin__' */
2213 
2214 /* Module declarations from 'cpython.type' */
2215 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2216 
2217 /* Module declarations from 'cpython' */
2218 
2219 /* Module declarations from 'cpython.object' */
2220 
2221 /* Module declarations from 'cpython.ref' */
2222 
2223 /* Module declarations from 'cpython.mem' */
2224 
2225 /* Module declarations from 'numpy' */
2226 
2227 /* Module declarations from 'numpy' */
2228 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2229 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2230 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2231 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2232 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2233 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
2234 
2235 /* Module declarations from 'libc.stdlib' */
2236 
2237 /* Module declarations from 'yt.utilities.lib.distance_queue' */
2238 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14distance_queue_PriorityQueue = 0;
2239 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_14distance_queue_DistanceQueue = 0;
2240 static PyTypeObject *__pyx_array_type = 0;
2241 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2242 static PyTypeObject *__pyx_memoryview_type = 0;
2243 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2244 static PyObject *generic = 0;
2245 static PyObject *strided = 0;
2246 static PyObject *indirect = 0;
2247 static PyObject *contiguous = 0;
2248 static PyObject *indirect_contiguous = 0;
2249 static int __pyx_memoryview_thread_locks_used;
2250 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2251 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_14distance_queue_r2dist(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int *, __pyx_t_5numpy_float64_t); /*proto*/
2252 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2253 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2254 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2255 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2256 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2257 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2258 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2259 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
2260 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2261 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2262 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2263 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2264 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2265 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2266 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2267 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2268 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2269 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2270 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2271 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2272 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2273 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2274 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2275 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2276 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2277 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2278 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2279 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2280 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2281 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2282 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2283 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2284 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2285 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 };
2286 #define __Pyx_MODULE_NAME "yt.utilities.lib.distance_queue"
2287 extern int __pyx_module_is_main_yt__utilities__lib__distance_queue;
2288 int __pyx_module_is_main_yt__utilities__lib__distance_queue = 0;
2289 
2290 /* Implementation of 'yt.utilities.lib.distance_queue' */
2291 static PyObject *__pyx_builtin_range;
2292 static PyObject *__pyx_builtin_TypeError;
2293 static PyObject *__pyx_builtin_RuntimeError;
2294 static PyObject *__pyx_builtin_ValueError;
2295 static PyObject *__pyx_builtin_ImportError;
2296 static PyObject *__pyx_builtin_MemoryError;
2297 static PyObject *__pyx_builtin_enumerate;
2298 static PyObject *__pyx_builtin_Ellipsis;
2299 static PyObject *__pyx_builtin_id;
2300 static PyObject *__pyx_builtin_IndexError;
2301 static const char __pyx_k_O[] = "O";
2302 static const char __pyx_k_c[] = "c";
2303 static const char __pyx_k_DW[] = "DW";
2304 static const char __pyx_k_id[] = "id";
2305 static const char __pyx_k_np[] = "np";
2306 static const char __pyx_k_new[] = "__new__";
2307 static const char __pyx_k_obj[] = "obj";
2308 static const char __pyx_k_base[] = "base";
2309 static const char __pyx_k_dict[] = "__dict__";
2310 static const char __pyx_k_main[] = "__main__";
2311 static const char __pyx_k_maxn[] = "maxn";
2312 static const char __pyx_k_mode[] = "mode";
2313 static const char __pyx_k_name[] = "name";
2314 static const char __pyx_k_ndim[] = "ndim";
2315 static const char __pyx_k_pack[] = "pack";
2316 static const char __pyx_k_size[] = "size";
2317 static const char __pyx_k_step[] = "step";
2318 static const char __pyx_k_stop[] = "stop";
2319 static const char __pyx_k_test[] = "__test__";
2320 static const char __pyx_k_ASCII[] = "ASCII";
2321 static const char __pyx_k_class[] = "__class__";
2322 static const char __pyx_k_dtype[] = "dtype";
2323 static const char __pyx_k_empty[] = "empty";
2324 static const char __pyx_k_error[] = "error";
2325 static const char __pyx_k_flags[] = "flags";
2326 static const char __pyx_k_int64[] = "int64";
2327 static const char __pyx_k_numpy[] = "numpy";
2328 static const char __pyx_k_range[] = "range";
2329 static const char __pyx_k_shape[] = "shape";
2330 static const char __pyx_k_start[] = "start";
2331 static const char __pyx_k_center[] = "center";
2332 static const char __pyx_k_encode[] = "encode";
2333 static const char __pyx_k_format[] = "format";
2334 static const char __pyx_k_import[] = "__import__";
2335 static const char __pyx_k_name_2[] = "__name__";
2336 static const char __pyx_k_pickle[] = "pickle";
2337 static const char __pyx_k_points[] = "points";
2338 static const char __pyx_k_reduce[] = "__reduce__";
2339 static const char __pyx_k_struct[] = "struct";
2340 static const char __pyx_k_unpack[] = "unpack";
2341 static const char __pyx_k_update[] = "update";
2342 static const char __pyx_k_fortran[] = "fortran";
2343 static const char __pyx_k_memview[] = "memview";
2344 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2345 static const char __pyx_k_getstate[] = "__getstate__";
2346 static const char __pyx_k_itemsize[] = "itemsize";
2347 static const char __pyx_k_pyx_type[] = "__pyx_type";
2348 static const char __pyx_k_setstate[] = "__setstate__";
2349 static const char __pyx_k_TypeError[] = "TypeError";
2350 static const char __pyx_k_enumerate[] = "enumerate";
2351 static const char __pyx_k_pyx_state[] = "__pyx_state";
2352 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2353 static const char __pyx_k_IndexError[] = "IndexError";
2354 static const char __pyx_k_ValueError[] = "ValueError";
2355 static const char __pyx_k_pyx_result[] = "__pyx_result";
2356 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2357 static const char __pyx_k_ImportError[] = "ImportError";
2358 static const char __pyx_k_MemoryError[] = "MemoryError";
2359 static const char __pyx_k_PickleError[] = "PickleError";
2360 static const char __pyx_k_periodicity[] = "periodicity";
2361 static const char __pyx_k_RuntimeError[] = "RuntimeError";
2362 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2363 static const char __pyx_k_stringsource[] = "stringsource";
2364 static const char __pyx_k_DistanceQueue[] = "DistanceQueue";
2365 static const char __pyx_k_PriorityQueue[] = "PriorityQueue";
2366 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2367 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2368 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2369 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2370 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2371 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2372 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2373 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2374 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2375 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2376 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2377 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2378 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2379 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2380 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2381 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2382 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2383 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2384 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
2385 static const char __pyx_k_Distance_queue_implementation[] = "\nDistance queue implementation\n\n\n\n\n";
2386 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2387 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2388 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2389 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
2390 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2391 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2392 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2393 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2394 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2395 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
2396 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2397 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2398 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2399 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
2400 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2401 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2402 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2403 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
2404 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2405 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2406 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2407 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
2408 static PyObject *__pyx_n_s_ASCII;
2409 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2410 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2411 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2412 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2413 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2414 static PyObject *__pyx_n_s_DW;
2415 static PyObject *__pyx_n_s_DistanceQueue;
2416 static PyObject *__pyx_n_s_Ellipsis;
2417 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2418 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
2419 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
2420 static PyObject *__pyx_n_s_ImportError;
2421 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2422 static PyObject *__pyx_n_s_IndexError;
2423 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2424 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2425 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2426 static PyObject *__pyx_n_s_MemoryError;
2427 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2428 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2429 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
2430 static PyObject *__pyx_n_b_O;
2431 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2432 static PyObject *__pyx_n_s_PickleError;
2433 static PyObject *__pyx_n_s_PriorityQueue;
2434 static PyObject *__pyx_n_s_RuntimeError;
2435 static PyObject *__pyx_n_s_TypeError;
2436 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2437 static PyObject *__pyx_n_s_ValueError;
2438 static PyObject *__pyx_n_s_View_MemoryView;
2439 static PyObject *__pyx_n_s_allocate_buffer;
2440 static PyObject *__pyx_n_s_base;
2441 static PyObject *__pyx_n_s_c;
2442 static PyObject *__pyx_n_u_c;
2443 static PyObject *__pyx_n_s_center;
2444 static PyObject *__pyx_n_s_class;
2445 static PyObject *__pyx_n_s_cline_in_traceback;
2446 static PyObject *__pyx_kp_s_contiguous_and_direct;
2447 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2448 static PyObject *__pyx_n_s_dict;
2449 static PyObject *__pyx_n_s_dtype;
2450 static PyObject *__pyx_n_s_dtype_is_object;
2451 static PyObject *__pyx_n_s_empty;
2452 static PyObject *__pyx_n_s_encode;
2453 static PyObject *__pyx_n_s_enumerate;
2454 static PyObject *__pyx_n_s_error;
2455 static PyObject *__pyx_n_s_flags;
2456 static PyObject *__pyx_n_s_format;
2457 static PyObject *__pyx_n_s_fortran;
2458 static PyObject *__pyx_n_u_fortran;
2459 static PyObject *__pyx_n_s_getstate;
2460 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2461 static PyObject *__pyx_n_s_id;
2462 static PyObject *__pyx_n_s_import;
2463 static PyObject *__pyx_n_s_int64;
2464 static PyObject *__pyx_n_s_itemsize;
2465 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2466 static PyObject *__pyx_n_s_main;
2467 static PyObject *__pyx_n_s_maxn;
2468 static PyObject *__pyx_n_s_memview;
2469 static PyObject *__pyx_n_s_mode;
2470 static PyObject *__pyx_n_s_name;
2471 static PyObject *__pyx_n_s_name_2;
2472 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
2473 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
2474 static PyObject *__pyx_n_s_ndim;
2475 static PyObject *__pyx_n_s_new;
2476 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2477 static PyObject *__pyx_n_s_np;
2478 static PyObject *__pyx_n_s_numpy;
2479 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2480 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2481 static PyObject *__pyx_n_s_obj;
2482 static PyObject *__pyx_n_s_pack;
2483 static PyObject *__pyx_n_s_periodicity;
2484 static PyObject *__pyx_n_s_pickle;
2485 static PyObject *__pyx_n_s_points;
2486 static PyObject *__pyx_n_s_pyx_PickleError;
2487 static PyObject *__pyx_n_s_pyx_checksum;
2488 static PyObject *__pyx_n_s_pyx_getbuffer;
2489 static PyObject *__pyx_n_s_pyx_result;
2490 static PyObject *__pyx_n_s_pyx_state;
2491 static PyObject *__pyx_n_s_pyx_type;
2492 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2493 static PyObject *__pyx_n_s_pyx_vtable;
2494 static PyObject *__pyx_n_s_range;
2495 static PyObject *__pyx_n_s_reduce;
2496 static PyObject *__pyx_n_s_reduce_cython;
2497 static PyObject *__pyx_n_s_reduce_ex;
2498 static PyObject *__pyx_n_s_setstate;
2499 static PyObject *__pyx_n_s_setstate_cython;
2500 static PyObject *__pyx_n_s_shape;
2501 static PyObject *__pyx_n_s_size;
2502 static PyObject *__pyx_n_s_start;
2503 static PyObject *__pyx_n_s_step;
2504 static PyObject *__pyx_n_s_stop;
2505 static PyObject *__pyx_kp_s_strided_and_direct;
2506 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2507 static PyObject *__pyx_kp_s_strided_and_indirect;
2508 static PyObject *__pyx_kp_s_stringsource;
2509 static PyObject *__pyx_n_s_struct;
2510 static PyObject *__pyx_n_s_test;
2511 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2512 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2513 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2514 static PyObject *__pyx_n_s_unpack;
2515 static PyObject *__pyx_n_s_update;
2516 static int __pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self, int __pyx_v_maxn); /* proto */
2517 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self); /* proto */
2518 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2519 static int __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, CYTHON_UNUSED int __pyx_v_maxn); /* proto */
2520 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_2setup(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, __Pyx_memviewslice __pyx_v_DW, PyObject *__pyx_v_periodicity); /* proto */
2521 static void __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_4__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self); /* proto */
2522 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_6find_nearest(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, __Pyx_memviewslice __pyx_v_center, __Pyx_memviewslice __pyx_v_points); /* proto */
2523 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self); /* proto */
2524 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2525 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2526 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
2527 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
2528 static 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 */
2529 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2530 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2531 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2532 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2533 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2534 static 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 */
2535 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2536 static 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 */
2537 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2538 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2539 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2540 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2541 static 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 */
2542 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2543 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2544 static 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 */
2545 static 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 */
2546 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2547 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2548 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2549 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2550 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2551 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2552 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2553 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2554 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2555 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2556 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2557 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2558 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2559 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2560 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2561 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2562 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2563 static 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 */
2564 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2565 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2566 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2567 static 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 */
2568 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2569 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14distance_queue_PriorityQueue(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2570 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14distance_queue_DistanceQueue(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2571 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2572 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2573 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2574 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2575 static PyObject *__pyx_int_0;
2576 static PyObject *__pyx_int_1;
2577 static PyObject *__pyx_int_184977713;
2578 static PyObject *__pyx_int_neg_1;
2579 static PyObject *__pyx_tuple_;
2580 static PyObject *__pyx_tuple__2;
2581 static PyObject *__pyx_tuple__3;
2582 static PyObject *__pyx_tuple__4;
2583 static PyObject *__pyx_tuple__5;
2584 static PyObject *__pyx_tuple__6;
2585 static PyObject *__pyx_tuple__7;
2586 static PyObject *__pyx_tuple__8;
2587 static PyObject *__pyx_tuple__9;
2588 static PyObject *__pyx_slice__26;
2589 static PyObject *__pyx_tuple__10;
2590 static PyObject *__pyx_tuple__11;
2591 static PyObject *__pyx_tuple__12;
2592 static PyObject *__pyx_tuple__13;
2593 static PyObject *__pyx_tuple__14;
2594 static PyObject *__pyx_tuple__15;
2595 static PyObject *__pyx_tuple__16;
2596 static PyObject *__pyx_tuple__17;
2597 static PyObject *__pyx_tuple__18;
2598 static PyObject *__pyx_tuple__19;
2599 static PyObject *__pyx_tuple__20;
2600 static PyObject *__pyx_tuple__21;
2601 static PyObject *__pyx_tuple__22;
2602 static PyObject *__pyx_tuple__23;
2603 static PyObject *__pyx_tuple__24;
2604 static PyObject *__pyx_tuple__25;
2605 static PyObject *__pyx_tuple__27;
2606 static PyObject *__pyx_tuple__28;
2607 static PyObject *__pyx_tuple__29;
2608 static PyObject *__pyx_tuple__30;
2609 static PyObject *__pyx_tuple__31;
2610 static PyObject *__pyx_tuple__32;
2611 static PyObject *__pyx_tuple__33;
2612 static PyObject *__pyx_tuple__34;
2613 static PyObject *__pyx_tuple__35;
2614 static PyObject *__pyx_codeobj__36;
2615 /* Late includes */
2616 
2617 /* "yt/utilities/lib/distance_queue.pyx":18
2618  *
2619  *
2620  * cdef int Neighbor_compare(void *on1, void *on2) nogil:             # <<<<<<<<<<<<<<
2621  *     cdef NeighborList *n1
2622  *     cdef NeighborList *n2
2623  */
2624 
__pyx_f_2yt_9utilities_3lib_14distance_queue_Neighbor_compare(void * __pyx_v_on1,void * __pyx_v_on2)2625 static int __pyx_f_2yt_9utilities_3lib_14distance_queue_Neighbor_compare(void *__pyx_v_on1, void *__pyx_v_on2) {
2626   struct __pyx_t_2yt_9utilities_3lib_14distance_queue_NeighborList *__pyx_v_n1;
2627   struct __pyx_t_2yt_9utilities_3lib_14distance_queue_NeighborList *__pyx_v_n2;
2628   int __pyx_r;
2629   int __pyx_t_1;
2630 
2631   /* "yt/utilities/lib/distance_queue.pyx":21
2632  *     cdef NeighborList *n1
2633  *     cdef NeighborList *n2
2634  *     n1 = <NeighborList *> on1             # <<<<<<<<<<<<<<
2635  *     n2 = <NeighborList *> on2
2636  *     # Note that we set this up so that "greatest" evaluates to the *end* of the
2637  */
2638   __pyx_v_n1 = ((struct __pyx_t_2yt_9utilities_3lib_14distance_queue_NeighborList *)__pyx_v_on1);
2639 
2640   /* "yt/utilities/lib/distance_queue.pyx":22
2641  *     cdef NeighborList *n2
2642  *     n1 = <NeighborList *> on1
2643  *     n2 = <NeighborList *> on2             # <<<<<<<<<<<<<<
2644  *     # Note that we set this up so that "greatest" evaluates to the *end* of the
2645  *     # list, so we can do standard radius comparisons.
2646  */
2647   __pyx_v_n2 = ((struct __pyx_t_2yt_9utilities_3lib_14distance_queue_NeighborList *)__pyx_v_on2);
2648 
2649   /* "yt/utilities/lib/distance_queue.pyx":25
2650  *     # Note that we set this up so that "greatest" evaluates to the *end* of the
2651  *     # list, so we can do standard radius comparisons.
2652  *     if n1.r2 < n2.r2:             # <<<<<<<<<<<<<<
2653  *         return -1
2654  *     elif n1.r2 == n2.r2:
2655  */
2656   __pyx_t_1 = ((__pyx_v_n1->r2 < __pyx_v_n2->r2) != 0);
2657   if (__pyx_t_1) {
2658 
2659     /* "yt/utilities/lib/distance_queue.pyx":26
2660  *     # list, so we can do standard radius comparisons.
2661  *     if n1.r2 < n2.r2:
2662  *         return -1             # <<<<<<<<<<<<<<
2663  *     elif n1.r2 == n2.r2:
2664  *         return 0
2665  */
2666     __pyx_r = -1;
2667     goto __pyx_L0;
2668 
2669     /* "yt/utilities/lib/distance_queue.pyx":25
2670  *     # Note that we set this up so that "greatest" evaluates to the *end* of the
2671  *     # list, so we can do standard radius comparisons.
2672  *     if n1.r2 < n2.r2:             # <<<<<<<<<<<<<<
2673  *         return -1
2674  *     elif n1.r2 == n2.r2:
2675  */
2676   }
2677 
2678   /* "yt/utilities/lib/distance_queue.pyx":27
2679  *     if n1.r2 < n2.r2:
2680  *         return -1
2681  *     elif n1.r2 == n2.r2:             # <<<<<<<<<<<<<<
2682  *         return 0
2683  *     else:
2684  */
2685   __pyx_t_1 = ((__pyx_v_n1->r2 == __pyx_v_n2->r2) != 0);
2686   if (__pyx_t_1) {
2687 
2688     /* "yt/utilities/lib/distance_queue.pyx":28
2689  *         return -1
2690  *     elif n1.r2 == n2.r2:
2691  *         return 0             # <<<<<<<<<<<<<<
2692  *     else:
2693  *         return 1
2694  */
2695     __pyx_r = 0;
2696     goto __pyx_L0;
2697 
2698     /* "yt/utilities/lib/distance_queue.pyx":27
2699  *     if n1.r2 < n2.r2:
2700  *         return -1
2701  *     elif n1.r2 == n2.r2:             # <<<<<<<<<<<<<<
2702  *         return 0
2703  *     else:
2704  */
2705   }
2706 
2707   /* "yt/utilities/lib/distance_queue.pyx":30
2708  *         return 0
2709  *     else:
2710  *         return 1             # <<<<<<<<<<<<<<
2711  *
2712  * @cython.cdivision(True)
2713  */
2714   /*else*/ {
2715     __pyx_r = 1;
2716     goto __pyx_L0;
2717   }
2718 
2719   /* "yt/utilities/lib/distance_queue.pyx":18
2720  *
2721  *
2722  * cdef int Neighbor_compare(void *on1, void *on2) nogil:             # <<<<<<<<<<<<<<
2723  *     cdef NeighborList *n1
2724  *     cdef NeighborList *n2
2725  */
2726 
2727   /* function exit code */
2728   __pyx_L0:;
2729   return __pyx_r;
2730 }
2731 
2732 /* "yt/utilities/lib/distance_queue.pyx":36
2733  * @cython.wraparound(False)
2734  * @cython.initializedcheck(False)
2735  * cdef np.float64_t r2dist(np.float64_t ppos[3],             # <<<<<<<<<<<<<<
2736  *                          np.float64_t cpos[3],
2737  *                          np.float64_t DW[3],
2738  */
2739 
__pyx_f_2yt_9utilities_3lib_14distance_queue_r2dist(__pyx_t_5numpy_float64_t * __pyx_v_ppos,__pyx_t_5numpy_float64_t * __pyx_v_cpos,__pyx_t_5numpy_float64_t * __pyx_v_DW,int * __pyx_v_periodicity,__pyx_t_5numpy_float64_t __pyx_v_max_dist2)2740 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_14distance_queue_r2dist(__pyx_t_5numpy_float64_t *__pyx_v_ppos, __pyx_t_5numpy_float64_t *__pyx_v_cpos, __pyx_t_5numpy_float64_t *__pyx_v_DW, int *__pyx_v_periodicity, __pyx_t_5numpy_float64_t __pyx_v_max_dist2) {
2741   int __pyx_v_i;
2742   __pyx_t_5numpy_float64_t __pyx_v_r2;
2743   __pyx_t_5numpy_float64_t __pyx_v_DR;
2744   __pyx_t_5numpy_float64_t __pyx_r;
2745   __Pyx_RefNannyDeclarations
2746   int __pyx_t_1;
2747   int __pyx_t_2;
2748   int __pyx_t_3;
2749   __Pyx_RefNannySetupContext("r2dist", 0);
2750 
2751   /* "yt/utilities/lib/distance_queue.pyx":43
2752  *     cdef int i
2753  *     cdef np.float64_t r2, DR
2754  *     r2 = 0.0             # <<<<<<<<<<<<<<
2755  *     for i in range(3):
2756  *         DR = (ppos[i] - cpos[i])
2757  */
2758   __pyx_v_r2 = 0.0;
2759 
2760   /* "yt/utilities/lib/distance_queue.pyx":44
2761  *     cdef np.float64_t r2, DR
2762  *     r2 = 0.0
2763  *     for i in range(3):             # <<<<<<<<<<<<<<
2764  *         DR = (ppos[i] - cpos[i])
2765  *         if not periodicity[i]:
2766  */
2767   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2768     __pyx_v_i = __pyx_t_1;
2769 
2770     /* "yt/utilities/lib/distance_queue.pyx":45
2771  *     r2 = 0.0
2772  *     for i in range(3):
2773  *         DR = (ppos[i] - cpos[i])             # <<<<<<<<<<<<<<
2774  *         if not periodicity[i]:
2775  *             pass
2776  */
2777     __pyx_v_DR = ((__pyx_v_ppos[__pyx_v_i]) - (__pyx_v_cpos[__pyx_v_i]));
2778 
2779     /* "yt/utilities/lib/distance_queue.pyx":46
2780  *     for i in range(3):
2781  *         DR = (ppos[i] - cpos[i])
2782  *         if not periodicity[i]:             # <<<<<<<<<<<<<<
2783  *             pass
2784  *         elif (DR > DW[i]/2.0):
2785  */
2786     __pyx_t_2 = ((!((__pyx_v_periodicity[__pyx_v_i]) != 0)) != 0);
2787     if (__pyx_t_2) {
2788       goto __pyx_L5;
2789     }
2790 
2791     /* "yt/utilities/lib/distance_queue.pyx":48
2792  *         if not periodicity[i]:
2793  *             pass
2794  *         elif (DR > DW[i]/2.0):             # <<<<<<<<<<<<<<
2795  *             DR -= DW[i]
2796  *         elif (DR < -DW[i]/2.0):
2797  */
2798     __pyx_t_2 = ((__pyx_v_DR > ((__pyx_v_DW[__pyx_v_i]) / 2.0)) != 0);
2799     if (__pyx_t_2) {
2800 
2801       /* "yt/utilities/lib/distance_queue.pyx":49
2802  *             pass
2803  *         elif (DR > DW[i]/2.0):
2804  *             DR -= DW[i]             # <<<<<<<<<<<<<<
2805  *         elif (DR < -DW[i]/2.0):
2806  *             DR += DW[i]
2807  */
2808       __pyx_v_DR = (__pyx_v_DR - (__pyx_v_DW[__pyx_v_i]));
2809 
2810       /* "yt/utilities/lib/distance_queue.pyx":48
2811  *         if not periodicity[i]:
2812  *             pass
2813  *         elif (DR > DW[i]/2.0):             # <<<<<<<<<<<<<<
2814  *             DR -= DW[i]
2815  *         elif (DR < -DW[i]/2.0):
2816  */
2817       goto __pyx_L5;
2818     }
2819 
2820     /* "yt/utilities/lib/distance_queue.pyx":50
2821  *         elif (DR > DW[i]/2.0):
2822  *             DR -= DW[i]
2823  *         elif (DR < -DW[i]/2.0):             # <<<<<<<<<<<<<<
2824  *             DR += DW[i]
2825  *         r2 += DR * DR
2826  */
2827     __pyx_t_2 = ((__pyx_v_DR < ((-(__pyx_v_DW[__pyx_v_i])) / 2.0)) != 0);
2828     if (__pyx_t_2) {
2829 
2830       /* "yt/utilities/lib/distance_queue.pyx":51
2831  *             DR -= DW[i]
2832  *         elif (DR < -DW[i]/2.0):
2833  *             DR += DW[i]             # <<<<<<<<<<<<<<
2834  *         r2 += DR * DR
2835  *         if max_dist2 >= 0.0 and r2 > max_dist2:
2836  */
2837       __pyx_v_DR = (__pyx_v_DR + (__pyx_v_DW[__pyx_v_i]));
2838 
2839       /* "yt/utilities/lib/distance_queue.pyx":50
2840  *         elif (DR > DW[i]/2.0):
2841  *             DR -= DW[i]
2842  *         elif (DR < -DW[i]/2.0):             # <<<<<<<<<<<<<<
2843  *             DR += DW[i]
2844  *         r2 += DR * DR
2845  */
2846     }
2847     __pyx_L5:;
2848 
2849     /* "yt/utilities/lib/distance_queue.pyx":52
2850  *         elif (DR < -DW[i]/2.0):
2851  *             DR += DW[i]
2852  *         r2 += DR * DR             # <<<<<<<<<<<<<<
2853  *         if max_dist2 >= 0.0 and r2 > max_dist2:
2854  *             return -1.0
2855  */
2856     __pyx_v_r2 = (__pyx_v_r2 + (__pyx_v_DR * __pyx_v_DR));
2857 
2858     /* "yt/utilities/lib/distance_queue.pyx":53
2859  *             DR += DW[i]
2860  *         r2 += DR * DR
2861  *         if max_dist2 >= 0.0 and r2 > max_dist2:             # <<<<<<<<<<<<<<
2862  *             return -1.0
2863  *     return r2
2864  */
2865     __pyx_t_3 = ((__pyx_v_max_dist2 >= 0.0) != 0);
2866     if (__pyx_t_3) {
2867     } else {
2868       __pyx_t_2 = __pyx_t_3;
2869       goto __pyx_L7_bool_binop_done;
2870     }
2871     __pyx_t_3 = ((__pyx_v_r2 > __pyx_v_max_dist2) != 0);
2872     __pyx_t_2 = __pyx_t_3;
2873     __pyx_L7_bool_binop_done:;
2874     if (__pyx_t_2) {
2875 
2876       /* "yt/utilities/lib/distance_queue.pyx":54
2877  *         r2 += DR * DR
2878  *         if max_dist2 >= 0.0 and r2 > max_dist2:
2879  *             return -1.0             # <<<<<<<<<<<<<<
2880  *     return r2
2881  *
2882  */
2883       __pyx_r = -1.0;
2884       goto __pyx_L0;
2885 
2886       /* "yt/utilities/lib/distance_queue.pyx":53
2887  *             DR += DW[i]
2888  *         r2 += DR * DR
2889  *         if max_dist2 >= 0.0 and r2 > max_dist2:             # <<<<<<<<<<<<<<
2890  *             return -1.0
2891  *     return r2
2892  */
2893     }
2894   }
2895 
2896   /* "yt/utilities/lib/distance_queue.pyx":55
2897  *         if max_dist2 >= 0.0 and r2 > max_dist2:
2898  *             return -1.0
2899  *     return r2             # <<<<<<<<<<<<<<
2900  *
2901  * cdef class PriorityQueue:
2902  */
2903   __pyx_r = __pyx_v_r2;
2904   goto __pyx_L0;
2905 
2906   /* "yt/utilities/lib/distance_queue.pyx":36
2907  * @cython.wraparound(False)
2908  * @cython.initializedcheck(False)
2909  * cdef np.float64_t r2dist(np.float64_t ppos[3],             # <<<<<<<<<<<<<<
2910  *                          np.float64_t cpos[3],
2911  *                          np.float64_t DW[3],
2912  */
2913 
2914   /* function exit code */
2915   __pyx_L0:;
2916   __Pyx_RefNannyFinishContext();
2917   return __pyx_r;
2918 }
2919 
2920 /* "yt/utilities/lib/distance_queue.pyx":68
2921  *     is because our typical use case is to store radii.
2922  *     """
2923  *     def __cinit__(self, int maxn):             # <<<<<<<<<<<<<<
2924  *         cdef int i
2925  *         self.maxn = maxn
2926  */
2927 
2928 /* Python wrapper */
2929 static int __pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2930 static int __pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2931   int __pyx_v_maxn;
2932   int __pyx_r;
2933   __Pyx_RefNannyDeclarations
2934   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2935   {
2936     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maxn,0};
2937     PyObject* values[1] = {0};
2938     if (unlikely(__pyx_kwds)) {
2939       Py_ssize_t kw_args;
2940       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2941       switch (pos_args) {
2942         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2943         CYTHON_FALLTHROUGH;
2944         case  0: break;
2945         default: goto __pyx_L5_argtuple_error;
2946       }
2947       kw_args = PyDict_Size(__pyx_kwds);
2948       switch (pos_args) {
2949         case  0:
2950         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxn)) != 0)) kw_args--;
2951         else goto __pyx_L5_argtuple_error;
2952       }
2953       if (unlikely(kw_args > 0)) {
2954         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 68, __pyx_L3_error)
2955       }
2956     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
2957       goto __pyx_L5_argtuple_error;
2958     } else {
2959       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2960     }
2961     __pyx_v_maxn = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_maxn == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L3_error)
2962   }
2963   goto __pyx_L4_argument_unpacking_done;
2964   __pyx_L5_argtuple_error:;
2965   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 68, __pyx_L3_error)
2966   __pyx_L3_error:;
2967   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.PriorityQueue.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2968   __Pyx_RefNannyFinishContext();
2969   return -1;
2970   __pyx_L4_argument_unpacking_done:;
2971   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *)__pyx_v_self), __pyx_v_maxn);
2972 
2973   /* function exit code */
2974   __Pyx_RefNannyFinishContext();
2975   return __pyx_r;
2976 }
2977 
__pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue * __pyx_v_self,int __pyx_v_maxn)2978 static int __pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self, int __pyx_v_maxn) {
2979   int __pyx_r;
2980   __Pyx_RefNannyDeclarations
2981   __Pyx_RefNannySetupContext("__cinit__", 0);
2982 
2983   /* "yt/utilities/lib/distance_queue.pyx":70
2984  *     def __cinit__(self, int maxn):
2985  *         cdef int i
2986  *         self.maxn = maxn             # <<<<<<<<<<<<<<
2987  *         self.curn = 0
2988  *         self.items = <ItemList *> malloc(
2989  */
2990   __pyx_v_self->maxn = __pyx_v_maxn;
2991 
2992   /* "yt/utilities/lib/distance_queue.pyx":71
2993  *         cdef int i
2994  *         self.maxn = maxn
2995  *         self.curn = 0             # <<<<<<<<<<<<<<
2996  *         self.items = <ItemList *> malloc(
2997  *             sizeof(ItemList) * self.maxn)
2998  */
2999   __pyx_v_self->curn = 0;
3000 
3001   /* "yt/utilities/lib/distance_queue.pyx":72
3002  *         self.maxn = maxn
3003  *         self.curn = 0
3004  *         self.items = <ItemList *> malloc(             # <<<<<<<<<<<<<<
3005  *             sizeof(ItemList) * self.maxn)
3006  *
3007  */
3008   __pyx_v_self->items = ((struct __pyx_t_2yt_9utilities_3lib_14distance_queue_ItemList *)malloc(((sizeof(struct __pyx_t_2yt_9utilities_3lib_14distance_queue_ItemList)) * __pyx_v_self->maxn)));
3009 
3010   /* "yt/utilities/lib/distance_queue.pyx":68
3011  *     is because our typical use case is to store radii.
3012  *     """
3013  *     def __cinit__(self, int maxn):             # <<<<<<<<<<<<<<
3014  *         cdef int i
3015  *         self.maxn = maxn
3016  */
3017 
3018   /* function exit code */
3019   __pyx_r = 0;
3020   __Pyx_RefNannyFinishContext();
3021   return __pyx_r;
3022 }
3023 
3024 /* "yt/utilities/lib/distance_queue.pyx":75
3025  *             sizeof(ItemList) * self.maxn)
3026  *
3027  *     cdef void item_reset(self):             # <<<<<<<<<<<<<<
3028  *         for i in range(self.maxn):
3029  *             self.items[i].value = 1e300
3030  */
3031 
__pyx_f_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_item_reset(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue * __pyx_v_self)3032 static void __pyx_f_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_item_reset(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self) {
3033   int __pyx_v_i;
3034   __Pyx_RefNannyDeclarations
3035   int __pyx_t_1;
3036   int __pyx_t_2;
3037   int __pyx_t_3;
3038   __Pyx_RefNannySetupContext("item_reset", 0);
3039 
3040   /* "yt/utilities/lib/distance_queue.pyx":76
3041  *
3042  *     cdef void item_reset(self):
3043  *         for i in range(self.maxn):             # <<<<<<<<<<<<<<
3044  *             self.items[i].value = 1e300
3045  *             self.items[i].ind = -1
3046  */
3047   __pyx_t_1 = __pyx_v_self->maxn;
3048   __pyx_t_2 = __pyx_t_1;
3049   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3050     __pyx_v_i = __pyx_t_3;
3051 
3052     /* "yt/utilities/lib/distance_queue.pyx":77
3053  *     cdef void item_reset(self):
3054  *         for i in range(self.maxn):
3055  *             self.items[i].value = 1e300             # <<<<<<<<<<<<<<
3056  *             self.items[i].ind = -1
3057  *         self.curn = 0
3058  */
3059     (__pyx_v_self->items[__pyx_v_i]).value = 1e300;
3060 
3061     /* "yt/utilities/lib/distance_queue.pyx":78
3062  *         for i in range(self.maxn):
3063  *             self.items[i].value = 1e300
3064  *             self.items[i].ind = -1             # <<<<<<<<<<<<<<
3065  *         self.curn = 0
3066  *
3067  */
3068     (__pyx_v_self->items[__pyx_v_i]).ind = -1LL;
3069   }
3070 
3071   /* "yt/utilities/lib/distance_queue.pyx":79
3072  *             self.items[i].value = 1e300
3073  *             self.items[i].ind = -1
3074  *         self.curn = 0             # <<<<<<<<<<<<<<
3075  *
3076  *     cdef int item_insert(self, np.int64_t ind, np.float64_t value):
3077  */
3078   __pyx_v_self->curn = 0;
3079 
3080   /* "yt/utilities/lib/distance_queue.pyx":75
3081  *             sizeof(ItemList) * self.maxn)
3082  *
3083  *     cdef void item_reset(self):             # <<<<<<<<<<<<<<
3084  *         for i in range(self.maxn):
3085  *             self.items[i].value = 1e300
3086  */
3087 
3088   /* function exit code */
3089   __Pyx_RefNannyFinishContext();
3090 }
3091 
3092 /* "yt/utilities/lib/distance_queue.pyx":81
3093  *         self.curn = 0
3094  *
3095  *     cdef int item_insert(self, np.int64_t ind, np.float64_t value):             # <<<<<<<<<<<<<<
3096  *         cdef int i, di
3097  *         if self.curn == 0:
3098  */
3099 
__pyx_f_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_item_insert(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue * __pyx_v_self,__pyx_t_5numpy_int64_t __pyx_v_ind,__pyx_t_5numpy_float64_t __pyx_v_value)3100 static int __pyx_f_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_item_insert(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_ind, __pyx_t_5numpy_float64_t __pyx_v_value) {
3101   int __pyx_v_i;
3102   int __pyx_v_di;
3103   int __pyx_r;
3104   __Pyx_RefNannyDeclarations
3105   int __pyx_t_1;
3106   int __pyx_t_2;
3107   __Pyx_RefNannySetupContext("item_insert", 0);
3108 
3109   /* "yt/utilities/lib/distance_queue.pyx":83
3110  *     cdef int item_insert(self, np.int64_t ind, np.float64_t value):
3111  *         cdef int i, di
3112  *         if self.curn == 0:             # <<<<<<<<<<<<<<
3113  *             self.items[0].value = value
3114  *             self.items[0].ind = ind
3115  */
3116   __pyx_t_1 = ((__pyx_v_self->curn == 0) != 0);
3117   if (__pyx_t_1) {
3118 
3119     /* "yt/utilities/lib/distance_queue.pyx":84
3120  *         cdef int i, di
3121  *         if self.curn == 0:
3122  *             self.items[0].value = value             # <<<<<<<<<<<<<<
3123  *             self.items[0].ind = ind
3124  *             self.curn += 1
3125  */
3126     (__pyx_v_self->items[0]).value = __pyx_v_value;
3127 
3128     /* "yt/utilities/lib/distance_queue.pyx":85
3129  *         if self.curn == 0:
3130  *             self.items[0].value = value
3131  *             self.items[0].ind = ind             # <<<<<<<<<<<<<<
3132  *             self.curn += 1
3133  *             return 0
3134  */
3135     (__pyx_v_self->items[0]).ind = __pyx_v_ind;
3136 
3137     /* "yt/utilities/lib/distance_queue.pyx":86
3138  *             self.items[0].value = value
3139  *             self.items[0].ind = ind
3140  *             self.curn += 1             # <<<<<<<<<<<<<<
3141  *             return 0
3142  *         # Now insert in a sorted way
3143  */
3144     __pyx_v_self->curn = (__pyx_v_self->curn + 1);
3145 
3146     /* "yt/utilities/lib/distance_queue.pyx":87
3147  *             self.items[0].ind = ind
3148  *             self.curn += 1
3149  *             return 0             # <<<<<<<<<<<<<<
3150  *         # Now insert in a sorted way
3151  *         di = -1
3152  */
3153     __pyx_r = 0;
3154     goto __pyx_L0;
3155 
3156     /* "yt/utilities/lib/distance_queue.pyx":83
3157  *     cdef int item_insert(self, np.int64_t ind, np.float64_t value):
3158  *         cdef int i, di
3159  *         if self.curn == 0:             # <<<<<<<<<<<<<<
3160  *             self.items[0].value = value
3161  *             self.items[0].ind = ind
3162  */
3163   }
3164 
3165   /* "yt/utilities/lib/distance_queue.pyx":89
3166  *             return 0
3167  *         # Now insert in a sorted way
3168  *         di = -1             # <<<<<<<<<<<<<<
3169  *         for i in range(self.curn - 1, -1, -1):
3170  *             # We are checking if i is less than us, to see if we should insert
3171  */
3172   __pyx_v_di = -1;
3173 
3174   /* "yt/utilities/lib/distance_queue.pyx":90
3175  *         # Now insert in a sorted way
3176  *         di = -1
3177  *         for i in range(self.curn - 1, -1, -1):             # <<<<<<<<<<<<<<
3178  *             # We are checking if i is less than us, to see if we should insert
3179  *             # to the right (i.e., i+1).
3180  */
3181   for (__pyx_t_2 = (__pyx_v_self->curn - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
3182     __pyx_v_i = __pyx_t_2;
3183 
3184     /* "yt/utilities/lib/distance_queue.pyx":93
3185  *             # We are checking if i is less than us, to see if we should insert
3186  *             # to the right (i.e., i+1).
3187  *             if self.items[i].value < value:             # <<<<<<<<<<<<<<
3188  *                 di = i
3189  *                 break
3190  */
3191     __pyx_t_1 = (((__pyx_v_self->items[__pyx_v_i]).value < __pyx_v_value) != 0);
3192     if (__pyx_t_1) {
3193 
3194       /* "yt/utilities/lib/distance_queue.pyx":94
3195  *             # to the right (i.e., i+1).
3196  *             if self.items[i].value < value:
3197  *                 di = i             # <<<<<<<<<<<<<<
3198  *                 break
3199  *         # The outermost one is already too small.
3200  */
3201       __pyx_v_di = __pyx_v_i;
3202 
3203       /* "yt/utilities/lib/distance_queue.pyx":95
3204  *             if self.items[i].value < value:
3205  *                 di = i
3206  *                 break             # <<<<<<<<<<<<<<
3207  *         # The outermost one is already too small.
3208  *         if di == self.maxn - 1:
3209  */
3210       goto __pyx_L5_break;
3211 
3212       /* "yt/utilities/lib/distance_queue.pyx":93
3213  *             # We are checking if i is less than us, to see if we should insert
3214  *             # to the right (i.e., i+1).
3215  *             if self.items[i].value < value:             # <<<<<<<<<<<<<<
3216  *                 di = i
3217  *                 break
3218  */
3219     }
3220   }
3221   __pyx_L5_break:;
3222 
3223   /* "yt/utilities/lib/distance_queue.pyx":97
3224  *                 break
3225  *         # The outermost one is already too small.
3226  *         if di == self.maxn - 1:             # <<<<<<<<<<<<<<
3227  *             return -1
3228  *         if (self.maxn - (di + 2)) > 0:
3229  */
3230   __pyx_t_1 = ((__pyx_v_di == (__pyx_v_self->maxn - 1)) != 0);
3231   if (__pyx_t_1) {
3232 
3233     /* "yt/utilities/lib/distance_queue.pyx":98
3234  *         # The outermost one is already too small.
3235  *         if di == self.maxn - 1:
3236  *             return -1             # <<<<<<<<<<<<<<
3237  *         if (self.maxn - (di + 2)) > 0:
3238  *             memmove(<void *> (self.items + di + 2),
3239  */
3240     __pyx_r = -1;
3241     goto __pyx_L0;
3242 
3243     /* "yt/utilities/lib/distance_queue.pyx":97
3244  *                 break
3245  *         # The outermost one is already too small.
3246  *         if di == self.maxn - 1:             # <<<<<<<<<<<<<<
3247  *             return -1
3248  *         if (self.maxn - (di + 2)) > 0:
3249  */
3250   }
3251 
3252   /* "yt/utilities/lib/distance_queue.pyx":99
3253  *         if di == self.maxn - 1:
3254  *             return -1
3255  *         if (self.maxn - (di + 2)) > 0:             # <<<<<<<<<<<<<<
3256  *             memmove(<void *> (self.items + di + 2),
3257  *                     <void *> (self.items + di + 1),
3258  */
3259   __pyx_t_1 = (((__pyx_v_self->maxn - (__pyx_v_di + 2)) > 0) != 0);
3260   if (__pyx_t_1) {
3261 
3262     /* "yt/utilities/lib/distance_queue.pyx":100
3263  *             return -1
3264  *         if (self.maxn - (di + 2)) > 0:
3265  *             memmove(<void *> (self.items + di + 2),             # <<<<<<<<<<<<<<
3266  *                     <void *> (self.items + di + 1),
3267  *                     sizeof(ItemList) * (self.maxn - (di + 2)))
3268  */
3269     (void)(memmove(((void *)((__pyx_v_self->items + __pyx_v_di) + 2)), ((void *)((__pyx_v_self->items + __pyx_v_di) + 1)), ((sizeof(struct __pyx_t_2yt_9utilities_3lib_14distance_queue_ItemList)) * (__pyx_v_self->maxn - (__pyx_v_di + 2)))));
3270 
3271     /* "yt/utilities/lib/distance_queue.pyx":99
3272  *         if di == self.maxn - 1:
3273  *             return -1
3274  *         if (self.maxn - (di + 2)) > 0:             # <<<<<<<<<<<<<<
3275  *             memmove(<void *> (self.items + di + 2),
3276  *                     <void *> (self.items + di + 1),
3277  */
3278   }
3279 
3280   /* "yt/utilities/lib/distance_queue.pyx":103
3281  *                     <void *> (self.items + di + 1),
3282  *                     sizeof(ItemList) * (self.maxn - (di + 2)))
3283  *         self.items[di + 1].value = value             # <<<<<<<<<<<<<<
3284  *         self.items[di + 1].ind = ind
3285  *         if self.curn < self.maxn:
3286  */
3287   (__pyx_v_self->items[(__pyx_v_di + 1)]).value = __pyx_v_value;
3288 
3289   /* "yt/utilities/lib/distance_queue.pyx":104
3290  *                     sizeof(ItemList) * (self.maxn - (di + 2)))
3291  *         self.items[di + 1].value = value
3292  *         self.items[di + 1].ind = ind             # <<<<<<<<<<<<<<
3293  *         if self.curn < self.maxn:
3294  *             self.curn += 1
3295  */
3296   (__pyx_v_self->items[(__pyx_v_di + 1)]).ind = __pyx_v_ind;
3297 
3298   /* "yt/utilities/lib/distance_queue.pyx":105
3299  *         self.items[di + 1].value = value
3300  *         self.items[di + 1].ind = ind
3301  *         if self.curn < self.maxn:             # <<<<<<<<<<<<<<
3302  *             self.curn += 1
3303  *         return di + 1
3304  */
3305   __pyx_t_1 = ((__pyx_v_self->curn < __pyx_v_self->maxn) != 0);
3306   if (__pyx_t_1) {
3307 
3308     /* "yt/utilities/lib/distance_queue.pyx":106
3309  *         self.items[di + 1].ind = ind
3310  *         if self.curn < self.maxn:
3311  *             self.curn += 1             # <<<<<<<<<<<<<<
3312  *         return di + 1
3313  *
3314  */
3315     __pyx_v_self->curn = (__pyx_v_self->curn + 1);
3316 
3317     /* "yt/utilities/lib/distance_queue.pyx":105
3318  *         self.items[di + 1].value = value
3319  *         self.items[di + 1].ind = ind
3320  *         if self.curn < self.maxn:             # <<<<<<<<<<<<<<
3321  *             self.curn += 1
3322  *         return di + 1
3323  */
3324   }
3325 
3326   /* "yt/utilities/lib/distance_queue.pyx":107
3327  *         if self.curn < self.maxn:
3328  *             self.curn += 1
3329  *         return di + 1             # <<<<<<<<<<<<<<
3330  *
3331  * cdef class DistanceQueue:
3332  */
3333   __pyx_r = (__pyx_v_di + 1);
3334   goto __pyx_L0;
3335 
3336   /* "yt/utilities/lib/distance_queue.pyx":81
3337  *         self.curn = 0
3338  *
3339  *     cdef int item_insert(self, np.int64_t ind, np.float64_t value):             # <<<<<<<<<<<<<<
3340  *         cdef int i, di
3341  *         if self.curn == 0:
3342  */
3343 
3344   /* function exit code */
3345   __pyx_L0:;
3346   __Pyx_RefNannyFinishContext();
3347   return __pyx_r;
3348 }
3349 
3350 /* "(tree fragment)":1
3351  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3352  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3353  * def __setstate_cython__(self, __pyx_state):
3354  */
3355 
3356 /* Python wrapper */
3357 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_3__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3358 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3359   PyObject *__pyx_r = 0;
3360   __Pyx_RefNannyDeclarations
3361   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3362   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_2__reduce_cython__(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *)__pyx_v_self));
3363 
3364   /* function exit code */
3365   __Pyx_RefNannyFinishContext();
3366   return __pyx_r;
3367 }
3368 
__pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue * __pyx_v_self)3369 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self) {
3370   PyObject *__pyx_r = NULL;
3371   __Pyx_RefNannyDeclarations
3372   PyObject *__pyx_t_1 = NULL;
3373   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3374 
3375   /* "(tree fragment)":2
3376  * def __reduce_cython__(self):
3377  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
3378  * def __setstate_cython__(self, __pyx_state):
3379  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3380  */
3381   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
3382   __Pyx_GOTREF(__pyx_t_1);
3383   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3384   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3385   __PYX_ERR(1, 2, __pyx_L1_error)
3386 
3387   /* "(tree fragment)":1
3388  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
3389  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3390  * def __setstate_cython__(self, __pyx_state):
3391  */
3392 
3393   /* function exit code */
3394   __pyx_L1_error:;
3395   __Pyx_XDECREF(__pyx_t_1);
3396   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.PriorityQueue.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3397   __pyx_r = NULL;
3398   __Pyx_XGIVEREF(__pyx_r);
3399   __Pyx_RefNannyFinishContext();
3400   return __pyx_r;
3401 }
3402 
3403 /* "(tree fragment)":3
3404  * def __reduce_cython__(self):
3405  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3406  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3407  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3408  */
3409 
3410 /* Python wrapper */
3411 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_5__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3412 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3413   PyObject *__pyx_r = 0;
3414   __Pyx_RefNannyDeclarations
3415   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3416   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_4__setstate_cython__(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3417 
3418   /* function exit code */
3419   __Pyx_RefNannyFinishContext();
3420   return __pyx_r;
3421 }
3422 
__pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)3423 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3424   PyObject *__pyx_r = NULL;
3425   __Pyx_RefNannyDeclarations
3426   PyObject *__pyx_t_1 = NULL;
3427   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3428 
3429   /* "(tree fragment)":4
3430  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3431  * def __setstate_cython__(self, __pyx_state):
3432  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
3433  */
3434   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
3435   __Pyx_GOTREF(__pyx_t_1);
3436   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3437   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3438   __PYX_ERR(1, 4, __pyx_L1_error)
3439 
3440   /* "(tree fragment)":3
3441  * def __reduce_cython__(self):
3442  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3443  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
3444  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
3445  */
3446 
3447   /* function exit code */
3448   __pyx_L1_error:;
3449   __Pyx_XDECREF(__pyx_t_1);
3450   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.PriorityQueue.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3451   __pyx_r = NULL;
3452   __Pyx_XGIVEREF(__pyx_r);
3453   __Pyx_RefNannyFinishContext();
3454   return __pyx_r;
3455 }
3456 
3457 /* "yt/utilities/lib/distance_queue.pyx":113
3458  *     positions against a reference point.  It is initialized with the maximum
3459  *     number that are to be retained (i.e., maxn-nearest neighbors)."""
3460  *     def __cinit__(self, int maxn):             # <<<<<<<<<<<<<<
3461  *         if sizeof(ItemList) != sizeof(NeighborList):
3462  *             # This should almost never, ever happen unless we do something very
3463  */
3464 
3465 /* Python wrapper */
3466 static int __pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3467 static int __pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3468   CYTHON_UNUSED int __pyx_v_maxn;
3469   int __pyx_r;
3470   __Pyx_RefNannyDeclarations
3471   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
3472   {
3473     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maxn,0};
3474     PyObject* values[1] = {0};
3475     if (unlikely(__pyx_kwds)) {
3476       Py_ssize_t kw_args;
3477       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3478       switch (pos_args) {
3479         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3480         CYTHON_FALLTHROUGH;
3481         case  0: break;
3482         default: goto __pyx_L5_argtuple_error;
3483       }
3484       kw_args = PyDict_Size(__pyx_kwds);
3485       switch (pos_args) {
3486         case  0:
3487         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxn)) != 0)) kw_args--;
3488         else goto __pyx_L5_argtuple_error;
3489       }
3490       if (unlikely(kw_args > 0)) {
3491         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 113, __pyx_L3_error)
3492       }
3493     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
3494       goto __pyx_L5_argtuple_error;
3495     } else {
3496       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3497     }
3498     __pyx_v_maxn = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_maxn == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error)
3499   }
3500   goto __pyx_L4_argument_unpacking_done;
3501   __pyx_L5_argtuple_error:;
3502   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 113, __pyx_L3_error)
3503   __pyx_L3_error:;
3504   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.DistanceQueue.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3505   __Pyx_RefNannyFinishContext();
3506   return -1;
3507   __pyx_L4_argument_unpacking_done:;
3508   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self), __pyx_v_maxn);
3509 
3510   /* function exit code */
3511   __Pyx_RefNannyFinishContext();
3512   return __pyx_r;
3513 }
3514 
__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue * __pyx_v_self,CYTHON_UNUSED int __pyx_v_maxn)3515 static int __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue___cinit__(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, CYTHON_UNUSED int __pyx_v_maxn) {
3516   long __pyx_v_i;
3517   int __pyx_r;
3518   __Pyx_RefNannyDeclarations
3519   int __pyx_t_1;
3520   long __pyx_t_2;
3521   __Pyx_RefNannySetupContext("__cinit__", 0);
3522 
3523   /* "yt/utilities/lib/distance_queue.pyx":114
3524  *     number that are to be retained (i.e., maxn-nearest neighbors)."""
3525  *     def __cinit__(self, int maxn):
3526  *         if sizeof(ItemList) != sizeof(NeighborList):             # <<<<<<<<<<<<<<
3527  *             # This should almost never, ever happen unless we do something very
3528  *             # wrong, and must be broken at compile time.
3529  */
3530   __pyx_t_1 = (((sizeof(struct __pyx_t_2yt_9utilities_3lib_14distance_queue_ItemList)) != (sizeof(struct __pyx_t_2yt_9utilities_3lib_14distance_queue_NeighborList))) != 0);
3531   if (unlikely(__pyx_t_1)) {
3532 
3533     /* "yt/utilities/lib/distance_queue.pyx":117
3534  *             # This should almost never, ever happen unless we do something very
3535  *             # wrong, and must be broken at compile time.
3536  *             raise RuntimeError             # <<<<<<<<<<<<<<
3537  *         self.neighbors = <NeighborList *> self.items
3538  *         self.neighbor_reset()
3539  */
3540     __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0, 0);
3541     __PYX_ERR(0, 117, __pyx_L1_error)
3542 
3543     /* "yt/utilities/lib/distance_queue.pyx":114
3544  *     number that are to be retained (i.e., maxn-nearest neighbors)."""
3545  *     def __cinit__(self, int maxn):
3546  *         if sizeof(ItemList) != sizeof(NeighborList):             # <<<<<<<<<<<<<<
3547  *             # This should almost never, ever happen unless we do something very
3548  *             # wrong, and must be broken at compile time.
3549  */
3550   }
3551 
3552   /* "yt/utilities/lib/distance_queue.pyx":118
3553  *             # wrong, and must be broken at compile time.
3554  *             raise RuntimeError
3555  *         self.neighbors = <NeighborList *> self.items             # <<<<<<<<<<<<<<
3556  *         self.neighbor_reset()
3557  *         for i in range(3):
3558  */
3559   __pyx_v_self->neighbors = ((struct __pyx_t_2yt_9utilities_3lib_14distance_queue_NeighborList *)__pyx_v_self->__pyx_base.items);
3560 
3561   /* "yt/utilities/lib/distance_queue.pyx":119
3562  *             raise RuntimeError
3563  *         self.neighbors = <NeighborList *> self.items
3564  *         self.neighbor_reset()             # <<<<<<<<<<<<<<
3565  *         for i in range(3):
3566  *             self.DW[i] = 0
3567  */
3568   ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self->__pyx_base.__pyx_vtab)->neighbor_reset(__pyx_v_self);
3569 
3570   /* "yt/utilities/lib/distance_queue.pyx":120
3571  *         self.neighbors = <NeighborList *> self.items
3572  *         self.neighbor_reset()
3573  *         for i in range(3):             # <<<<<<<<<<<<<<
3574  *             self.DW[i] = 0
3575  *             self.periodicity[i] = False
3576  */
3577   for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
3578     __pyx_v_i = __pyx_t_2;
3579 
3580     /* "yt/utilities/lib/distance_queue.pyx":121
3581  *         self.neighbor_reset()
3582  *         for i in range(3):
3583  *             self.DW[i] = 0             # <<<<<<<<<<<<<<
3584  *             self.periodicity[i] = False
3585  *
3586  */
3587     (__pyx_v_self->DW[__pyx_v_i]) = 0.0;
3588 
3589     /* "yt/utilities/lib/distance_queue.pyx":122
3590  *         for i in range(3):
3591  *             self.DW[i] = 0
3592  *             self.periodicity[i] = False             # <<<<<<<<<<<<<<
3593  *
3594  *     cdef void _setup(self, np.float64_t DW[3], bint periodicity[3]):
3595  */
3596     (__pyx_v_self->periodicity[__pyx_v_i]) = 0;
3597   }
3598 
3599   /* "yt/utilities/lib/distance_queue.pyx":113
3600  *     positions against a reference point.  It is initialized with the maximum
3601  *     number that are to be retained (i.e., maxn-nearest neighbors)."""
3602  *     def __cinit__(self, int maxn):             # <<<<<<<<<<<<<<
3603  *         if sizeof(ItemList) != sizeof(NeighborList):
3604  *             # This should almost never, ever happen unless we do something very
3605  */
3606 
3607   /* function exit code */
3608   __pyx_r = 0;
3609   goto __pyx_L0;
3610   __pyx_L1_error:;
3611   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.DistanceQueue.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3612   __pyx_r = -1;
3613   __pyx_L0:;
3614   __Pyx_RefNannyFinishContext();
3615   return __pyx_r;
3616 }
3617 
3618 /* "yt/utilities/lib/distance_queue.pyx":124
3619  *             self.periodicity[i] = False
3620  *
3621  *     cdef void _setup(self, np.float64_t DW[3], bint periodicity[3]):             # <<<<<<<<<<<<<<
3622  *         for i in range(3):
3623  *             self.DW[i] = DW[i]
3624  */
3625 
__pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue__setup(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue * __pyx_v_self,__pyx_t_5numpy_float64_t * __pyx_v_DW,int * __pyx_v_periodicity)3626 static void __pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue__setup(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_DW, int *__pyx_v_periodicity) {
3627   long __pyx_v_i;
3628   __Pyx_RefNannyDeclarations
3629   long __pyx_t_1;
3630   __Pyx_RefNannySetupContext("_setup", 0);
3631 
3632   /* "yt/utilities/lib/distance_queue.pyx":125
3633  *
3634  *     cdef void _setup(self, np.float64_t DW[3], bint periodicity[3]):
3635  *         for i in range(3):             # <<<<<<<<<<<<<<
3636  *             self.DW[i] = DW[i]
3637  *             self.periodicity[i] = periodicity[i]
3638  */
3639   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3640     __pyx_v_i = __pyx_t_1;
3641 
3642     /* "yt/utilities/lib/distance_queue.pyx":126
3643  *     cdef void _setup(self, np.float64_t DW[3], bint periodicity[3]):
3644  *         for i in range(3):
3645  *             self.DW[i] = DW[i]             # <<<<<<<<<<<<<<
3646  *             self.periodicity[i] = periodicity[i]
3647  *
3648  */
3649     (__pyx_v_self->DW[__pyx_v_i]) = (__pyx_v_DW[__pyx_v_i]);
3650 
3651     /* "yt/utilities/lib/distance_queue.pyx":127
3652  *         for i in range(3):
3653  *             self.DW[i] = DW[i]
3654  *             self.periodicity[i] = periodicity[i]             # <<<<<<<<<<<<<<
3655  *
3656  *     def setup(self, np.float64_t[:] DW, periodicity):
3657  */
3658     (__pyx_v_self->periodicity[__pyx_v_i]) = (__pyx_v_periodicity[__pyx_v_i]);
3659   }
3660 
3661   /* "yt/utilities/lib/distance_queue.pyx":124
3662  *             self.periodicity[i] = False
3663  *
3664  *     cdef void _setup(self, np.float64_t DW[3], bint periodicity[3]):             # <<<<<<<<<<<<<<
3665  *         for i in range(3):
3666  *             self.DW[i] = DW[i]
3667  */
3668 
3669   /* function exit code */
3670   __Pyx_RefNannyFinishContext();
3671 }
3672 
3673 /* "yt/utilities/lib/distance_queue.pyx":129
3674  *             self.periodicity[i] = periodicity[i]
3675  *
3676  *     def setup(self, np.float64_t[:] DW, periodicity):             # <<<<<<<<<<<<<<
3677  *         for i in range(3):
3678  *             self.DW[i] = DW[i]
3679  */
3680 
3681 /* Python wrapper */
3682 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_3setup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_3setup(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3683 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_3setup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3684   __Pyx_memviewslice __pyx_v_DW = { 0, 0, { 0 }, { 0 }, { 0 } };
3685   PyObject *__pyx_v_periodicity = 0;
3686   PyObject *__pyx_r = 0;
3687   __Pyx_RefNannyDeclarations
3688   __Pyx_RefNannySetupContext("setup (wrapper)", 0);
3689   {
3690     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_DW,&__pyx_n_s_periodicity,0};
3691     PyObject* values[2] = {0,0};
3692     if (unlikely(__pyx_kwds)) {
3693       Py_ssize_t kw_args;
3694       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3695       switch (pos_args) {
3696         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3697         CYTHON_FALLTHROUGH;
3698         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3699         CYTHON_FALLTHROUGH;
3700         case  0: break;
3701         default: goto __pyx_L5_argtuple_error;
3702       }
3703       kw_args = PyDict_Size(__pyx_kwds);
3704       switch (pos_args) {
3705         case  0:
3706         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_DW)) != 0)) kw_args--;
3707         else goto __pyx_L5_argtuple_error;
3708         CYTHON_FALLTHROUGH;
3709         case  1:
3710         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_periodicity)) != 0)) kw_args--;
3711         else {
3712           __Pyx_RaiseArgtupleInvalid("setup", 1, 2, 2, 1); __PYX_ERR(0, 129, __pyx_L3_error)
3713         }
3714       }
3715       if (unlikely(kw_args > 0)) {
3716         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setup") < 0)) __PYX_ERR(0, 129, __pyx_L3_error)
3717       }
3718     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3719       goto __pyx_L5_argtuple_error;
3720     } else {
3721       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3722       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3723     }
3724     __pyx_v_DW = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_DW.memview)) __PYX_ERR(0, 129, __pyx_L3_error)
3725     __pyx_v_periodicity = values[1];
3726   }
3727   goto __pyx_L4_argument_unpacking_done;
3728   __pyx_L5_argtuple_error:;
3729   __Pyx_RaiseArgtupleInvalid("setup", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 129, __pyx_L3_error)
3730   __pyx_L3_error:;
3731   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.DistanceQueue.setup", __pyx_clineno, __pyx_lineno, __pyx_filename);
3732   __Pyx_RefNannyFinishContext();
3733   return NULL;
3734   __pyx_L4_argument_unpacking_done:;
3735   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_2setup(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self), __pyx_v_DW, __pyx_v_periodicity);
3736 
3737   /* function exit code */
3738   __Pyx_RefNannyFinishContext();
3739   return __pyx_r;
3740 }
3741 
__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_2setup(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue * __pyx_v_self,__Pyx_memviewslice __pyx_v_DW,PyObject * __pyx_v_periodicity)3742 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_2setup(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, __Pyx_memviewslice __pyx_v_DW, PyObject *__pyx_v_periodicity) {
3743   long __pyx_v_i;
3744   PyObject *__pyx_r = NULL;
3745   __Pyx_RefNannyDeclarations
3746   long __pyx_t_1;
3747   Py_ssize_t __pyx_t_2;
3748   int __pyx_t_3;
3749   PyObject *__pyx_t_4 = NULL;
3750   int __pyx_t_5;
3751   __Pyx_RefNannySetupContext("setup", 0);
3752 
3753   /* "yt/utilities/lib/distance_queue.pyx":130
3754  *
3755  *     def setup(self, np.float64_t[:] DW, periodicity):
3756  *         for i in range(3):             # <<<<<<<<<<<<<<
3757  *             self.DW[i] = DW[i]
3758  *             self.periodicity[i] = periodicity[i]
3759  */
3760   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3761     __pyx_v_i = __pyx_t_1;
3762 
3763     /* "yt/utilities/lib/distance_queue.pyx":131
3764  *     def setup(self, np.float64_t[:] DW, periodicity):
3765  *         for i in range(3):
3766  *             self.DW[i] = DW[i]             # <<<<<<<<<<<<<<
3767  *             self.periodicity[i] = periodicity[i]
3768  *
3769  */
3770     __pyx_t_2 = __pyx_v_i;
3771     __pyx_t_3 = -1;
3772     if (__pyx_t_2 < 0) {
3773       __pyx_t_2 += __pyx_v_DW.shape[0];
3774       if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
3775     } else if (unlikely(__pyx_t_2 >= __pyx_v_DW.shape[0])) __pyx_t_3 = 0;
3776     if (unlikely(__pyx_t_3 != -1)) {
3777       __Pyx_RaiseBufferIndexError(__pyx_t_3);
3778       __PYX_ERR(0, 131, __pyx_L1_error)
3779     }
3780     (__pyx_v_self->DW[__pyx_v_i]) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_DW.data + __pyx_t_2 * __pyx_v_DW.strides[0]) )));
3781 
3782     /* "yt/utilities/lib/distance_queue.pyx":132
3783  *         for i in range(3):
3784  *             self.DW[i] = DW[i]
3785  *             self.periodicity[i] = periodicity[i]             # <<<<<<<<<<<<<<
3786  *
3787  *     def __dealloc__(self):
3788  */
3789     __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_periodicity, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error)
3790     __Pyx_GOTREF(__pyx_t_4);
3791     __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
3792     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3793     (__pyx_v_self->periodicity[__pyx_v_i]) = __pyx_t_5;
3794   }
3795 
3796   /* "yt/utilities/lib/distance_queue.pyx":129
3797  *             self.periodicity[i] = periodicity[i]
3798  *
3799  *     def setup(self, np.float64_t[:] DW, periodicity):             # <<<<<<<<<<<<<<
3800  *         for i in range(3):
3801  *             self.DW[i] = DW[i]
3802  */
3803 
3804   /* function exit code */
3805   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3806   goto __pyx_L0;
3807   __pyx_L1_error:;
3808   __Pyx_XDECREF(__pyx_t_4);
3809   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.DistanceQueue.setup", __pyx_clineno, __pyx_lineno, __pyx_filename);
3810   __pyx_r = NULL;
3811   __pyx_L0:;
3812   __PYX_XDEC_MEMVIEW(&__pyx_v_DW, 1);
3813   __Pyx_XGIVEREF(__pyx_r);
3814   __Pyx_RefNannyFinishContext();
3815   return __pyx_r;
3816 }
3817 
3818 /* "yt/utilities/lib/distance_queue.pyx":134
3819  *             self.periodicity[i] = periodicity[i]
3820  *
3821  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
3822  *         free(self.neighbors)
3823  *
3824  */
3825 
3826 /* Python wrapper */
3827 static void __pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_5__dealloc__(PyObject * __pyx_v_self)3828 static void __pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_5__dealloc__(PyObject *__pyx_v_self) {
3829   __Pyx_RefNannyDeclarations
3830   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
3831   __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_4__dealloc__(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self));
3832 
3833   /* function exit code */
3834   __Pyx_RefNannyFinishContext();
3835 }
3836 
__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_4__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue * __pyx_v_self)3837 static void __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_4__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self) {
3838   __Pyx_RefNannyDeclarations
3839   __Pyx_RefNannySetupContext("__dealloc__", 0);
3840 
3841   /* "yt/utilities/lib/distance_queue.pyx":135
3842  *
3843  *     def __dealloc__(self):
3844  *         free(self.neighbors)             # <<<<<<<<<<<<<<
3845  *
3846  *     cdef void neighbor_eval(self, np.int64_t pn, np.float64_t ppos[3],
3847  */
3848   free(__pyx_v_self->neighbors);
3849 
3850   /* "yt/utilities/lib/distance_queue.pyx":134
3851  *             self.periodicity[i] = periodicity[i]
3852  *
3853  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
3854  *         free(self.neighbors)
3855  *
3856  */
3857 
3858   /* function exit code */
3859   __Pyx_RefNannyFinishContext();
3860 }
3861 
3862 /* "yt/utilities/lib/distance_queue.pyx":137
3863  *         free(self.neighbors)
3864  *
3865  *     cdef void neighbor_eval(self, np.int64_t pn, np.float64_t ppos[3],             # <<<<<<<<<<<<<<
3866  *                             np.float64_t cpos[3]):
3867  *         # Here's a python+numpy simulator of this:
3868  */
3869 
__pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_neighbor_eval(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue * __pyx_v_self,__pyx_t_5numpy_int64_t __pyx_v_pn,__pyx_t_5numpy_float64_t * __pyx_v_ppos,__pyx_t_5numpy_float64_t * __pyx_v_cpos)3870 static void __pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_neighbor_eval(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_pn, __pyx_t_5numpy_float64_t *__pyx_v_ppos, __pyx_t_5numpy_float64_t *__pyx_v_cpos) {
3871   __pyx_t_5numpy_float64_t __pyx_v_r2;
3872   __pyx_t_5numpy_float64_t __pyx_v_r2_trunc;
3873   __Pyx_RefNannyDeclarations
3874   int __pyx_t_1;
3875   __pyx_t_5numpy_float64_t __pyx_t_2;
3876   __Pyx_RefNannySetupContext("neighbor_eval", 0);
3877 
3878   /* "yt/utilities/lib/distance_queue.pyx":142
3879  *         # http://paste.yt-project.org/show/5445/
3880  *         cdef np.float64_t r2, r2_trunc
3881  *         if self.curn == self.maxn:             # <<<<<<<<<<<<<<
3882  *             # Truncate calculation if it's bigger than this in any dimension
3883  *             r2_trunc = self.neighbors[self.curn - 1].r2
3884  */
3885   __pyx_t_1 = ((__pyx_v_self->__pyx_base.curn == __pyx_v_self->__pyx_base.maxn) != 0);
3886   if (__pyx_t_1) {
3887 
3888     /* "yt/utilities/lib/distance_queue.pyx":144
3889  *         if self.curn == self.maxn:
3890  *             # Truncate calculation if it's bigger than this in any dimension
3891  *             r2_trunc = self.neighbors[self.curn - 1].r2             # <<<<<<<<<<<<<<
3892  *         else:
3893  *             # Don't truncate our calculation
3894  */
3895     __pyx_t_2 = (__pyx_v_self->neighbors[(__pyx_v_self->__pyx_base.curn - 1)]).r2;
3896     __pyx_v_r2_trunc = __pyx_t_2;
3897 
3898     /* "yt/utilities/lib/distance_queue.pyx":142
3899  *         # http://paste.yt-project.org/show/5445/
3900  *         cdef np.float64_t r2, r2_trunc
3901  *         if self.curn == self.maxn:             # <<<<<<<<<<<<<<
3902  *             # Truncate calculation if it's bigger than this in any dimension
3903  *             r2_trunc = self.neighbors[self.curn - 1].r2
3904  */
3905     goto __pyx_L3;
3906   }
3907 
3908   /* "yt/utilities/lib/distance_queue.pyx":147
3909  *         else:
3910  *             # Don't truncate our calculation
3911  *             r2_trunc = -1             # <<<<<<<<<<<<<<
3912  *         r2 = r2dist(ppos, cpos, self.DW, self.periodicity, r2_trunc)
3913  *         if r2 == -1:
3914  */
3915   /*else*/ {
3916     __pyx_v_r2_trunc = -1.0;
3917   }
3918   __pyx_L3:;
3919 
3920   /* "yt/utilities/lib/distance_queue.pyx":148
3921  *             # Don't truncate our calculation
3922  *             r2_trunc = -1
3923  *         r2 = r2dist(ppos, cpos, self.DW, self.periodicity, r2_trunc)             # <<<<<<<<<<<<<<
3924  *         if r2 == -1:
3925  *             return
3926  */
3927   __pyx_v_r2 = __pyx_f_2yt_9utilities_3lib_14distance_queue_r2dist(__pyx_v_ppos, __pyx_v_cpos, __pyx_v_self->DW, __pyx_v_self->periodicity, __pyx_v_r2_trunc);
3928 
3929   /* "yt/utilities/lib/distance_queue.pyx":149
3930  *             r2_trunc = -1
3931  *         r2 = r2dist(ppos, cpos, self.DW, self.periodicity, r2_trunc)
3932  *         if r2 == -1:             # <<<<<<<<<<<<<<
3933  *             return
3934  *         self.item_insert(pn, r2)
3935  */
3936   __pyx_t_1 = ((__pyx_v_r2 == -1.0) != 0);
3937   if (__pyx_t_1) {
3938 
3939     /* "yt/utilities/lib/distance_queue.pyx":150
3940  *         r2 = r2dist(ppos, cpos, self.DW, self.periodicity, r2_trunc)
3941  *         if r2 == -1:
3942  *             return             # <<<<<<<<<<<<<<
3943  *         self.item_insert(pn, r2)
3944  *
3945  */
3946     goto __pyx_L0;
3947 
3948     /* "yt/utilities/lib/distance_queue.pyx":149
3949  *             r2_trunc = -1
3950  *         r2 = r2dist(ppos, cpos, self.DW, self.periodicity, r2_trunc)
3951  *         if r2 == -1:             # <<<<<<<<<<<<<<
3952  *             return
3953  *         self.item_insert(pn, r2)
3954  */
3955   }
3956 
3957   /* "yt/utilities/lib/distance_queue.pyx":151
3958  *         if r2 == -1:
3959  *             return
3960  *         self.item_insert(pn, r2)             # <<<<<<<<<<<<<<
3961  *
3962  *     cdef void neighbor_reset(self):
3963  */
3964   (void)(((struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.item_insert(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *)__pyx_v_self), __pyx_v_pn, __pyx_v_r2));
3965 
3966   /* "yt/utilities/lib/distance_queue.pyx":137
3967  *         free(self.neighbors)
3968  *
3969  *     cdef void neighbor_eval(self, np.int64_t pn, np.float64_t ppos[3],             # <<<<<<<<<<<<<<
3970  *                             np.float64_t cpos[3]):
3971  *         # Here's a python+numpy simulator of this:
3972  */
3973 
3974   /* function exit code */
3975   __pyx_L0:;
3976   __Pyx_RefNannyFinishContext();
3977 }
3978 
3979 /* "yt/utilities/lib/distance_queue.pyx":153
3980  *         self.item_insert(pn, r2)
3981  *
3982  *     cdef void neighbor_reset(self):             # <<<<<<<<<<<<<<
3983  *         self.item_reset()
3984  *
3985  */
3986 
__pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_neighbor_reset(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue * __pyx_v_self)3987 static void __pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_neighbor_reset(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self) {
3988   __Pyx_RefNannyDeclarations
3989   __Pyx_RefNannySetupContext("neighbor_reset", 0);
3990 
3991   /* "yt/utilities/lib/distance_queue.pyx":154
3992  *
3993  *     cdef void neighbor_reset(self):
3994  *         self.item_reset()             # <<<<<<<<<<<<<<
3995  *
3996  *     def find_nearest(self, np.float64_t[:] center, np.float64_t[:,:] points):
3997  */
3998   ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.item_reset(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *)__pyx_v_self));
3999 
4000   /* "yt/utilities/lib/distance_queue.pyx":153
4001  *         self.item_insert(pn, r2)
4002  *
4003  *     cdef void neighbor_reset(self):             # <<<<<<<<<<<<<<
4004  *         self.item_reset()
4005  *
4006  */
4007 
4008   /* function exit code */
4009   __Pyx_RefNannyFinishContext();
4010 }
4011 
4012 /* "yt/utilities/lib/distance_queue.pyx":156
4013  *         self.item_reset()
4014  *
4015  *     def find_nearest(self, np.float64_t[:] center, np.float64_t[:,:] points):             # <<<<<<<<<<<<<<
4016  *         """This function accepts a center and a set of [N,3] points, and it
4017  *         will return the indices into the points array of the maxn closest
4018  */
4019 
4020 /* Python wrapper */
4021 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_7find_nearest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4022 static char __pyx_doc_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_6find_nearest[] = "This function accepts a center and a set of [N,3] points, and it\n        will return the indices into the points array of the maxn closest\n        neighbors.";
__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_7find_nearest(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4023 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_7find_nearest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4024   __Pyx_memviewslice __pyx_v_center = { 0, 0, { 0 }, { 0 }, { 0 } };
4025   __Pyx_memviewslice __pyx_v_points = { 0, 0, { 0 }, { 0 }, { 0 } };
4026   PyObject *__pyx_r = 0;
4027   __Pyx_RefNannyDeclarations
4028   __Pyx_RefNannySetupContext("find_nearest (wrapper)", 0);
4029   {
4030     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_center,&__pyx_n_s_points,0};
4031     PyObject* values[2] = {0,0};
4032     if (unlikely(__pyx_kwds)) {
4033       Py_ssize_t kw_args;
4034       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4035       switch (pos_args) {
4036         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4037         CYTHON_FALLTHROUGH;
4038         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4039         CYTHON_FALLTHROUGH;
4040         case  0: break;
4041         default: goto __pyx_L5_argtuple_error;
4042       }
4043       kw_args = PyDict_Size(__pyx_kwds);
4044       switch (pos_args) {
4045         case  0:
4046         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_center)) != 0)) kw_args--;
4047         else goto __pyx_L5_argtuple_error;
4048         CYTHON_FALLTHROUGH;
4049         case  1:
4050         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points)) != 0)) kw_args--;
4051         else {
4052           __Pyx_RaiseArgtupleInvalid("find_nearest", 1, 2, 2, 1); __PYX_ERR(0, 156, __pyx_L3_error)
4053         }
4054       }
4055       if (unlikely(kw_args > 0)) {
4056         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_nearest") < 0)) __PYX_ERR(0, 156, __pyx_L3_error)
4057       }
4058     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4059       goto __pyx_L5_argtuple_error;
4060     } else {
4061       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4062       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4063     }
4064     __pyx_v_center = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_center.memview)) __PYX_ERR(0, 156, __pyx_L3_error)
4065     __pyx_v_points = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_points.memview)) __PYX_ERR(0, 156, __pyx_L3_error)
4066   }
4067   goto __pyx_L4_argument_unpacking_done;
4068   __pyx_L5_argtuple_error:;
4069   __Pyx_RaiseArgtupleInvalid("find_nearest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 156, __pyx_L3_error)
4070   __pyx_L3_error:;
4071   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.DistanceQueue.find_nearest", __pyx_clineno, __pyx_lineno, __pyx_filename);
4072   __Pyx_RefNannyFinishContext();
4073   return NULL;
4074   __pyx_L4_argument_unpacking_done:;
4075   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_6find_nearest(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self), __pyx_v_center, __pyx_v_points);
4076 
4077   /* function exit code */
4078   __Pyx_RefNannyFinishContext();
4079   return __pyx_r;
4080 }
4081 
__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_6find_nearest(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue * __pyx_v_self,__Pyx_memviewslice __pyx_v_center,__Pyx_memviewslice __pyx_v_points)4082 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_6find_nearest(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, __Pyx_memviewslice __pyx_v_center, __Pyx_memviewslice __pyx_v_points) {
4083   int __pyx_v_i;
4084   int __pyx_v_j;
4085   __pyx_t_5numpy_float64_t __pyx_v_ppos[3];
4086   __pyx_t_5numpy_float64_t __pyx_v_cpos[3];
4087   PyObject *__pyx_v_rv = NULL;
4088   PyObject *__pyx_r = NULL;
4089   __Pyx_RefNannyDeclarations
4090   int __pyx_t_1;
4091   Py_ssize_t __pyx_t_2;
4092   int __pyx_t_3;
4093   Py_ssize_t __pyx_t_4;
4094   Py_ssize_t __pyx_t_5;
4095   Py_ssize_t __pyx_t_6;
4096   Py_ssize_t __pyx_t_7;
4097   int __pyx_t_8;
4098   PyObject *__pyx_t_9 = NULL;
4099   PyObject *__pyx_t_10 = NULL;
4100   PyObject *__pyx_t_11 = NULL;
4101   PyObject *__pyx_t_12 = NULL;
4102   __Pyx_RefNannySetupContext("find_nearest", 0);
4103 
4104   /* "yt/utilities/lib/distance_queue.pyx":163
4105  *         cdef np.float64_t ppos[3]
4106  *         cdef np.float64_t cpos[3]
4107  *         self.neighbor_reset()             # <<<<<<<<<<<<<<
4108  *         for i in range(3):
4109  *             cpos[i] = center[i]
4110  */
4111   ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self->__pyx_base.__pyx_vtab)->neighbor_reset(__pyx_v_self);
4112 
4113   /* "yt/utilities/lib/distance_queue.pyx":164
4114  *         cdef np.float64_t cpos[3]
4115  *         self.neighbor_reset()
4116  *         for i in range(3):             # <<<<<<<<<<<<<<
4117  *             cpos[i] = center[i]
4118  *         for j in range(points.shape[0]):
4119  */
4120   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
4121     __pyx_v_i = __pyx_t_1;
4122 
4123     /* "yt/utilities/lib/distance_queue.pyx":165
4124  *         self.neighbor_reset()
4125  *         for i in range(3):
4126  *             cpos[i] = center[i]             # <<<<<<<<<<<<<<
4127  *         for j in range(points.shape[0]):
4128  *             for i in range(3):
4129  */
4130     __pyx_t_2 = __pyx_v_i;
4131     __pyx_t_3 = -1;
4132     if (__pyx_t_2 < 0) {
4133       __pyx_t_2 += __pyx_v_center.shape[0];
4134       if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
4135     } else if (unlikely(__pyx_t_2 >= __pyx_v_center.shape[0])) __pyx_t_3 = 0;
4136     if (unlikely(__pyx_t_3 != -1)) {
4137       __Pyx_RaiseBufferIndexError(__pyx_t_3);
4138       __PYX_ERR(0, 165, __pyx_L1_error)
4139     }
4140     (__pyx_v_cpos[__pyx_v_i]) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_center.data + __pyx_t_2 * __pyx_v_center.strides[0]) )));
4141   }
4142 
4143   /* "yt/utilities/lib/distance_queue.pyx":166
4144  *         for i in range(3):
4145  *             cpos[i] = center[i]
4146  *         for j in range(points.shape[0]):             # <<<<<<<<<<<<<<
4147  *             for i in range(3):
4148  *                 ppos[i] = points[j,i]
4149  */
4150   __pyx_t_4 = (__pyx_v_points.shape[0]);
4151   __pyx_t_5 = __pyx_t_4;
4152   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_5; __pyx_t_1+=1) {
4153     __pyx_v_j = __pyx_t_1;
4154 
4155     /* "yt/utilities/lib/distance_queue.pyx":167
4156  *             cpos[i] = center[i]
4157  *         for j in range(points.shape[0]):
4158  *             for i in range(3):             # <<<<<<<<<<<<<<
4159  *                 ppos[i] = points[j,i]
4160  *             self.neighbor_eval(j, ppos, cpos)
4161  */
4162     for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) {
4163       __pyx_v_i = __pyx_t_3;
4164 
4165       /* "yt/utilities/lib/distance_queue.pyx":168
4166  *         for j in range(points.shape[0]):
4167  *             for i in range(3):
4168  *                 ppos[i] = points[j,i]             # <<<<<<<<<<<<<<
4169  *             self.neighbor_eval(j, ppos, cpos)
4170  *         rv = np.empty(self.curn, dtype="int64")
4171  */
4172       __pyx_t_6 = __pyx_v_j;
4173       __pyx_t_7 = __pyx_v_i;
4174       __pyx_t_8 = -1;
4175       if (__pyx_t_6 < 0) {
4176         __pyx_t_6 += __pyx_v_points.shape[0];
4177         if (unlikely(__pyx_t_6 < 0)) __pyx_t_8 = 0;
4178       } else if (unlikely(__pyx_t_6 >= __pyx_v_points.shape[0])) __pyx_t_8 = 0;
4179       if (__pyx_t_7 < 0) {
4180         __pyx_t_7 += __pyx_v_points.shape[1];
4181         if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 1;
4182       } else if (unlikely(__pyx_t_7 >= __pyx_v_points.shape[1])) __pyx_t_8 = 1;
4183       if (unlikely(__pyx_t_8 != -1)) {
4184         __Pyx_RaiseBufferIndexError(__pyx_t_8);
4185         __PYX_ERR(0, 168, __pyx_L1_error)
4186       }
4187       (__pyx_v_ppos[__pyx_v_i]) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_points.data + __pyx_t_6 * __pyx_v_points.strides[0]) ) + __pyx_t_7 * __pyx_v_points.strides[1]) )));
4188     }
4189 
4190     /* "yt/utilities/lib/distance_queue.pyx":169
4191  *             for i in range(3):
4192  *                 ppos[i] = points[j,i]
4193  *             self.neighbor_eval(j, ppos, cpos)             # <<<<<<<<<<<<<<
4194  *         rv = np.empty(self.curn, dtype="int64")
4195  *         for i in range(self.curn):
4196  */
4197     ((struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self->__pyx_base.__pyx_vtab)->neighbor_eval(__pyx_v_self, __pyx_v_j, __pyx_v_ppos, __pyx_v_cpos);
4198   }
4199 
4200   /* "yt/utilities/lib/distance_queue.pyx":170
4201  *                 ppos[i] = points[j,i]
4202  *             self.neighbor_eval(j, ppos, cpos)
4203  *         rv = np.empty(self.curn, dtype="int64")             # <<<<<<<<<<<<<<
4204  *         for i in range(self.curn):
4205  *             rv[i] = self.neighbors[i].pn
4206  */
4207   __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 170, __pyx_L1_error)
4208   __Pyx_GOTREF(__pyx_t_9);
4209   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 170, __pyx_L1_error)
4210   __Pyx_GOTREF(__pyx_t_10);
4211   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4212   __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_self->__pyx_base.curn); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 170, __pyx_L1_error)
4213   __Pyx_GOTREF(__pyx_t_9);
4214   __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 170, __pyx_L1_error)
4215   __Pyx_GOTREF(__pyx_t_11);
4216   __Pyx_GIVEREF(__pyx_t_9);
4217   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
4218   __pyx_t_9 = 0;
4219   __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 170, __pyx_L1_error)
4220   __Pyx_GOTREF(__pyx_t_9);
4221   if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_n_s_int64) < 0) __PYX_ERR(0, 170, __pyx_L1_error)
4222   __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 170, __pyx_L1_error)
4223   __Pyx_GOTREF(__pyx_t_12);
4224   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4225   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4226   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4227   __pyx_v_rv = __pyx_t_12;
4228   __pyx_t_12 = 0;
4229 
4230   /* "yt/utilities/lib/distance_queue.pyx":171
4231  *             self.neighbor_eval(j, ppos, cpos)
4232  *         rv = np.empty(self.curn, dtype="int64")
4233  *         for i in range(self.curn):             # <<<<<<<<<<<<<<
4234  *             rv[i] = self.neighbors[i].pn
4235  *         return rv
4236  */
4237   __pyx_t_1 = __pyx_v_self->__pyx_base.curn;
4238   __pyx_t_3 = __pyx_t_1;
4239   for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_3; __pyx_t_8+=1) {
4240     __pyx_v_i = __pyx_t_8;
4241 
4242     /* "yt/utilities/lib/distance_queue.pyx":172
4243  *         rv = np.empty(self.curn, dtype="int64")
4244  *         for i in range(self.curn):
4245  *             rv[i] = self.neighbors[i].pn             # <<<<<<<<<<<<<<
4246  *         return rv
4247  */
4248     __pyx_t_12 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->neighbors[__pyx_v_i]).pn); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 172, __pyx_L1_error)
4249     __Pyx_GOTREF(__pyx_t_12);
4250     if (unlikely(__Pyx_SetItemInt(__pyx_v_rv, __pyx_v_i, __pyx_t_12, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 172, __pyx_L1_error)
4251     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4252   }
4253 
4254   /* "yt/utilities/lib/distance_queue.pyx":173
4255  *         for i in range(self.curn):
4256  *             rv[i] = self.neighbors[i].pn
4257  *         return rv             # <<<<<<<<<<<<<<
4258  */
4259   __Pyx_XDECREF(__pyx_r);
4260   __Pyx_INCREF(__pyx_v_rv);
4261   __pyx_r = __pyx_v_rv;
4262   goto __pyx_L0;
4263 
4264   /* "yt/utilities/lib/distance_queue.pyx":156
4265  *         self.item_reset()
4266  *
4267  *     def find_nearest(self, np.float64_t[:] center, np.float64_t[:,:] points):             # <<<<<<<<<<<<<<
4268  *         """This function accepts a center and a set of [N,3] points, and it
4269  *         will return the indices into the points array of the maxn closest
4270  */
4271 
4272   /* function exit code */
4273   __pyx_L1_error:;
4274   __Pyx_XDECREF(__pyx_t_9);
4275   __Pyx_XDECREF(__pyx_t_10);
4276   __Pyx_XDECREF(__pyx_t_11);
4277   __Pyx_XDECREF(__pyx_t_12);
4278   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.DistanceQueue.find_nearest", __pyx_clineno, __pyx_lineno, __pyx_filename);
4279   __pyx_r = NULL;
4280   __pyx_L0:;
4281   __Pyx_XDECREF(__pyx_v_rv);
4282   __PYX_XDEC_MEMVIEW(&__pyx_v_center, 1);
4283   __PYX_XDEC_MEMVIEW(&__pyx_v_points, 1);
4284   __Pyx_XGIVEREF(__pyx_r);
4285   __Pyx_RefNannyFinishContext();
4286   return __pyx_r;
4287 }
4288 
4289 /* "(tree fragment)":1
4290  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4291  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4292  * def __setstate_cython__(self, __pyx_state):
4293  */
4294 
4295 /* Python wrapper */
4296 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_9__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4297 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4298   PyObject *__pyx_r = 0;
4299   __Pyx_RefNannyDeclarations
4300   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4301   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_8__reduce_cython__(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self));
4302 
4303   /* function exit code */
4304   __Pyx_RefNannyFinishContext();
4305   return __pyx_r;
4306 }
4307 
__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue * __pyx_v_self)4308 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self) {
4309   PyObject *__pyx_r = NULL;
4310   __Pyx_RefNannyDeclarations
4311   PyObject *__pyx_t_1 = NULL;
4312   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
4313 
4314   /* "(tree fragment)":2
4315  * def __reduce_cython__(self):
4316  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
4317  * def __setstate_cython__(self, __pyx_state):
4318  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4319  */
4320   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
4321   __Pyx_GOTREF(__pyx_t_1);
4322   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4323   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4324   __PYX_ERR(1, 2, __pyx_L1_error)
4325 
4326   /* "(tree fragment)":1
4327  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4328  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4329  * def __setstate_cython__(self, __pyx_state):
4330  */
4331 
4332   /* function exit code */
4333   __pyx_L1_error:;
4334   __Pyx_XDECREF(__pyx_t_1);
4335   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.DistanceQueue.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4336   __pyx_r = NULL;
4337   __Pyx_XGIVEREF(__pyx_r);
4338   __Pyx_RefNannyFinishContext();
4339   return __pyx_r;
4340 }
4341 
4342 /* "(tree fragment)":3
4343  * def __reduce_cython__(self):
4344  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4345  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4346  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4347  */
4348 
4349 /* Python wrapper */
4350 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_11__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)4351 static PyObject *__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4352   PyObject *__pyx_r = 0;
4353   __Pyx_RefNannyDeclarations
4354   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4355   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_10__setstate_cython__(((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4356 
4357   /* function exit code */
4358   __Pyx_RefNannyFinishContext();
4359   return __pyx_r;
4360 }
4361 
__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)4362 static PyObject *__pyx_pf_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
4363   PyObject *__pyx_r = NULL;
4364   __Pyx_RefNannyDeclarations
4365   PyObject *__pyx_t_1 = NULL;
4366   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4367 
4368   /* "(tree fragment)":4
4369  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4370  * def __setstate_cython__(self, __pyx_state):
4371  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
4372  */
4373   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
4374   __Pyx_GOTREF(__pyx_t_1);
4375   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4376   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4377   __PYX_ERR(1, 4, __pyx_L1_error)
4378 
4379   /* "(tree fragment)":3
4380  * def __reduce_cython__(self):
4381  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4382  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4383  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
4384  */
4385 
4386   /* function exit code */
4387   __pyx_L1_error:;
4388   __Pyx_XDECREF(__pyx_t_1);
4389   __Pyx_AddTraceback("yt.utilities.lib.distance_queue.DistanceQueue.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4390   __pyx_r = NULL;
4391   __Pyx_XGIVEREF(__pyx_r);
4392   __Pyx_RefNannyFinishContext();
4393   return __pyx_r;
4394 }
4395 
4396 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
4397  *         # experimental exception made for __getbuffer__ and __releasebuffer__
4398  *         # -- the details of this may change.
4399  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
4400  *             # This implementation of getbuffer is geared towards Cython
4401  *             # requirements, and does not yet fulfill the PEP.
4402  */
4403 
4404 /* Python wrapper */
4405 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)4406 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
4407   int __pyx_r;
4408   __Pyx_RefNannyDeclarations
4409   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
4410   __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
4411 
4412   /* function exit code */
4413   __Pyx_RefNannyFinishContext();
4414   return __pyx_r;
4415 }
4416 
__pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)4417 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
4418   int __pyx_v_i;
4419   int __pyx_v_ndim;
4420   int __pyx_v_endian_detector;
4421   int __pyx_v_little_endian;
4422   int __pyx_v_t;
4423   char *__pyx_v_f;
4424   PyArray_Descr *__pyx_v_descr = 0;
4425   int __pyx_v_offset;
4426   int __pyx_r;
4427   __Pyx_RefNannyDeclarations
4428   int __pyx_t_1;
4429   int __pyx_t_2;
4430   PyObject *__pyx_t_3 = NULL;
4431   int __pyx_t_4;
4432   int __pyx_t_5;
4433   int __pyx_t_6;
4434   PyArray_Descr *__pyx_t_7;
4435   PyObject *__pyx_t_8 = NULL;
4436   char *__pyx_t_9;
4437   if (__pyx_v_info == NULL) {
4438     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
4439     return -1;
4440   }
4441   __Pyx_RefNannySetupContext("__getbuffer__", 0);
4442   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
4443   __Pyx_GIVEREF(__pyx_v_info->obj);
4444 
4445   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
4446  *
4447  *             cdef int i, ndim
4448  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
4449  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
4450  *
4451  */
4452   __pyx_v_endian_detector = 1;
4453 
4454   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266
4455  *             cdef int i, ndim
4456  *             cdef int endian_detector = 1
4457  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
4458  *
4459  *             ndim = PyArray_NDIM(self)
4460  */
4461   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
4462 
4463   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268
4464  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
4465  *
4466  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
4467  *
4468  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
4469  */
4470   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
4471 
4472   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
4473  *             ndim = PyArray_NDIM(self)
4474  *
4475  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
4476  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
4477  *                 raise ValueError(u"ndarray is not C contiguous")
4478  */
4479   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
4480   if (__pyx_t_2) {
4481   } else {
4482     __pyx_t_1 = __pyx_t_2;
4483     goto __pyx_L4_bool_binop_done;
4484   }
4485 
4486   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271
4487  *
4488  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
4489  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
4490  *                 raise ValueError(u"ndarray is not C contiguous")
4491  *
4492  */
4493   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
4494   __pyx_t_1 = __pyx_t_2;
4495   __pyx_L4_bool_binop_done:;
4496 
4497   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
4498  *             ndim = PyArray_NDIM(self)
4499  *
4500  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
4501  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
4502  *                 raise ValueError(u"ndarray is not C contiguous")
4503  */
4504   if (unlikely(__pyx_t_1)) {
4505 
4506     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
4507  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
4508  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
4509  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
4510  *
4511  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
4512  */
4513     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 272, __pyx_L1_error)
4514     __Pyx_GOTREF(__pyx_t_3);
4515     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4516     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4517     __PYX_ERR(2, 272, __pyx_L1_error)
4518 
4519     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
4520  *             ndim = PyArray_NDIM(self)
4521  *
4522  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
4523  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
4524  *                 raise ValueError(u"ndarray is not C contiguous")
4525  */
4526   }
4527 
4528   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
4529  *                 raise ValueError(u"ndarray is not C contiguous")
4530  *
4531  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
4532  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
4533  *                 raise ValueError(u"ndarray is not Fortran contiguous")
4534  */
4535   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
4536   if (__pyx_t_2) {
4537   } else {
4538     __pyx_t_1 = __pyx_t_2;
4539     goto __pyx_L7_bool_binop_done;
4540   }
4541 
4542   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275
4543  *
4544  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
4545  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
4546  *                 raise ValueError(u"ndarray is not Fortran contiguous")
4547  *
4548  */
4549   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
4550   __pyx_t_1 = __pyx_t_2;
4551   __pyx_L7_bool_binop_done:;
4552 
4553   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
4554  *                 raise ValueError(u"ndarray is not C contiguous")
4555  *
4556  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
4557  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
4558  *                 raise ValueError(u"ndarray is not Fortran contiguous")
4559  */
4560   if (unlikely(__pyx_t_1)) {
4561 
4562     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
4563  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
4564  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
4565  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
4566  *
4567  *             info.buf = PyArray_DATA(self)
4568  */
4569     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 276, __pyx_L1_error)
4570     __Pyx_GOTREF(__pyx_t_3);
4571     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4572     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4573     __PYX_ERR(2, 276, __pyx_L1_error)
4574 
4575     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
4576  *                 raise ValueError(u"ndarray is not C contiguous")
4577  *
4578  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
4579  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
4580  *                 raise ValueError(u"ndarray is not Fortran contiguous")
4581  */
4582   }
4583 
4584   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278
4585  *                 raise ValueError(u"ndarray is not Fortran contiguous")
4586  *
4587  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
4588  *             info.ndim = ndim
4589  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
4590  */
4591   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
4592 
4593   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279
4594  *
4595  *             info.buf = PyArray_DATA(self)
4596  *             info.ndim = ndim             # <<<<<<<<<<<<<<
4597  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
4598  *                 # Allocate new buffer for strides and shape info.
4599  */
4600   __pyx_v_info->ndim = __pyx_v_ndim;
4601 
4602   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
4603  *             info.buf = PyArray_DATA(self)
4604  *             info.ndim = ndim
4605  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
4606  *                 # Allocate new buffer for strides and shape info.
4607  *                 # This is allocated as one block, strides first.
4608  */
4609   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
4610   if (__pyx_t_1) {
4611 
4612     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283
4613  *                 # Allocate new buffer for strides and shape info.
4614  *                 # This is allocated as one block, strides first.
4615  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
4616  *                 info.shape = info.strides + ndim
4617  *                 for i in range(ndim):
4618  */
4619     __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
4620 
4621     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284
4622  *                 # This is allocated as one block, strides first.
4623  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
4624  *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
4625  *                 for i in range(ndim):
4626  *                     info.strides[i] = PyArray_STRIDES(self)[i]
4627  */
4628     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
4629 
4630     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285
4631  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
4632  *                 info.shape = info.strides + ndim
4633  *                 for i in range(ndim):             # <<<<<<<<<<<<<<
4634  *                     info.strides[i] = PyArray_STRIDES(self)[i]
4635  *                     info.shape[i] = PyArray_DIMS(self)[i]
4636  */
4637     __pyx_t_4 = __pyx_v_ndim;
4638     __pyx_t_5 = __pyx_t_4;
4639     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4640       __pyx_v_i = __pyx_t_6;
4641 
4642       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286
4643  *                 info.shape = info.strides + ndim
4644  *                 for i in range(ndim):
4645  *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
4646  *                     info.shape[i] = PyArray_DIMS(self)[i]
4647  *             else:
4648  */
4649       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
4650 
4651       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287
4652  *                 for i in range(ndim):
4653  *                     info.strides[i] = PyArray_STRIDES(self)[i]
4654  *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
4655  *             else:
4656  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
4657  */
4658       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
4659     }
4660 
4661     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
4662  *             info.buf = PyArray_DATA(self)
4663  *             info.ndim = ndim
4664  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
4665  *                 # Allocate new buffer for strides and shape info.
4666  *                 # This is allocated as one block, strides first.
4667  */
4668     goto __pyx_L9;
4669   }
4670 
4671   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289
4672  *                     info.shape[i] = PyArray_DIMS(self)[i]
4673  *             else:
4674  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
4675  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
4676  *             info.suboffsets = NULL
4677  */
4678   /*else*/ {
4679     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
4680 
4681     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290
4682  *             else:
4683  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
4684  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
4685  *             info.suboffsets = NULL
4686  *             info.itemsize = PyArray_ITEMSIZE(self)
4687  */
4688     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
4689   }
4690   __pyx_L9:;
4691 
4692   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291
4693  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
4694  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
4695  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
4696  *             info.itemsize = PyArray_ITEMSIZE(self)
4697  *             info.readonly = not PyArray_ISWRITEABLE(self)
4698  */
4699   __pyx_v_info->suboffsets = NULL;
4700 
4701   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292
4702  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
4703  *             info.suboffsets = NULL
4704  *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
4705  *             info.readonly = not PyArray_ISWRITEABLE(self)
4706  *
4707  */
4708   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
4709 
4710   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293
4711  *             info.suboffsets = NULL
4712  *             info.itemsize = PyArray_ITEMSIZE(self)
4713  *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
4714  *
4715  *             cdef int t
4716  */
4717   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
4718 
4719   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296
4720  *
4721  *             cdef int t
4722  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
4723  *             cdef dtype descr = <dtype>PyArray_DESCR(self)
4724  *             cdef int offset
4725  */
4726   __pyx_v_f = NULL;
4727 
4728   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297
4729  *             cdef int t
4730  *             cdef char* f = NULL
4731  *             cdef dtype descr = <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
4732  *             cdef int offset
4733  *
4734  */
4735   __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
4736   __pyx_t_3 = ((PyObject *)__pyx_t_7);
4737   __Pyx_INCREF(__pyx_t_3);
4738   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
4739   __pyx_t_3 = 0;
4740 
4741   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300
4742  *             cdef int offset
4743  *
4744  *             info.obj = self             # <<<<<<<<<<<<<<
4745  *
4746  *             if not PyDataType_HASFIELDS(descr):
4747  */
4748   __Pyx_INCREF(((PyObject *)__pyx_v_self));
4749   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
4750   __Pyx_GOTREF(__pyx_v_info->obj);
4751   __Pyx_DECREF(__pyx_v_info->obj);
4752   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
4753 
4754   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
4755  *             info.obj = self
4756  *
4757  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
4758  *                 t = descr.type_num
4759  *                 if ((descr.byteorder == c'>' and little_endian) or
4760  */
4761   __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
4762   if (__pyx_t_1) {
4763 
4764     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303
4765  *
4766  *             if not PyDataType_HASFIELDS(descr):
4767  *                 t = descr.type_num             # <<<<<<<<<<<<<<
4768  *                 if ((descr.byteorder == c'>' and little_endian) or
4769  *                     (descr.byteorder == c'<' and not little_endian)):
4770  */
4771     __pyx_t_4 = __pyx_v_descr->type_num;
4772     __pyx_v_t = __pyx_t_4;
4773 
4774     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
4775  *             if not PyDataType_HASFIELDS(descr):
4776  *                 t = descr.type_num
4777  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
4778  *                     (descr.byteorder == c'<' and not little_endian)):
4779  *                     raise ValueError(u"Non-native byte order not supported")
4780  */
4781     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
4782     if (!__pyx_t_2) {
4783       goto __pyx_L15_next_or;
4784     } else {
4785     }
4786     __pyx_t_2 = (__pyx_v_little_endian != 0);
4787     if (!__pyx_t_2) {
4788     } else {
4789       __pyx_t_1 = __pyx_t_2;
4790       goto __pyx_L14_bool_binop_done;
4791     }
4792     __pyx_L15_next_or:;
4793 
4794     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305
4795  *                 t = descr.type_num
4796  *                 if ((descr.byteorder == c'>' and little_endian) or
4797  *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
4798  *                     raise ValueError(u"Non-native byte order not supported")
4799  *                 if   t == NPY_BYTE:        f = "b"
4800  */
4801     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
4802     if (__pyx_t_2) {
4803     } else {
4804       __pyx_t_1 = __pyx_t_2;
4805       goto __pyx_L14_bool_binop_done;
4806     }
4807     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
4808     __pyx_t_1 = __pyx_t_2;
4809     __pyx_L14_bool_binop_done:;
4810 
4811     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
4812  *             if not PyDataType_HASFIELDS(descr):
4813  *                 t = descr.type_num
4814  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
4815  *                     (descr.byteorder == c'<' and not little_endian)):
4816  *                     raise ValueError(u"Non-native byte order not supported")
4817  */
4818     if (unlikely(__pyx_t_1)) {
4819 
4820       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
4821  *                 if ((descr.byteorder == c'>' and little_endian) or
4822  *                     (descr.byteorder == c'<' and not little_endian)):
4823  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
4824  *                 if   t == NPY_BYTE:        f = "b"
4825  *                 elif t == NPY_UBYTE:       f = "B"
4826  */
4827       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 306, __pyx_L1_error)
4828       __Pyx_GOTREF(__pyx_t_3);
4829       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4830       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4831       __PYX_ERR(2, 306, __pyx_L1_error)
4832 
4833       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
4834  *             if not PyDataType_HASFIELDS(descr):
4835  *                 t = descr.type_num
4836  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
4837  *                     (descr.byteorder == c'<' and not little_endian)):
4838  *                     raise ValueError(u"Non-native byte order not supported")
4839  */
4840     }
4841 
4842     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
4843  *                     (descr.byteorder == c'<' and not little_endian)):
4844  *                     raise ValueError(u"Non-native byte order not supported")
4845  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
4846  *                 elif t == NPY_UBYTE:       f = "B"
4847  *                 elif t == NPY_SHORT:       f = "h"
4848  */
4849     switch (__pyx_v_t) {
4850       case NPY_BYTE:
4851       __pyx_v_f = ((char *)"b");
4852       break;
4853       case NPY_UBYTE:
4854 
4855       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
4856  *                     raise ValueError(u"Non-native byte order not supported")
4857  *                 if   t == NPY_BYTE:        f = "b"
4858  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
4859  *                 elif t == NPY_SHORT:       f = "h"
4860  *                 elif t == NPY_USHORT:      f = "H"
4861  */
4862       __pyx_v_f = ((char *)"B");
4863       break;
4864       case NPY_SHORT:
4865 
4866       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309
4867  *                 if   t == NPY_BYTE:        f = "b"
4868  *                 elif t == NPY_UBYTE:       f = "B"
4869  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
4870  *                 elif t == NPY_USHORT:      f = "H"
4871  *                 elif t == NPY_INT:         f = "i"
4872  */
4873       __pyx_v_f = ((char *)"h");
4874       break;
4875       case NPY_USHORT:
4876 
4877       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
4878  *                 elif t == NPY_UBYTE:       f = "B"
4879  *                 elif t == NPY_SHORT:       f = "h"
4880  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
4881  *                 elif t == NPY_INT:         f = "i"
4882  *                 elif t == NPY_UINT:        f = "I"
4883  */
4884       __pyx_v_f = ((char *)"H");
4885       break;
4886       case NPY_INT:
4887 
4888       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311
4889  *                 elif t == NPY_SHORT:       f = "h"
4890  *                 elif t == NPY_USHORT:      f = "H"
4891  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
4892  *                 elif t == NPY_UINT:        f = "I"
4893  *                 elif t == NPY_LONG:        f = "l"
4894  */
4895       __pyx_v_f = ((char *)"i");
4896       break;
4897       case NPY_UINT:
4898 
4899       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312
4900  *                 elif t == NPY_USHORT:      f = "H"
4901  *                 elif t == NPY_INT:         f = "i"
4902  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
4903  *                 elif t == NPY_LONG:        f = "l"
4904  *                 elif t == NPY_ULONG:       f = "L"
4905  */
4906       __pyx_v_f = ((char *)"I");
4907       break;
4908       case NPY_LONG:
4909 
4910       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313
4911  *                 elif t == NPY_INT:         f = "i"
4912  *                 elif t == NPY_UINT:        f = "I"
4913  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
4914  *                 elif t == NPY_ULONG:       f = "L"
4915  *                 elif t == NPY_LONGLONG:    f = "q"
4916  */
4917       __pyx_v_f = ((char *)"l");
4918       break;
4919       case NPY_ULONG:
4920 
4921       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314
4922  *                 elif t == NPY_UINT:        f = "I"
4923  *                 elif t == NPY_LONG:        f = "l"
4924  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
4925  *                 elif t == NPY_LONGLONG:    f = "q"
4926  *                 elif t == NPY_ULONGLONG:   f = "Q"
4927  */
4928       __pyx_v_f = ((char *)"L");
4929       break;
4930       case NPY_LONGLONG:
4931 
4932       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315
4933  *                 elif t == NPY_LONG:        f = "l"
4934  *                 elif t == NPY_ULONG:       f = "L"
4935  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
4936  *                 elif t == NPY_ULONGLONG:   f = "Q"
4937  *                 elif t == NPY_FLOAT:       f = "f"
4938  */
4939       __pyx_v_f = ((char *)"q");
4940       break;
4941       case NPY_ULONGLONG:
4942 
4943       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316
4944  *                 elif t == NPY_ULONG:       f = "L"
4945  *                 elif t == NPY_LONGLONG:    f = "q"
4946  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
4947  *                 elif t == NPY_FLOAT:       f = "f"
4948  *                 elif t == NPY_DOUBLE:      f = "d"
4949  */
4950       __pyx_v_f = ((char *)"Q");
4951       break;
4952       case NPY_FLOAT:
4953 
4954       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317
4955  *                 elif t == NPY_LONGLONG:    f = "q"
4956  *                 elif t == NPY_ULONGLONG:   f = "Q"
4957  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
4958  *                 elif t == NPY_DOUBLE:      f = "d"
4959  *                 elif t == NPY_LONGDOUBLE:  f = "g"
4960  */
4961       __pyx_v_f = ((char *)"f");
4962       break;
4963       case NPY_DOUBLE:
4964 
4965       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318
4966  *                 elif t == NPY_ULONGLONG:   f = "Q"
4967  *                 elif t == NPY_FLOAT:       f = "f"
4968  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
4969  *                 elif t == NPY_LONGDOUBLE:  f = "g"
4970  *                 elif t == NPY_CFLOAT:      f = "Zf"
4971  */
4972       __pyx_v_f = ((char *)"d");
4973       break;
4974       case NPY_LONGDOUBLE:
4975 
4976       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319
4977  *                 elif t == NPY_FLOAT:       f = "f"
4978  *                 elif t == NPY_DOUBLE:      f = "d"
4979  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
4980  *                 elif t == NPY_CFLOAT:      f = "Zf"
4981  *                 elif t == NPY_CDOUBLE:     f = "Zd"
4982  */
4983       __pyx_v_f = ((char *)"g");
4984       break;
4985       case NPY_CFLOAT:
4986 
4987       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320
4988  *                 elif t == NPY_DOUBLE:      f = "d"
4989  *                 elif t == NPY_LONGDOUBLE:  f = "g"
4990  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
4991  *                 elif t == NPY_CDOUBLE:     f = "Zd"
4992  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
4993  */
4994       __pyx_v_f = ((char *)"Zf");
4995       break;
4996       case NPY_CDOUBLE:
4997 
4998       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321
4999  *                 elif t == NPY_LONGDOUBLE:  f = "g"
5000  *                 elif t == NPY_CFLOAT:      f = "Zf"
5001  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
5002  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
5003  *                 elif t == NPY_OBJECT:      f = "O"
5004  */
5005       __pyx_v_f = ((char *)"Zd");
5006       break;
5007       case NPY_CLONGDOUBLE:
5008 
5009       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322
5010  *                 elif t == NPY_CFLOAT:      f = "Zf"
5011  *                 elif t == NPY_CDOUBLE:     f = "Zd"
5012  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
5013  *                 elif t == NPY_OBJECT:      f = "O"
5014  *                 else:
5015  */
5016       __pyx_v_f = ((char *)"Zg");
5017       break;
5018       case NPY_OBJECT:
5019 
5020       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323
5021  *                 elif t == NPY_CDOUBLE:     f = "Zd"
5022  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
5023  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
5024  *                 else:
5025  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
5026  */
5027       __pyx_v_f = ((char *)"O");
5028       break;
5029       default:
5030 
5031       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325
5032  *                 elif t == NPY_OBJECT:      f = "O"
5033  *                 else:
5034  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
5035  *                 info.format = f
5036  *                 return
5037  */
5038       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
5039       __Pyx_GOTREF(__pyx_t_3);
5040       __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 325, __pyx_L1_error)
5041       __Pyx_GOTREF(__pyx_t_8);
5042       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5043       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
5044       __Pyx_GOTREF(__pyx_t_3);
5045       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5046       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5047       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5048       __PYX_ERR(2, 325, __pyx_L1_error)
5049       break;
5050     }
5051 
5052     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326
5053  *                 else:
5054  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
5055  *                 info.format = f             # <<<<<<<<<<<<<<
5056  *                 return
5057  *             else:
5058  */
5059     __pyx_v_info->format = __pyx_v_f;
5060 
5061     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327
5062  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
5063  *                 info.format = f
5064  *                 return             # <<<<<<<<<<<<<<
5065  *             else:
5066  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
5067  */
5068     __pyx_r = 0;
5069     goto __pyx_L0;
5070 
5071     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
5072  *             info.obj = self
5073  *
5074  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
5075  *                 t = descr.type_num
5076  *                 if ((descr.byteorder == c'>' and little_endian) or
5077  */
5078   }
5079 
5080   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329
5081  *                 return
5082  *             else:
5083  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
5084  *                 info.format[0] = c'^' # Native data types, manual alignment
5085  *                 offset = 0
5086  */
5087   /*else*/ {
5088     __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
5089 
5090     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330
5091  *             else:
5092  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
5093  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
5094  *                 offset = 0
5095  *                 f = _util_dtypestring(descr, info.format + 1,
5096  */
5097     (__pyx_v_info->format[0]) = '^';
5098 
5099     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331
5100  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
5101  *                 info.format[0] = c'^' # Native data types, manual alignment
5102  *                 offset = 0             # <<<<<<<<<<<<<<
5103  *                 f = _util_dtypestring(descr, info.format + 1,
5104  *                                       info.format + _buffer_format_string_len,
5105  */
5106     __pyx_v_offset = 0;
5107 
5108     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332
5109  *                 info.format[0] = c'^' # Native data types, manual alignment
5110  *                 offset = 0
5111  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
5112  *                                       info.format + _buffer_format_string_len,
5113  *                                       &offset)
5114  */
5115     __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 332, __pyx_L1_error)
5116     __pyx_v_f = __pyx_t_9;
5117 
5118     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335
5119  *                                       info.format + _buffer_format_string_len,
5120  *                                       &offset)
5121  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
5122  *
5123  *         def __releasebuffer__(ndarray self, Py_buffer* info):
5124  */
5125     (__pyx_v_f[0]) = '\x00';
5126   }
5127 
5128   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
5129  *         # experimental exception made for __getbuffer__ and __releasebuffer__
5130  *         # -- the details of this may change.
5131  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
5132  *             # This implementation of getbuffer is geared towards Cython
5133  *             # requirements, and does not yet fulfill the PEP.
5134  */
5135 
5136   /* function exit code */
5137   __pyx_r = 0;
5138   goto __pyx_L0;
5139   __pyx_L1_error:;
5140   __Pyx_XDECREF(__pyx_t_3);
5141   __Pyx_XDECREF(__pyx_t_8);
5142   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5143   __pyx_r = -1;
5144   if (__pyx_v_info->obj != NULL) {
5145     __Pyx_GOTREF(__pyx_v_info->obj);
5146     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
5147   }
5148   goto __pyx_L2;
5149   __pyx_L0:;
5150   if (__pyx_v_info->obj == Py_None) {
5151     __Pyx_GOTREF(__pyx_v_info->obj);
5152     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
5153   }
5154   __pyx_L2:;
5155   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
5156   __Pyx_RefNannyFinishContext();
5157   return __pyx_r;
5158 }
5159 
5160 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
5161  *                 f[0] = c'\0' # Terminate format string
5162  *
5163  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
5164  *             if PyArray_HASFIELDS(self):
5165  *                 PyObject_Free(info.format)
5166  */
5167 
5168 /* Python wrapper */
5169 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
__pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info)5170 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
5171   __Pyx_RefNannyDeclarations
5172   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
5173   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
5174 
5175   /* function exit code */
5176   __Pyx_RefNannyFinishContext();
5177 }
5178 
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info)5179 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
5180   __Pyx_RefNannyDeclarations
5181   int __pyx_t_1;
5182   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
5183 
5184   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
5185  *
5186  *         def __releasebuffer__(ndarray self, Py_buffer* info):
5187  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
5188  *                 PyObject_Free(info.format)
5189  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
5190  */
5191   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
5192   if (__pyx_t_1) {
5193 
5194     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339
5195  *         def __releasebuffer__(ndarray self, Py_buffer* info):
5196  *             if PyArray_HASFIELDS(self):
5197  *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
5198  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
5199  *                 PyObject_Free(info.strides)
5200  */
5201     PyObject_Free(__pyx_v_info->format);
5202 
5203     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
5204  *
5205  *         def __releasebuffer__(ndarray self, Py_buffer* info):
5206  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
5207  *                 PyObject_Free(info.format)
5208  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
5209  */
5210   }
5211 
5212   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
5213  *             if PyArray_HASFIELDS(self):
5214  *                 PyObject_Free(info.format)
5215  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
5216  *                 PyObject_Free(info.strides)
5217  *                 # info.shape was stored after info.strides in the same block
5218  */
5219   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
5220   if (__pyx_t_1) {
5221 
5222     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341
5223  *                 PyObject_Free(info.format)
5224  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
5225  *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
5226  *                 # info.shape was stored after info.strides in the same block
5227  *
5228  */
5229     PyObject_Free(__pyx_v_info->strides);
5230 
5231     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
5232  *             if PyArray_HASFIELDS(self):
5233  *                 PyObject_Free(info.format)
5234  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
5235  *                 PyObject_Free(info.strides)
5236  *                 # info.shape was stored after info.strides in the same block
5237  */
5238   }
5239 
5240   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
5241  *                 f[0] = c'\0' # Terminate format string
5242  *
5243  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
5244  *             if PyArray_HASFIELDS(self):
5245  *                 PyObject_Free(info.format)
5246  */
5247 
5248   /* function exit code */
5249   __Pyx_RefNannyFinishContext();
5250 }
5251 
5252 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
5253  * ctypedef npy_cdouble     complex_t
5254  *
5255  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
5256  *     return PyArray_MultiIterNew(1, <void*>a)
5257  *
5258  */
5259 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)5260 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
5261   PyObject *__pyx_r = NULL;
5262   __Pyx_RefNannyDeclarations
5263   PyObject *__pyx_t_1 = NULL;
5264   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
5265 
5266   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
5267  *
5268  * cdef inline object PyArray_MultiIterNew1(a):
5269  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
5270  *
5271  * cdef inline object PyArray_MultiIterNew2(a, b):
5272  */
5273   __Pyx_XDECREF(__pyx_r);
5274   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 822, __pyx_L1_error)
5275   __Pyx_GOTREF(__pyx_t_1);
5276   __pyx_r = __pyx_t_1;
5277   __pyx_t_1 = 0;
5278   goto __pyx_L0;
5279 
5280   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
5281  * ctypedef npy_cdouble     complex_t
5282  *
5283  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
5284  *     return PyArray_MultiIterNew(1, <void*>a)
5285  *
5286  */
5287 
5288   /* function exit code */
5289   __pyx_L1_error:;
5290   __Pyx_XDECREF(__pyx_t_1);
5291   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
5292   __pyx_r = 0;
5293   __pyx_L0:;
5294   __Pyx_XGIVEREF(__pyx_r);
5295   __Pyx_RefNannyFinishContext();
5296   return __pyx_r;
5297 }
5298 
5299 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
5300  *     return PyArray_MultiIterNew(1, <void*>a)
5301  *
5302  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
5303  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
5304  *
5305  */
5306 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)5307 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
5308   PyObject *__pyx_r = NULL;
5309   __Pyx_RefNannyDeclarations
5310   PyObject *__pyx_t_1 = NULL;
5311   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
5312 
5313   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
5314  *
5315  * cdef inline object PyArray_MultiIterNew2(a, b):
5316  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
5317  *
5318  * cdef inline object PyArray_MultiIterNew3(a, b, c):
5319  */
5320   __Pyx_XDECREF(__pyx_r);
5321   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 825, __pyx_L1_error)
5322   __Pyx_GOTREF(__pyx_t_1);
5323   __pyx_r = __pyx_t_1;
5324   __pyx_t_1 = 0;
5325   goto __pyx_L0;
5326 
5327   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
5328  *     return PyArray_MultiIterNew(1, <void*>a)
5329  *
5330  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
5331  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
5332  *
5333  */
5334 
5335   /* function exit code */
5336   __pyx_L1_error:;
5337   __Pyx_XDECREF(__pyx_t_1);
5338   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
5339   __pyx_r = 0;
5340   __pyx_L0:;
5341   __Pyx_XGIVEREF(__pyx_r);
5342   __Pyx_RefNannyFinishContext();
5343   return __pyx_r;
5344 }
5345 
5346 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
5347  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
5348  *
5349  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
5350  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
5351  *
5352  */
5353 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)5354 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
5355   PyObject *__pyx_r = NULL;
5356   __Pyx_RefNannyDeclarations
5357   PyObject *__pyx_t_1 = NULL;
5358   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
5359 
5360   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828
5361  *
5362  * cdef inline object PyArray_MultiIterNew3(a, b, c):
5363  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
5364  *
5365  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
5366  */
5367   __Pyx_XDECREF(__pyx_r);
5368   __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(2, 828, __pyx_L1_error)
5369   __Pyx_GOTREF(__pyx_t_1);
5370   __pyx_r = __pyx_t_1;
5371   __pyx_t_1 = 0;
5372   goto __pyx_L0;
5373 
5374   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
5375  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
5376  *
5377  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
5378  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
5379  *
5380  */
5381 
5382   /* function exit code */
5383   __pyx_L1_error:;
5384   __Pyx_XDECREF(__pyx_t_1);
5385   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
5386   __pyx_r = 0;
5387   __pyx_L0:;
5388   __Pyx_XGIVEREF(__pyx_r);
5389   __Pyx_RefNannyFinishContext();
5390   return __pyx_r;
5391 }
5392 
5393 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
5394  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
5395  *
5396  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
5397  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
5398  *
5399  */
5400 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)5401 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
5402   PyObject *__pyx_r = NULL;
5403   __Pyx_RefNannyDeclarations
5404   PyObject *__pyx_t_1 = NULL;
5405   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
5406 
5407   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831
5408  *
5409  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
5410  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
5411  *
5412  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
5413  */
5414   __Pyx_XDECREF(__pyx_r);
5415   __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(2, 831, __pyx_L1_error)
5416   __Pyx_GOTREF(__pyx_t_1);
5417   __pyx_r = __pyx_t_1;
5418   __pyx_t_1 = 0;
5419   goto __pyx_L0;
5420 
5421   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
5422  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
5423  *
5424  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
5425  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
5426  *
5427  */
5428 
5429   /* function exit code */
5430   __pyx_L1_error:;
5431   __Pyx_XDECREF(__pyx_t_1);
5432   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
5433   __pyx_r = 0;
5434   __pyx_L0:;
5435   __Pyx_XGIVEREF(__pyx_r);
5436   __Pyx_RefNannyFinishContext();
5437   return __pyx_r;
5438 }
5439 
5440 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
5441  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
5442  *
5443  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
5444  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
5445  *
5446  */
5447 
__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)5448 static 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) {
5449   PyObject *__pyx_r = NULL;
5450   __Pyx_RefNannyDeclarations
5451   PyObject *__pyx_t_1 = NULL;
5452   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
5453 
5454   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834
5455  *
5456  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
5457  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
5458  *
5459  * cdef inline tuple PyDataType_SHAPE(dtype d):
5460  */
5461   __Pyx_XDECREF(__pyx_r);
5462   __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(2, 834, __pyx_L1_error)
5463   __Pyx_GOTREF(__pyx_t_1);
5464   __pyx_r = __pyx_t_1;
5465   __pyx_t_1 = 0;
5466   goto __pyx_L0;
5467 
5468   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
5469  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
5470  *
5471  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
5472  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
5473  *
5474  */
5475 
5476   /* function exit code */
5477   __pyx_L1_error:;
5478   __Pyx_XDECREF(__pyx_t_1);
5479   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
5480   __pyx_r = 0;
5481   __pyx_L0:;
5482   __Pyx_XGIVEREF(__pyx_r);
5483   __Pyx_RefNannyFinishContext();
5484   return __pyx_r;
5485 }
5486 
5487 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
5488  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
5489  *
5490  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
5491  *     if PyDataType_HASSUBARRAY(d):
5492  *         return <tuple>d.subarray.shape
5493  */
5494 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)5495 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
5496   PyObject *__pyx_r = NULL;
5497   __Pyx_RefNannyDeclarations
5498   int __pyx_t_1;
5499   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
5500 
5501   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
5502  *
5503  * cdef inline tuple PyDataType_SHAPE(dtype d):
5504  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
5505  *         return <tuple>d.subarray.shape
5506  *     else:
5507  */
5508   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
5509   if (__pyx_t_1) {
5510 
5511     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838
5512  * cdef inline tuple PyDataType_SHAPE(dtype d):
5513  *     if PyDataType_HASSUBARRAY(d):
5514  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
5515  *     else:
5516  *         return ()
5517  */
5518     __Pyx_XDECREF(__pyx_r);
5519     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
5520     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
5521     goto __pyx_L0;
5522 
5523     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
5524  *
5525  * cdef inline tuple PyDataType_SHAPE(dtype d):
5526  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
5527  *         return <tuple>d.subarray.shape
5528  *     else:
5529  */
5530   }
5531 
5532   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840
5533  *         return <tuple>d.subarray.shape
5534  *     else:
5535  *         return ()             # <<<<<<<<<<<<<<
5536  *
5537  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
5538  */
5539   /*else*/ {
5540     __Pyx_XDECREF(__pyx_r);
5541     __Pyx_INCREF(__pyx_empty_tuple);
5542     __pyx_r = __pyx_empty_tuple;
5543     goto __pyx_L0;
5544   }
5545 
5546   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
5547  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
5548  *
5549  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
5550  *     if PyDataType_HASSUBARRAY(d):
5551  *         return <tuple>d.subarray.shape
5552  */
5553 
5554   /* function exit code */
5555   __pyx_L0:;
5556   __Pyx_XGIVEREF(__pyx_r);
5557   __Pyx_RefNannyFinishContext();
5558   return __pyx_r;
5559 }
5560 
5561 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
5562  *         return ()
5563  *
5564  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
5565  *     # Recursive utility function used in __getbuffer__ to get format
5566  *     # string. The new location in the format string is returned.
5567  */
5568 
__pyx_f_5numpy__util_dtypestring(PyArray_Descr * __pyx_v_descr,char * __pyx_v_f,char * __pyx_v_end,int * __pyx_v_offset)5569 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
5570   PyArray_Descr *__pyx_v_child = 0;
5571   int __pyx_v_endian_detector;
5572   int __pyx_v_little_endian;
5573   PyObject *__pyx_v_fields = 0;
5574   PyObject *__pyx_v_childname = NULL;
5575   PyObject *__pyx_v_new_offset = NULL;
5576   PyObject *__pyx_v_t = NULL;
5577   char *__pyx_r;
5578   __Pyx_RefNannyDeclarations
5579   PyObject *__pyx_t_1 = NULL;
5580   Py_ssize_t __pyx_t_2;
5581   PyObject *__pyx_t_3 = NULL;
5582   PyObject *__pyx_t_4 = NULL;
5583   int __pyx_t_5;
5584   int __pyx_t_6;
5585   int __pyx_t_7;
5586   long __pyx_t_8;
5587   char *__pyx_t_9;
5588   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
5589 
5590   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
5591  *
5592  *     cdef dtype child
5593  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
5594  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
5595  *     cdef tuple fields
5596  */
5597   __pyx_v_endian_detector = 1;
5598 
5599   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848
5600  *     cdef dtype child
5601  *     cdef int endian_detector = 1
5602  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
5603  *     cdef tuple fields
5604  *
5605  */
5606   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
5607 
5608   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
5609  *     cdef tuple fields
5610  *
5611  *     for childname in descr.names:             # <<<<<<<<<<<<<<
5612  *         fields = descr.fields[childname]
5613  *         child, new_offset = fields
5614  */
5615   if (unlikely(__pyx_v_descr->names == Py_None)) {
5616     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
5617     __PYX_ERR(2, 851, __pyx_L1_error)
5618   }
5619   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
5620   for (;;) {
5621     if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
5622     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5623     __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 851, __pyx_L1_error)
5624     #else
5625     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 851, __pyx_L1_error)
5626     __Pyx_GOTREF(__pyx_t_3);
5627     #endif
5628     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
5629     __pyx_t_3 = 0;
5630 
5631     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852
5632  *
5633  *     for childname in descr.names:
5634  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
5635  *         child, new_offset = fields
5636  *
5637  */
5638     if (unlikely(__pyx_v_descr->fields == Py_None)) {
5639       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5640       __PYX_ERR(2, 852, __pyx_L1_error)
5641     }
5642     __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 852, __pyx_L1_error)
5643     __Pyx_GOTREF(__pyx_t_3);
5644     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(2, 852, __pyx_L1_error)
5645     __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
5646     __pyx_t_3 = 0;
5647 
5648     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853
5649  *     for childname in descr.names:
5650  *         fields = descr.fields[childname]
5651  *         child, new_offset = fields             # <<<<<<<<<<<<<<
5652  *
5653  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
5654  */
5655     if (likely(__pyx_v_fields != Py_None)) {
5656       PyObject* sequence = __pyx_v_fields;
5657       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
5658       if (unlikely(size != 2)) {
5659         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
5660         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
5661         __PYX_ERR(2, 853, __pyx_L1_error)
5662       }
5663       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5664       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
5665       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
5666       __Pyx_INCREF(__pyx_t_3);
5667       __Pyx_INCREF(__pyx_t_4);
5668       #else
5669       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 853, __pyx_L1_error)
5670       __Pyx_GOTREF(__pyx_t_3);
5671       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 853, __pyx_L1_error)
5672       __Pyx_GOTREF(__pyx_t_4);
5673       #endif
5674     } else {
5675       __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 853, __pyx_L1_error)
5676     }
5677     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 853, __pyx_L1_error)
5678     __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
5679     __pyx_t_3 = 0;
5680     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
5681     __pyx_t_4 = 0;
5682 
5683     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
5684  *         child, new_offset = fields
5685  *
5686  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
5687  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
5688  *
5689  */
5690     __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 855, __pyx_L1_error)
5691     __Pyx_GOTREF(__pyx_t_4);
5692     __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 855, __pyx_L1_error)
5693     __Pyx_GOTREF(__pyx_t_3);
5694     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5695     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 855, __pyx_L1_error)
5696     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5697     __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
5698     if (unlikely(__pyx_t_6)) {
5699 
5700       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
5701  *
5702  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
5703  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
5704  *
5705  *         if ((child.byteorder == c'>' and little_endian) or
5706  */
5707       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 856, __pyx_L1_error)
5708       __Pyx_GOTREF(__pyx_t_3);
5709       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5710       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5711       __PYX_ERR(2, 856, __pyx_L1_error)
5712 
5713       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
5714  *         child, new_offset = fields
5715  *
5716  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
5717  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
5718  *
5719  */
5720     }
5721 
5722     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
5723  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
5724  *
5725  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
5726  *             (child.byteorder == c'<' and not little_endian)):
5727  *             raise ValueError(u"Non-native byte order not supported")
5728  */
5729     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
5730     if (!__pyx_t_7) {
5731       goto __pyx_L8_next_or;
5732     } else {
5733     }
5734     __pyx_t_7 = (__pyx_v_little_endian != 0);
5735     if (!__pyx_t_7) {
5736     } else {
5737       __pyx_t_6 = __pyx_t_7;
5738       goto __pyx_L7_bool_binop_done;
5739     }
5740     __pyx_L8_next_or:;
5741 
5742     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859
5743  *
5744  *         if ((child.byteorder == c'>' and little_endian) or
5745  *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
5746  *             raise ValueError(u"Non-native byte order not supported")
5747  *             # One could encode it in the format string and have Cython
5748  */
5749     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
5750     if (__pyx_t_7) {
5751     } else {
5752       __pyx_t_6 = __pyx_t_7;
5753       goto __pyx_L7_bool_binop_done;
5754     }
5755     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
5756     __pyx_t_6 = __pyx_t_7;
5757     __pyx_L7_bool_binop_done:;
5758 
5759     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
5760  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
5761  *
5762  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
5763  *             (child.byteorder == c'<' and not little_endian)):
5764  *             raise ValueError(u"Non-native byte order not supported")
5765  */
5766     if (unlikely(__pyx_t_6)) {
5767 
5768       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860
5769  *         if ((child.byteorder == c'>' and little_endian) or
5770  *             (child.byteorder == c'<' and not little_endian)):
5771  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
5772  *             # One could encode it in the format string and have Cython
5773  *             # complain instead, BUT: < and > in format strings also imply
5774  */
5775       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 860, __pyx_L1_error)
5776       __Pyx_GOTREF(__pyx_t_3);
5777       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5778       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5779       __PYX_ERR(2, 860, __pyx_L1_error)
5780 
5781       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
5782  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
5783  *
5784  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
5785  *             (child.byteorder == c'<' and not little_endian)):
5786  *             raise ValueError(u"Non-native byte order not supported")
5787  */
5788     }
5789 
5790     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870
5791  *
5792  *         # Output padding bytes
5793  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
5794  *             f[0] = 120 # "x"; pad byte
5795  *             f += 1
5796  */
5797     while (1) {
5798       __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 870, __pyx_L1_error)
5799       __Pyx_GOTREF(__pyx_t_3);
5800       __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 870, __pyx_L1_error)
5801       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5802       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 870, __pyx_L1_error)
5803       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5804       if (!__pyx_t_6) break;
5805 
5806       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871
5807  *         # Output padding bytes
5808  *         while offset[0] < new_offset:
5809  *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
5810  *             f += 1
5811  *             offset[0] += 1
5812  */
5813       (__pyx_v_f[0]) = 0x78;
5814 
5815       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872
5816  *         while offset[0] < new_offset:
5817  *             f[0] = 120 # "x"; pad byte
5818  *             f += 1             # <<<<<<<<<<<<<<
5819  *             offset[0] += 1
5820  *
5821  */
5822       __pyx_v_f = (__pyx_v_f + 1);
5823 
5824       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873
5825  *             f[0] = 120 # "x"; pad byte
5826  *             f += 1
5827  *             offset[0] += 1             # <<<<<<<<<<<<<<
5828  *
5829  *         offset[0] += child.itemsize
5830  */
5831       __pyx_t_8 = 0;
5832       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
5833     }
5834 
5835     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875
5836  *             offset[0] += 1
5837  *
5838  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
5839  *
5840  *         if not PyDataType_HASFIELDS(child):
5841  */
5842     __pyx_t_8 = 0;
5843     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
5844 
5845     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
5846  *         offset[0] += child.itemsize
5847  *
5848  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
5849  *             t = child.type_num
5850  *             if end - f < 5:
5851  */
5852     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
5853     if (__pyx_t_6) {
5854 
5855       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878
5856  *
5857  *         if not PyDataType_HASFIELDS(child):
5858  *             t = child.type_num             # <<<<<<<<<<<<<<
5859  *             if end - f < 5:
5860  *                 raise RuntimeError(u"Format string allocated too short.")
5861  */
5862       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 878, __pyx_L1_error)
5863       __Pyx_GOTREF(__pyx_t_4);
5864       __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
5865       __pyx_t_4 = 0;
5866 
5867       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
5868  *         if not PyDataType_HASFIELDS(child):
5869  *             t = child.type_num
5870  *             if end - f < 5:             # <<<<<<<<<<<<<<
5871  *                 raise RuntimeError(u"Format string allocated too short.")
5872  *
5873  */
5874       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
5875       if (unlikely(__pyx_t_6)) {
5876 
5877         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
5878  *             t = child.type_num
5879  *             if end - f < 5:
5880  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
5881  *
5882  *             # Until ticket #99 is fixed, use integers to avoid warnings
5883  */
5884         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 880, __pyx_L1_error)
5885         __Pyx_GOTREF(__pyx_t_4);
5886         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
5887         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5888         __PYX_ERR(2, 880, __pyx_L1_error)
5889 
5890         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
5891  *         if not PyDataType_HASFIELDS(child):
5892  *             t = child.type_num
5893  *             if end - f < 5:             # <<<<<<<<<<<<<<
5894  *                 raise RuntimeError(u"Format string allocated too short.")
5895  *
5896  */
5897       }
5898 
5899       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883
5900  *
5901  *             # Until ticket #99 is fixed, use integers to avoid warnings
5902  *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
5903  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
5904  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
5905  */
5906       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 883, __pyx_L1_error)
5907       __Pyx_GOTREF(__pyx_t_4);
5908       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 883, __pyx_L1_error)
5909       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5910       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 883, __pyx_L1_error)
5911       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5912       if (__pyx_t_6) {
5913         (__pyx_v_f[0]) = 98;
5914         goto __pyx_L15;
5915       }
5916 
5917       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884
5918  *             # Until ticket #99 is fixed, use integers to avoid warnings
5919  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
5920  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
5921  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
5922  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
5923  */
5924       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 884, __pyx_L1_error)
5925       __Pyx_GOTREF(__pyx_t_3);
5926       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 884, __pyx_L1_error)
5927       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5928       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 884, __pyx_L1_error)
5929       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5930       if (__pyx_t_6) {
5931         (__pyx_v_f[0]) = 66;
5932         goto __pyx_L15;
5933       }
5934 
5935       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885
5936  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
5937  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
5938  *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
5939  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
5940  *             elif t == NPY_INT:         f[0] = 105 #"i"
5941  */
5942       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 885, __pyx_L1_error)
5943       __Pyx_GOTREF(__pyx_t_4);
5944       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 885, __pyx_L1_error)
5945       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5946       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 885, __pyx_L1_error)
5947       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5948       if (__pyx_t_6) {
5949         (__pyx_v_f[0]) = 0x68;
5950         goto __pyx_L15;
5951       }
5952 
5953       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886
5954  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
5955  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
5956  *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
5957  *             elif t == NPY_INT:         f[0] = 105 #"i"
5958  *             elif t == NPY_UINT:        f[0] =  73 #"I"
5959  */
5960       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 886, __pyx_L1_error)
5961       __Pyx_GOTREF(__pyx_t_3);
5962       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 886, __pyx_L1_error)
5963       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5964       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 886, __pyx_L1_error)
5965       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5966       if (__pyx_t_6) {
5967         (__pyx_v_f[0]) = 72;
5968         goto __pyx_L15;
5969       }
5970 
5971       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887
5972  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
5973  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
5974  *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
5975  *             elif t == NPY_UINT:        f[0] =  73 #"I"
5976  *             elif t == NPY_LONG:        f[0] = 108 #"l"
5977  */
5978       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 887, __pyx_L1_error)
5979       __Pyx_GOTREF(__pyx_t_4);
5980       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 887, __pyx_L1_error)
5981       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5982       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 887, __pyx_L1_error)
5983       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5984       if (__pyx_t_6) {
5985         (__pyx_v_f[0]) = 0x69;
5986         goto __pyx_L15;
5987       }
5988 
5989       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888
5990  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
5991  *             elif t == NPY_INT:         f[0] = 105 #"i"
5992  *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
5993  *             elif t == NPY_LONG:        f[0] = 108 #"l"
5994  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
5995  */
5996       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 888, __pyx_L1_error)
5997       __Pyx_GOTREF(__pyx_t_3);
5998       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 888, __pyx_L1_error)
5999       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6000       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 888, __pyx_L1_error)
6001       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6002       if (__pyx_t_6) {
6003         (__pyx_v_f[0]) = 73;
6004         goto __pyx_L15;
6005       }
6006 
6007       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889
6008  *             elif t == NPY_INT:         f[0] = 105 #"i"
6009  *             elif t == NPY_UINT:        f[0] =  73 #"I"
6010  *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
6011  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
6012  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
6013  */
6014       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 889, __pyx_L1_error)
6015       __Pyx_GOTREF(__pyx_t_4);
6016       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 889, __pyx_L1_error)
6017       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6018       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 889, __pyx_L1_error)
6019       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6020       if (__pyx_t_6) {
6021         (__pyx_v_f[0]) = 0x6C;
6022         goto __pyx_L15;
6023       }
6024 
6025       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890
6026  *             elif t == NPY_UINT:        f[0] =  73 #"I"
6027  *             elif t == NPY_LONG:        f[0] = 108 #"l"
6028  *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
6029  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
6030  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
6031  */
6032       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 890, __pyx_L1_error)
6033       __Pyx_GOTREF(__pyx_t_3);
6034       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 890, __pyx_L1_error)
6035       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6036       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 890, __pyx_L1_error)
6037       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6038       if (__pyx_t_6) {
6039         (__pyx_v_f[0]) = 76;
6040         goto __pyx_L15;
6041       }
6042 
6043       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891
6044  *             elif t == NPY_LONG:        f[0] = 108 #"l"
6045  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
6046  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
6047  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
6048  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
6049  */
6050       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 891, __pyx_L1_error)
6051       __Pyx_GOTREF(__pyx_t_4);
6052       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 891, __pyx_L1_error)
6053       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6054       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 891, __pyx_L1_error)
6055       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6056       if (__pyx_t_6) {
6057         (__pyx_v_f[0]) = 0x71;
6058         goto __pyx_L15;
6059       }
6060 
6061       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892
6062  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
6063  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
6064  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
6065  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
6066  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
6067  */
6068       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 892, __pyx_L1_error)
6069       __Pyx_GOTREF(__pyx_t_3);
6070       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 892, __pyx_L1_error)
6071       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6072       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 892, __pyx_L1_error)
6073       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6074       if (__pyx_t_6) {
6075         (__pyx_v_f[0]) = 81;
6076         goto __pyx_L15;
6077       }
6078 
6079       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893
6080  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
6081  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
6082  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
6083  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
6084  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
6085  */
6086       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 893, __pyx_L1_error)
6087       __Pyx_GOTREF(__pyx_t_4);
6088       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 893, __pyx_L1_error)
6089       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6090       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 893, __pyx_L1_error)
6091       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6092       if (__pyx_t_6) {
6093         (__pyx_v_f[0]) = 0x66;
6094         goto __pyx_L15;
6095       }
6096 
6097       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894
6098  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
6099  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
6100  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
6101  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
6102  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
6103  */
6104       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 894, __pyx_L1_error)
6105       __Pyx_GOTREF(__pyx_t_3);
6106       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 894, __pyx_L1_error)
6107       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6108       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 894, __pyx_L1_error)
6109       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6110       if (__pyx_t_6) {
6111         (__pyx_v_f[0]) = 0x64;
6112         goto __pyx_L15;
6113       }
6114 
6115       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895
6116  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
6117  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
6118  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
6119  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
6120  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
6121  */
6122       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 895, __pyx_L1_error)
6123       __Pyx_GOTREF(__pyx_t_4);
6124       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 895, __pyx_L1_error)
6125       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6126       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 895, __pyx_L1_error)
6127       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6128       if (__pyx_t_6) {
6129         (__pyx_v_f[0]) = 0x67;
6130         goto __pyx_L15;
6131       }
6132 
6133       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896
6134  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
6135  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
6136  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
6137  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
6138  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
6139  */
6140       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 896, __pyx_L1_error)
6141       __Pyx_GOTREF(__pyx_t_3);
6142       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 896, __pyx_L1_error)
6143       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6144       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 896, __pyx_L1_error)
6145       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6146       if (__pyx_t_6) {
6147         (__pyx_v_f[0]) = 90;
6148         (__pyx_v_f[1]) = 0x66;
6149         __pyx_v_f = (__pyx_v_f + 1);
6150         goto __pyx_L15;
6151       }
6152 
6153       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897
6154  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
6155  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
6156  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
6157  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
6158  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
6159  */
6160       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 897, __pyx_L1_error)
6161       __Pyx_GOTREF(__pyx_t_4);
6162       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 897, __pyx_L1_error)
6163       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6164       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 897, __pyx_L1_error)
6165       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6166       if (__pyx_t_6) {
6167         (__pyx_v_f[0]) = 90;
6168         (__pyx_v_f[1]) = 0x64;
6169         __pyx_v_f = (__pyx_v_f + 1);
6170         goto __pyx_L15;
6171       }
6172 
6173       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898
6174  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
6175  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
6176  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
6177  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
6178  *             else:
6179  */
6180       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 898, __pyx_L1_error)
6181       __Pyx_GOTREF(__pyx_t_3);
6182       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 898, __pyx_L1_error)
6183       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6184       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 898, __pyx_L1_error)
6185       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6186       if (__pyx_t_6) {
6187         (__pyx_v_f[0]) = 90;
6188         (__pyx_v_f[1]) = 0x67;
6189         __pyx_v_f = (__pyx_v_f + 1);
6190         goto __pyx_L15;
6191       }
6192 
6193       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899
6194  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
6195  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
6196  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
6197  *             else:
6198  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6199  */
6200       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 899, __pyx_L1_error)
6201       __Pyx_GOTREF(__pyx_t_4);
6202       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 899, __pyx_L1_error)
6203       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6204       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 899, __pyx_L1_error)
6205       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6206       if (likely(__pyx_t_6)) {
6207         (__pyx_v_f[0]) = 79;
6208         goto __pyx_L15;
6209       }
6210 
6211       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901
6212  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
6213  *             else:
6214  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
6215  *             f += 1
6216  *         else:
6217  */
6218       /*else*/ {
6219         __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 901, __pyx_L1_error)
6220         __Pyx_GOTREF(__pyx_t_3);
6221         __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 901, __pyx_L1_error)
6222         __Pyx_GOTREF(__pyx_t_4);
6223         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6224         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6225         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6226         __PYX_ERR(2, 901, __pyx_L1_error)
6227       }
6228       __pyx_L15:;
6229 
6230       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902
6231  *             else:
6232  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6233  *             f += 1             # <<<<<<<<<<<<<<
6234  *         else:
6235  *             # Cython ignores struct boundary information ("T{...}"),
6236  */
6237       __pyx_v_f = (__pyx_v_f + 1);
6238 
6239       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
6240  *         offset[0] += child.itemsize
6241  *
6242  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
6243  *             t = child.type_num
6244  *             if end - f < 5:
6245  */
6246       goto __pyx_L13;
6247     }
6248 
6249     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906
6250  *             # Cython ignores struct boundary information ("T{...}"),
6251  *             # so don't output it
6252  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
6253  *     return f
6254  *
6255  */
6256     /*else*/ {
6257       __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 906, __pyx_L1_error)
6258       __pyx_v_f = __pyx_t_9;
6259     }
6260     __pyx_L13:;
6261 
6262     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
6263  *     cdef tuple fields
6264  *
6265  *     for childname in descr.names:             # <<<<<<<<<<<<<<
6266  *         fields = descr.fields[childname]
6267  *         child, new_offset = fields
6268  */
6269   }
6270   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6271 
6272   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907
6273  *             # so don't output it
6274  *             f = _util_dtypestring(child, f, end, offset)
6275  *     return f             # <<<<<<<<<<<<<<
6276  *
6277  *
6278  */
6279   __pyx_r = __pyx_v_f;
6280   goto __pyx_L0;
6281 
6282   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
6283  *         return ()
6284  *
6285  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
6286  *     # Recursive utility function used in __getbuffer__ to get format
6287  *     # string. The new location in the format string is returned.
6288  */
6289 
6290   /* function exit code */
6291   __pyx_L1_error:;
6292   __Pyx_XDECREF(__pyx_t_1);
6293   __Pyx_XDECREF(__pyx_t_3);
6294   __Pyx_XDECREF(__pyx_t_4);
6295   __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
6296   __pyx_r = NULL;
6297   __pyx_L0:;
6298   __Pyx_XDECREF((PyObject *)__pyx_v_child);
6299   __Pyx_XDECREF(__pyx_v_fields);
6300   __Pyx_XDECREF(__pyx_v_childname);
6301   __Pyx_XDECREF(__pyx_v_new_offset);
6302   __Pyx_XDECREF(__pyx_v_t);
6303   __Pyx_RefNannyFinishContext();
6304   return __pyx_r;
6305 }
6306 
6307 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
6308  *     int _import_umath() except -1
6309  *
6310  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
6311  *     Py_INCREF(base) # important to do this before stealing the reference below!
6312  *     PyArray_SetBaseObject(arr, base)
6313  */
6314 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)6315 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
6316   __Pyx_RefNannyDeclarations
6317   __Pyx_RefNannySetupContext("set_array_base", 0);
6318 
6319   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023
6320  *
6321  * cdef inline void set_array_base(ndarray arr, object base):
6322  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
6323  *     PyArray_SetBaseObject(arr, base)
6324  *
6325  */
6326   Py_INCREF(__pyx_v_base);
6327 
6328   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024
6329  * cdef inline void set_array_base(ndarray arr, object base):
6330  *     Py_INCREF(base) # important to do this before stealing the reference below!
6331  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
6332  *
6333  * cdef inline object get_array_base(ndarray arr):
6334  */
6335   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
6336 
6337   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
6338  *     int _import_umath() except -1
6339  *
6340  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
6341  *     Py_INCREF(base) # important to do this before stealing the reference below!
6342  *     PyArray_SetBaseObject(arr, base)
6343  */
6344 
6345   /* function exit code */
6346   __Pyx_RefNannyFinishContext();
6347 }
6348 
6349 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
6350  *     PyArray_SetBaseObject(arr, base)
6351  *
6352  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
6353  *     base = PyArray_BASE(arr)
6354  *     if base is NULL:
6355  */
6356 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)6357 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
6358   PyObject *__pyx_v_base;
6359   PyObject *__pyx_r = NULL;
6360   __Pyx_RefNannyDeclarations
6361   int __pyx_t_1;
6362   __Pyx_RefNannySetupContext("get_array_base", 0);
6363 
6364   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027
6365  *
6366  * cdef inline object get_array_base(ndarray arr):
6367  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
6368  *     if base is NULL:
6369  *         return None
6370  */
6371   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
6372 
6373   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
6374  * cdef inline object get_array_base(ndarray arr):
6375  *     base = PyArray_BASE(arr)
6376  *     if base is NULL:             # <<<<<<<<<<<<<<
6377  *         return None
6378  *     return <object>base
6379  */
6380   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
6381   if (__pyx_t_1) {
6382 
6383     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029
6384  *     base = PyArray_BASE(arr)
6385  *     if base is NULL:
6386  *         return None             # <<<<<<<<<<<<<<
6387  *     return <object>base
6388  *
6389  */
6390     __Pyx_XDECREF(__pyx_r);
6391     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6392     goto __pyx_L0;
6393 
6394     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
6395  * cdef inline object get_array_base(ndarray arr):
6396  *     base = PyArray_BASE(arr)
6397  *     if base is NULL:             # <<<<<<<<<<<<<<
6398  *         return None
6399  *     return <object>base
6400  */
6401   }
6402 
6403   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030
6404  *     if base is NULL:
6405  *         return None
6406  *     return <object>base             # <<<<<<<<<<<<<<
6407  *
6408  * # Versions of the import_* functions which are more suitable for
6409  */
6410   __Pyx_XDECREF(__pyx_r);
6411   __Pyx_INCREF(((PyObject *)__pyx_v_base));
6412   __pyx_r = ((PyObject *)__pyx_v_base);
6413   goto __pyx_L0;
6414 
6415   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
6416  *     PyArray_SetBaseObject(arr, base)
6417  *
6418  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
6419  *     base = PyArray_BASE(arr)
6420  *     if base is NULL:
6421  */
6422 
6423   /* function exit code */
6424   __pyx_L0:;
6425   __Pyx_XGIVEREF(__pyx_r);
6426   __Pyx_RefNannyFinishContext();
6427   return __pyx_r;
6428 }
6429 
6430 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
6431  * # Versions of the import_* functions which are more suitable for
6432  * # Cython code.
6433  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
6434  *     try:
6435  *         _import_array()
6436  */
6437 
__pyx_f_5numpy_import_array(void)6438 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
6439   int __pyx_r;
6440   __Pyx_RefNannyDeclarations
6441   PyObject *__pyx_t_1 = NULL;
6442   PyObject *__pyx_t_2 = NULL;
6443   PyObject *__pyx_t_3 = NULL;
6444   int __pyx_t_4;
6445   PyObject *__pyx_t_5 = NULL;
6446   PyObject *__pyx_t_6 = NULL;
6447   PyObject *__pyx_t_7 = NULL;
6448   PyObject *__pyx_t_8 = NULL;
6449   __Pyx_RefNannySetupContext("import_array", 0);
6450 
6451   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
6452  * # Cython code.
6453  * cdef inline int import_array() except -1:
6454  *     try:             # <<<<<<<<<<<<<<
6455  *         _import_array()
6456  *     except Exception:
6457  */
6458   {
6459     __Pyx_PyThreadState_declare
6460     __Pyx_PyThreadState_assign
6461     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6462     __Pyx_XGOTREF(__pyx_t_1);
6463     __Pyx_XGOTREF(__pyx_t_2);
6464     __Pyx_XGOTREF(__pyx_t_3);
6465     /*try:*/ {
6466 
6467       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036
6468  * cdef inline int import_array() except -1:
6469  *     try:
6470  *         _import_array()             # <<<<<<<<<<<<<<
6471  *     except Exception:
6472  *         raise ImportError("numpy.core.multiarray failed to import")
6473  */
6474       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1036, __pyx_L3_error)
6475 
6476       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
6477  * # Cython code.
6478  * cdef inline int import_array() except -1:
6479  *     try:             # <<<<<<<<<<<<<<
6480  *         _import_array()
6481  *     except Exception:
6482  */
6483     }
6484     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6485     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6486     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6487     goto __pyx_L8_try_end;
6488     __pyx_L3_error:;
6489 
6490     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037
6491  *     try:
6492  *         _import_array()
6493  *     except Exception:             # <<<<<<<<<<<<<<
6494  *         raise ImportError("numpy.core.multiarray failed to import")
6495  *
6496  */
6497     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6498     if (__pyx_t_4) {
6499       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6500       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1037, __pyx_L5_except_error)
6501       __Pyx_GOTREF(__pyx_t_5);
6502       __Pyx_GOTREF(__pyx_t_6);
6503       __Pyx_GOTREF(__pyx_t_7);
6504 
6505       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
6506  *         _import_array()
6507  *     except Exception:
6508  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
6509  *
6510  * cdef inline int import_umath() except -1:
6511  */
6512       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1038, __pyx_L5_except_error)
6513       __Pyx_GOTREF(__pyx_t_8);
6514       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6515       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6516       __PYX_ERR(2, 1038, __pyx_L5_except_error)
6517     }
6518     goto __pyx_L5_except_error;
6519     __pyx_L5_except_error:;
6520 
6521     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
6522  * # Cython code.
6523  * cdef inline int import_array() except -1:
6524  *     try:             # <<<<<<<<<<<<<<
6525  *         _import_array()
6526  *     except Exception:
6527  */
6528     __Pyx_XGIVEREF(__pyx_t_1);
6529     __Pyx_XGIVEREF(__pyx_t_2);
6530     __Pyx_XGIVEREF(__pyx_t_3);
6531     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6532     goto __pyx_L1_error;
6533     __pyx_L8_try_end:;
6534   }
6535 
6536   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
6537  * # Versions of the import_* functions which are more suitable for
6538  * # Cython code.
6539  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
6540  *     try:
6541  *         _import_array()
6542  */
6543 
6544   /* function exit code */
6545   __pyx_r = 0;
6546   goto __pyx_L0;
6547   __pyx_L1_error:;
6548   __Pyx_XDECREF(__pyx_t_5);
6549   __Pyx_XDECREF(__pyx_t_6);
6550   __Pyx_XDECREF(__pyx_t_7);
6551   __Pyx_XDECREF(__pyx_t_8);
6552   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6553   __pyx_r = -1;
6554   __pyx_L0:;
6555   __Pyx_RefNannyFinishContext();
6556   return __pyx_r;
6557 }
6558 
6559 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
6560  *         raise ImportError("numpy.core.multiarray failed to import")
6561  *
6562  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
6563  *     try:
6564  *         _import_umath()
6565  */
6566 
__pyx_f_5numpy_import_umath(void)6567 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
6568   int __pyx_r;
6569   __Pyx_RefNannyDeclarations
6570   PyObject *__pyx_t_1 = NULL;
6571   PyObject *__pyx_t_2 = NULL;
6572   PyObject *__pyx_t_3 = NULL;
6573   int __pyx_t_4;
6574   PyObject *__pyx_t_5 = NULL;
6575   PyObject *__pyx_t_6 = NULL;
6576   PyObject *__pyx_t_7 = NULL;
6577   PyObject *__pyx_t_8 = NULL;
6578   __Pyx_RefNannySetupContext("import_umath", 0);
6579 
6580   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
6581  *
6582  * cdef inline int import_umath() except -1:
6583  *     try:             # <<<<<<<<<<<<<<
6584  *         _import_umath()
6585  *     except Exception:
6586  */
6587   {
6588     __Pyx_PyThreadState_declare
6589     __Pyx_PyThreadState_assign
6590     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6591     __Pyx_XGOTREF(__pyx_t_1);
6592     __Pyx_XGOTREF(__pyx_t_2);
6593     __Pyx_XGOTREF(__pyx_t_3);
6594     /*try:*/ {
6595 
6596       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042
6597  * cdef inline int import_umath() except -1:
6598  *     try:
6599  *         _import_umath()             # <<<<<<<<<<<<<<
6600  *     except Exception:
6601  *         raise ImportError("numpy.core.umath failed to import")
6602  */
6603       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1042, __pyx_L3_error)
6604 
6605       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
6606  *
6607  * cdef inline int import_umath() except -1:
6608  *     try:             # <<<<<<<<<<<<<<
6609  *         _import_umath()
6610  *     except Exception:
6611  */
6612     }
6613     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6614     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6615     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6616     goto __pyx_L8_try_end;
6617     __pyx_L3_error:;
6618 
6619     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043
6620  *     try:
6621  *         _import_umath()
6622  *     except Exception:             # <<<<<<<<<<<<<<
6623  *         raise ImportError("numpy.core.umath failed to import")
6624  *
6625  */
6626     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6627     if (__pyx_t_4) {
6628       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6629       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1043, __pyx_L5_except_error)
6630       __Pyx_GOTREF(__pyx_t_5);
6631       __Pyx_GOTREF(__pyx_t_6);
6632       __Pyx_GOTREF(__pyx_t_7);
6633 
6634       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
6635  *         _import_umath()
6636  *     except Exception:
6637  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
6638  *
6639  * cdef inline int import_ufunc() except -1:
6640  */
6641       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1044, __pyx_L5_except_error)
6642       __Pyx_GOTREF(__pyx_t_8);
6643       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6644       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6645       __PYX_ERR(2, 1044, __pyx_L5_except_error)
6646     }
6647     goto __pyx_L5_except_error;
6648     __pyx_L5_except_error:;
6649 
6650     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
6651  *
6652  * cdef inline int import_umath() except -1:
6653  *     try:             # <<<<<<<<<<<<<<
6654  *         _import_umath()
6655  *     except Exception:
6656  */
6657     __Pyx_XGIVEREF(__pyx_t_1);
6658     __Pyx_XGIVEREF(__pyx_t_2);
6659     __Pyx_XGIVEREF(__pyx_t_3);
6660     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6661     goto __pyx_L1_error;
6662     __pyx_L8_try_end:;
6663   }
6664 
6665   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
6666  *         raise ImportError("numpy.core.multiarray failed to import")
6667  *
6668  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
6669  *     try:
6670  *         _import_umath()
6671  */
6672 
6673   /* function exit code */
6674   __pyx_r = 0;
6675   goto __pyx_L0;
6676   __pyx_L1_error:;
6677   __Pyx_XDECREF(__pyx_t_5);
6678   __Pyx_XDECREF(__pyx_t_6);
6679   __Pyx_XDECREF(__pyx_t_7);
6680   __Pyx_XDECREF(__pyx_t_8);
6681   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6682   __pyx_r = -1;
6683   __pyx_L0:;
6684   __Pyx_RefNannyFinishContext();
6685   return __pyx_r;
6686 }
6687 
6688 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
6689  *         raise ImportError("numpy.core.umath failed to import")
6690  *
6691  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
6692  *     try:
6693  *         _import_umath()
6694  */
6695 
__pyx_f_5numpy_import_ufunc(void)6696 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
6697   int __pyx_r;
6698   __Pyx_RefNannyDeclarations
6699   PyObject *__pyx_t_1 = NULL;
6700   PyObject *__pyx_t_2 = NULL;
6701   PyObject *__pyx_t_3 = NULL;
6702   int __pyx_t_4;
6703   PyObject *__pyx_t_5 = NULL;
6704   PyObject *__pyx_t_6 = NULL;
6705   PyObject *__pyx_t_7 = NULL;
6706   PyObject *__pyx_t_8 = NULL;
6707   __Pyx_RefNannySetupContext("import_ufunc", 0);
6708 
6709   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
6710  *
6711  * cdef inline int import_ufunc() except -1:
6712  *     try:             # <<<<<<<<<<<<<<
6713  *         _import_umath()
6714  *     except Exception:
6715  */
6716   {
6717     __Pyx_PyThreadState_declare
6718     __Pyx_PyThreadState_assign
6719     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6720     __Pyx_XGOTREF(__pyx_t_1);
6721     __Pyx_XGOTREF(__pyx_t_2);
6722     __Pyx_XGOTREF(__pyx_t_3);
6723     /*try:*/ {
6724 
6725       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048
6726  * cdef inline int import_ufunc() except -1:
6727  *     try:
6728  *         _import_umath()             # <<<<<<<<<<<<<<
6729  *     except Exception:
6730  *         raise ImportError("numpy.core.umath failed to import")
6731  */
6732       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1048, __pyx_L3_error)
6733 
6734       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
6735  *
6736  * cdef inline int import_ufunc() except -1:
6737  *     try:             # <<<<<<<<<<<<<<
6738  *         _import_umath()
6739  *     except Exception:
6740  */
6741     }
6742     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6743     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6744     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6745     goto __pyx_L8_try_end;
6746     __pyx_L3_error:;
6747 
6748     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049
6749  *     try:
6750  *         _import_umath()
6751  *     except Exception:             # <<<<<<<<<<<<<<
6752  *         raise ImportError("numpy.core.umath failed to import")
6753  */
6754     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6755     if (__pyx_t_4) {
6756       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6757       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1049, __pyx_L5_except_error)
6758       __Pyx_GOTREF(__pyx_t_5);
6759       __Pyx_GOTREF(__pyx_t_6);
6760       __Pyx_GOTREF(__pyx_t_7);
6761 
6762       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050
6763  *         _import_umath()
6764  *     except Exception:
6765  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
6766  */
6767       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1050, __pyx_L5_except_error)
6768       __Pyx_GOTREF(__pyx_t_8);
6769       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6770       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6771       __PYX_ERR(2, 1050, __pyx_L5_except_error)
6772     }
6773     goto __pyx_L5_except_error;
6774     __pyx_L5_except_error:;
6775 
6776     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
6777  *
6778  * cdef inline int import_ufunc() except -1:
6779  *     try:             # <<<<<<<<<<<<<<
6780  *         _import_umath()
6781  *     except Exception:
6782  */
6783     __Pyx_XGIVEREF(__pyx_t_1);
6784     __Pyx_XGIVEREF(__pyx_t_2);
6785     __Pyx_XGIVEREF(__pyx_t_3);
6786     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6787     goto __pyx_L1_error;
6788     __pyx_L8_try_end:;
6789   }
6790 
6791   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
6792  *         raise ImportError("numpy.core.umath failed to import")
6793  *
6794  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
6795  *     try:
6796  *         _import_umath()
6797  */
6798 
6799   /* function exit code */
6800   __pyx_r = 0;
6801   goto __pyx_L0;
6802   __pyx_L1_error:;
6803   __Pyx_XDECREF(__pyx_t_5);
6804   __Pyx_XDECREF(__pyx_t_6);
6805   __Pyx_XDECREF(__pyx_t_7);
6806   __Pyx_XDECREF(__pyx_t_8);
6807   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6808   __pyx_r = -1;
6809   __pyx_L0:;
6810   __Pyx_RefNannyFinishContext();
6811   return __pyx_r;
6812 }
6813 
6814 /* "View.MemoryView":122
6815  *         cdef bint dtype_is_object
6816  *
6817  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
6818  *                   mode="c", bint allocate_buffer=True):
6819  *
6820  */
6821 
6822 /* Python wrapper */
6823 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_array___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6824 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6825   PyObject *__pyx_v_shape = 0;
6826   Py_ssize_t __pyx_v_itemsize;
6827   PyObject *__pyx_v_format = 0;
6828   PyObject *__pyx_v_mode = 0;
6829   int __pyx_v_allocate_buffer;
6830   int __pyx_r;
6831   __Pyx_RefNannyDeclarations
6832   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
6833   {
6834     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};
6835     PyObject* values[5] = {0,0,0,0,0};
6836     values[3] = ((PyObject *)__pyx_n_s_c);
6837     if (unlikely(__pyx_kwds)) {
6838       Py_ssize_t kw_args;
6839       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6840       switch (pos_args) {
6841         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6842         CYTHON_FALLTHROUGH;
6843         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6844         CYTHON_FALLTHROUGH;
6845         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6846         CYTHON_FALLTHROUGH;
6847         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6848         CYTHON_FALLTHROUGH;
6849         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6850         CYTHON_FALLTHROUGH;
6851         case  0: break;
6852         default: goto __pyx_L5_argtuple_error;
6853       }
6854       kw_args = PyDict_Size(__pyx_kwds);
6855       switch (pos_args) {
6856         case  0:
6857         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
6858         else goto __pyx_L5_argtuple_error;
6859         CYTHON_FALLTHROUGH;
6860         case  1:
6861         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
6862         else {
6863           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
6864         }
6865         CYTHON_FALLTHROUGH;
6866         case  2:
6867         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
6868         else {
6869           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
6870         }
6871         CYTHON_FALLTHROUGH;
6872         case  3:
6873         if (kw_args > 0) {
6874           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
6875           if (value) { values[3] = value; kw_args--; }
6876         }
6877         CYTHON_FALLTHROUGH;
6878         case  4:
6879         if (kw_args > 0) {
6880           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
6881           if (value) { values[4] = value; kw_args--; }
6882         }
6883       }
6884       if (unlikely(kw_args > 0)) {
6885         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
6886       }
6887     } else {
6888       switch (PyTuple_GET_SIZE(__pyx_args)) {
6889         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6890         CYTHON_FALLTHROUGH;
6891         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6892         CYTHON_FALLTHROUGH;
6893         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6894         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6895         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6896         break;
6897         default: goto __pyx_L5_argtuple_error;
6898       }
6899     }
6900     __pyx_v_shape = ((PyObject*)values[0]);
6901     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
6902     __pyx_v_format = values[2];
6903     __pyx_v_mode = values[3];
6904     if (values[4]) {
6905       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
6906     } else {
6907 
6908       /* "View.MemoryView":123
6909  *
6910  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
6911  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
6912  *
6913  *         cdef int idx
6914  */
6915       __pyx_v_allocate_buffer = ((int)1);
6916     }
6917   }
6918   goto __pyx_L4_argument_unpacking_done;
6919   __pyx_L5_argtuple_error:;
6920   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
6921   __pyx_L3_error:;
6922   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6923   __Pyx_RefNannyFinishContext();
6924   return -1;
6925   __pyx_L4_argument_unpacking_done:;
6926   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
6927   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
6928     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 122, __pyx_L1_error)
6929   }
6930   __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);
6931 
6932   /* "View.MemoryView":122
6933  *         cdef bint dtype_is_object
6934  *
6935  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
6936  *                   mode="c", bint allocate_buffer=True):
6937  *
6938  */
6939 
6940   /* function exit code */
6941   goto __pyx_L0;
6942   __pyx_L1_error:;
6943   __pyx_r = -1;
6944   __pyx_L0:;
6945   __Pyx_RefNannyFinishContext();
6946   return __pyx_r;
6947 }
6948 
__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)6949 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
6950   int __pyx_v_idx;
6951   Py_ssize_t __pyx_v_i;
6952   Py_ssize_t __pyx_v_dim;
6953   PyObject **__pyx_v_p;
6954   char __pyx_v_order;
6955   int __pyx_r;
6956   __Pyx_RefNannyDeclarations
6957   Py_ssize_t __pyx_t_1;
6958   int __pyx_t_2;
6959   PyObject *__pyx_t_3 = NULL;
6960   int __pyx_t_4;
6961   PyObject *__pyx_t_5 = NULL;
6962   PyObject *__pyx_t_6 = NULL;
6963   char *__pyx_t_7;
6964   int __pyx_t_8;
6965   Py_ssize_t __pyx_t_9;
6966   PyObject *__pyx_t_10 = NULL;
6967   Py_ssize_t __pyx_t_11;
6968   __Pyx_RefNannySetupContext("__cinit__", 0);
6969   __Pyx_INCREF(__pyx_v_format);
6970 
6971   /* "View.MemoryView":129
6972  *         cdef PyObject **p
6973  *
6974  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
6975  *         self.itemsize = itemsize
6976  *
6977  */
6978   if (unlikely(__pyx_v_shape == Py_None)) {
6979     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
6980     __PYX_ERR(1, 129, __pyx_L1_error)
6981   }
6982   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
6983   __pyx_v_self->ndim = ((int)__pyx_t_1);
6984 
6985   /* "View.MemoryView":130
6986  *
6987  *         self.ndim = <int> len(shape)
6988  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
6989  *
6990  *         if not self.ndim:
6991  */
6992   __pyx_v_self->itemsize = __pyx_v_itemsize;
6993 
6994   /* "View.MemoryView":132
6995  *         self.itemsize = itemsize
6996  *
6997  *         if not self.ndim:             # <<<<<<<<<<<<<<
6998  *             raise ValueError("Empty shape tuple for cython.array")
6999  *
7000  */
7001   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
7002   if (unlikely(__pyx_t_2)) {
7003 
7004     /* "View.MemoryView":133
7005  *
7006  *         if not self.ndim:
7007  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
7008  *
7009  *         if itemsize <= 0:
7010  */
7011     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
7012     __Pyx_GOTREF(__pyx_t_3);
7013     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7014     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7015     __PYX_ERR(1, 133, __pyx_L1_error)
7016 
7017     /* "View.MemoryView":132
7018  *         self.itemsize = itemsize
7019  *
7020  *         if not self.ndim:             # <<<<<<<<<<<<<<
7021  *             raise ValueError("Empty shape tuple for cython.array")
7022  *
7023  */
7024   }
7025 
7026   /* "View.MemoryView":135
7027  *             raise ValueError("Empty shape tuple for cython.array")
7028  *
7029  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
7030  *             raise ValueError("itemsize <= 0 for cython.array")
7031  *
7032  */
7033   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
7034   if (unlikely(__pyx_t_2)) {
7035 
7036     /* "View.MemoryView":136
7037  *
7038  *         if itemsize <= 0:
7039  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
7040  *
7041  *         if not isinstance(format, bytes):
7042  */
7043     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
7044     __Pyx_GOTREF(__pyx_t_3);
7045     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7046     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7047     __PYX_ERR(1, 136, __pyx_L1_error)
7048 
7049     /* "View.MemoryView":135
7050  *             raise ValueError("Empty shape tuple for cython.array")
7051  *
7052  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
7053  *             raise ValueError("itemsize <= 0 for cython.array")
7054  *
7055  */
7056   }
7057 
7058   /* "View.MemoryView":138
7059  *             raise ValueError("itemsize <= 0 for cython.array")
7060  *
7061  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
7062  *             format = format.encode('ASCII')
7063  *         self._format = format  # keep a reference to the byte string
7064  */
7065   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
7066   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
7067   if (__pyx_t_4) {
7068 
7069     /* "View.MemoryView":139
7070  *
7071  *         if not isinstance(format, bytes):
7072  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
7073  *         self._format = format  # keep a reference to the byte string
7074  *         self.format = self._format
7075  */
7076     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
7077     __Pyx_GOTREF(__pyx_t_5);
7078     __pyx_t_6 = NULL;
7079     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7080       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7081       if (likely(__pyx_t_6)) {
7082         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7083         __Pyx_INCREF(__pyx_t_6);
7084         __Pyx_INCREF(function);
7085         __Pyx_DECREF_SET(__pyx_t_5, function);
7086       }
7087     }
7088     __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);
7089     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7090     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
7091     __Pyx_GOTREF(__pyx_t_3);
7092     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7093     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
7094     __pyx_t_3 = 0;
7095 
7096     /* "View.MemoryView":138
7097  *             raise ValueError("itemsize <= 0 for cython.array")
7098  *
7099  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
7100  *             format = format.encode('ASCII')
7101  *         self._format = format  # keep a reference to the byte string
7102  */
7103   }
7104 
7105   /* "View.MemoryView":140
7106  *         if not isinstance(format, bytes):
7107  *             format = format.encode('ASCII')
7108  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
7109  *         self.format = self._format
7110  *
7111  */
7112   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(1, 140, __pyx_L1_error)
7113   __pyx_t_3 = __pyx_v_format;
7114   __Pyx_INCREF(__pyx_t_3);
7115   __Pyx_GIVEREF(__pyx_t_3);
7116   __Pyx_GOTREF(__pyx_v_self->_format);
7117   __Pyx_DECREF(__pyx_v_self->_format);
7118   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
7119   __pyx_t_3 = 0;
7120 
7121   /* "View.MemoryView":141
7122  *             format = format.encode('ASCII')
7123  *         self._format = format  # keep a reference to the byte string
7124  *         self.format = self._format             # <<<<<<<<<<<<<<
7125  *
7126  *
7127  */
7128   if (unlikely(__pyx_v_self->_format == Py_None)) {
7129     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
7130     __PYX_ERR(1, 141, __pyx_L1_error)
7131   }
7132   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
7133   __pyx_v_self->format = __pyx_t_7;
7134 
7135   /* "View.MemoryView":144
7136  *
7137  *
7138  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
7139  *         self._strides = self._shape + self.ndim
7140  *
7141  */
7142   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
7143 
7144   /* "View.MemoryView":145
7145  *
7146  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
7147  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
7148  *
7149  *         if not self._shape:
7150  */
7151   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
7152 
7153   /* "View.MemoryView":147
7154  *         self._strides = self._shape + self.ndim
7155  *
7156  *         if not self._shape:             # <<<<<<<<<<<<<<
7157  *             raise MemoryError("unable to allocate shape and strides.")
7158  *
7159  */
7160   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
7161   if (unlikely(__pyx_t_4)) {
7162 
7163     /* "View.MemoryView":148
7164  *
7165  *         if not self._shape:
7166  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
7167  *
7168  *
7169  */
7170     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
7171     __Pyx_GOTREF(__pyx_t_3);
7172     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7173     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7174     __PYX_ERR(1, 148, __pyx_L1_error)
7175 
7176     /* "View.MemoryView":147
7177  *         self._strides = self._shape + self.ndim
7178  *
7179  *         if not self._shape:             # <<<<<<<<<<<<<<
7180  *             raise MemoryError("unable to allocate shape and strides.")
7181  *
7182  */
7183   }
7184 
7185   /* "View.MemoryView":151
7186  *
7187  *
7188  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
7189  *             if dim <= 0:
7190  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7191  */
7192   __pyx_t_8 = 0;
7193   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
7194   for (;;) {
7195     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
7196     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7197     __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(1, 151, __pyx_L1_error)
7198     #else
7199     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
7200     __Pyx_GOTREF(__pyx_t_5);
7201     #endif
7202     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
7203     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7204     __pyx_v_dim = __pyx_t_9;
7205     __pyx_v_idx = __pyx_t_8;
7206     __pyx_t_8 = (__pyx_t_8 + 1);
7207 
7208     /* "View.MemoryView":152
7209  *
7210  *         for idx, dim in enumerate(shape):
7211  *             if dim <= 0:             # <<<<<<<<<<<<<<
7212  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7213  *             self._shape[idx] = dim
7214  */
7215     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
7216     if (unlikely(__pyx_t_4)) {
7217 
7218       /* "View.MemoryView":153
7219  *         for idx, dim in enumerate(shape):
7220  *             if dim <= 0:
7221  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
7222  *             self._shape[idx] = dim
7223  *
7224  */
7225       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
7226       __Pyx_GOTREF(__pyx_t_5);
7227       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
7228       __Pyx_GOTREF(__pyx_t_6);
7229       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
7230       __Pyx_GOTREF(__pyx_t_10);
7231       __Pyx_GIVEREF(__pyx_t_5);
7232       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
7233       __Pyx_GIVEREF(__pyx_t_6);
7234       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
7235       __pyx_t_5 = 0;
7236       __pyx_t_6 = 0;
7237       __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(1, 153, __pyx_L1_error)
7238       __Pyx_GOTREF(__pyx_t_6);
7239       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7240       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
7241       __Pyx_GOTREF(__pyx_t_10);
7242       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7243       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7244       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7245       __PYX_ERR(1, 153, __pyx_L1_error)
7246 
7247       /* "View.MemoryView":152
7248  *
7249  *         for idx, dim in enumerate(shape):
7250  *             if dim <= 0:             # <<<<<<<<<<<<<<
7251  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7252  *             self._shape[idx] = dim
7253  */
7254     }
7255 
7256     /* "View.MemoryView":154
7257  *             if dim <= 0:
7258  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7259  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
7260  *
7261  *         cdef char order
7262  */
7263     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
7264 
7265     /* "View.MemoryView":151
7266  *
7267  *
7268  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
7269  *             if dim <= 0:
7270  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7271  */
7272   }
7273   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7274 
7275   /* "View.MemoryView":157
7276  *
7277  *         cdef char order
7278  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
7279  *             order = b'F'
7280  *             self.mode = u'fortran'
7281  */
7282   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
7283   if (__pyx_t_4) {
7284 
7285     /* "View.MemoryView":158
7286  *         cdef char order
7287  *         if mode == 'fortran':
7288  *             order = b'F'             # <<<<<<<<<<<<<<
7289  *             self.mode = u'fortran'
7290  *         elif mode == 'c':
7291  */
7292     __pyx_v_order = 'F';
7293 
7294     /* "View.MemoryView":159
7295  *         if mode == 'fortran':
7296  *             order = b'F'
7297  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
7298  *         elif mode == 'c':
7299  *             order = b'C'
7300  */
7301     __Pyx_INCREF(__pyx_n_u_fortran);
7302     __Pyx_GIVEREF(__pyx_n_u_fortran);
7303     __Pyx_GOTREF(__pyx_v_self->mode);
7304     __Pyx_DECREF(__pyx_v_self->mode);
7305     __pyx_v_self->mode = __pyx_n_u_fortran;
7306 
7307     /* "View.MemoryView":157
7308  *
7309  *         cdef char order
7310  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
7311  *             order = b'F'
7312  *             self.mode = u'fortran'
7313  */
7314     goto __pyx_L10;
7315   }
7316 
7317   /* "View.MemoryView":160
7318  *             order = b'F'
7319  *             self.mode = u'fortran'
7320  *         elif mode == 'c':             # <<<<<<<<<<<<<<
7321  *             order = b'C'
7322  *             self.mode = u'c'
7323  */
7324   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
7325   if (likely(__pyx_t_4)) {
7326 
7327     /* "View.MemoryView":161
7328  *             self.mode = u'fortran'
7329  *         elif mode == 'c':
7330  *             order = b'C'             # <<<<<<<<<<<<<<
7331  *             self.mode = u'c'
7332  *         else:
7333  */
7334     __pyx_v_order = 'C';
7335 
7336     /* "View.MemoryView":162
7337  *         elif mode == 'c':
7338  *             order = b'C'
7339  *             self.mode = u'c'             # <<<<<<<<<<<<<<
7340  *         else:
7341  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
7342  */
7343     __Pyx_INCREF(__pyx_n_u_c);
7344     __Pyx_GIVEREF(__pyx_n_u_c);
7345     __Pyx_GOTREF(__pyx_v_self->mode);
7346     __Pyx_DECREF(__pyx_v_self->mode);
7347     __pyx_v_self->mode = __pyx_n_u_c;
7348 
7349     /* "View.MemoryView":160
7350  *             order = b'F'
7351  *             self.mode = u'fortran'
7352  *         elif mode == 'c':             # <<<<<<<<<<<<<<
7353  *             order = b'C'
7354  *             self.mode = u'c'
7355  */
7356     goto __pyx_L10;
7357   }
7358 
7359   /* "View.MemoryView":164
7360  *             self.mode = u'c'
7361  *         else:
7362  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
7363  *
7364  *         self.len = fill_contig_strides_array(self._shape, self._strides,
7365  */
7366   /*else*/ {
7367     __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(1, 164, __pyx_L1_error)
7368     __Pyx_GOTREF(__pyx_t_3);
7369     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
7370     __Pyx_GOTREF(__pyx_t_10);
7371     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7372     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7373     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7374     __PYX_ERR(1, 164, __pyx_L1_error)
7375   }
7376   __pyx_L10:;
7377 
7378   /* "View.MemoryView":166
7379  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
7380  *
7381  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
7382  *                                              itemsize, self.ndim, order)
7383  *
7384  */
7385   __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);
7386 
7387   /* "View.MemoryView":169
7388  *                                              itemsize, self.ndim, order)
7389  *
7390  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
7391  *         self.dtype_is_object = format == b'O'
7392  *         if allocate_buffer:
7393  */
7394   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
7395 
7396   /* "View.MemoryView":170
7397  *
7398  *         self.free_data = allocate_buffer
7399  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
7400  *         if allocate_buffer:
7401  *
7402  */
7403   __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(1, 170, __pyx_L1_error)
7404   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
7405   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7406   __pyx_v_self->dtype_is_object = __pyx_t_4;
7407 
7408   /* "View.MemoryView":171
7409  *         self.free_data = allocate_buffer
7410  *         self.dtype_is_object = format == b'O'
7411  *         if allocate_buffer:             # <<<<<<<<<<<<<<
7412  *
7413  *
7414  */
7415   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
7416   if (__pyx_t_4) {
7417 
7418     /* "View.MemoryView":174
7419  *
7420  *
7421  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
7422  *             if not self.data:
7423  *                 raise MemoryError("unable to allocate array data.")
7424  */
7425     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
7426 
7427     /* "View.MemoryView":175
7428  *
7429  *             self.data = <char *>malloc(self.len)
7430  *             if not self.data:             # <<<<<<<<<<<<<<
7431  *                 raise MemoryError("unable to allocate array data.")
7432  *
7433  */
7434     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
7435     if (unlikely(__pyx_t_4)) {
7436 
7437       /* "View.MemoryView":176
7438  *             self.data = <char *>malloc(self.len)
7439  *             if not self.data:
7440  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
7441  *
7442  *             if self.dtype_is_object:
7443  */
7444       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
7445       __Pyx_GOTREF(__pyx_t_10);
7446       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7447       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7448       __PYX_ERR(1, 176, __pyx_L1_error)
7449 
7450       /* "View.MemoryView":175
7451  *
7452  *             self.data = <char *>malloc(self.len)
7453  *             if not self.data:             # <<<<<<<<<<<<<<
7454  *                 raise MemoryError("unable to allocate array data.")
7455  *
7456  */
7457     }
7458 
7459     /* "View.MemoryView":178
7460  *                 raise MemoryError("unable to allocate array data.")
7461  *
7462  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7463  *                 p = <PyObject **> self.data
7464  *                 for i in range(self.len / itemsize):
7465  */
7466     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
7467     if (__pyx_t_4) {
7468 
7469       /* "View.MemoryView":179
7470  *
7471  *             if self.dtype_is_object:
7472  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
7473  *                 for i in range(self.len / itemsize):
7474  *                     p[i] = Py_None
7475  */
7476       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
7477 
7478       /* "View.MemoryView":180
7479  *             if self.dtype_is_object:
7480  *                 p = <PyObject **> self.data
7481  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
7482  *                     p[i] = Py_None
7483  *                     Py_INCREF(Py_None)
7484  */
7485       if (unlikely(__pyx_v_itemsize == 0)) {
7486         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
7487         __PYX_ERR(1, 180, __pyx_L1_error)
7488       }
7489       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))) {
7490         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
7491         __PYX_ERR(1, 180, __pyx_L1_error)
7492       }
7493       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
7494       __pyx_t_9 = __pyx_t_1;
7495       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
7496         __pyx_v_i = __pyx_t_11;
7497 
7498         /* "View.MemoryView":181
7499  *                 p = <PyObject **> self.data
7500  *                 for i in range(self.len / itemsize):
7501  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
7502  *                     Py_INCREF(Py_None)
7503  *
7504  */
7505         (__pyx_v_p[__pyx_v_i]) = Py_None;
7506 
7507         /* "View.MemoryView":182
7508  *                 for i in range(self.len / itemsize):
7509  *                     p[i] = Py_None
7510  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
7511  *
7512  *     @cname('getbuffer')
7513  */
7514         Py_INCREF(Py_None);
7515       }
7516 
7517       /* "View.MemoryView":178
7518  *                 raise MemoryError("unable to allocate array data.")
7519  *
7520  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7521  *                 p = <PyObject **> self.data
7522  *                 for i in range(self.len / itemsize):
7523  */
7524     }
7525 
7526     /* "View.MemoryView":171
7527  *         self.free_data = allocate_buffer
7528  *         self.dtype_is_object = format == b'O'
7529  *         if allocate_buffer:             # <<<<<<<<<<<<<<
7530  *
7531  *
7532  */
7533   }
7534 
7535   /* "View.MemoryView":122
7536  *         cdef bint dtype_is_object
7537  *
7538  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
7539  *                   mode="c", bint allocate_buffer=True):
7540  *
7541  */
7542 
7543   /* function exit code */
7544   __pyx_r = 0;
7545   goto __pyx_L0;
7546   __pyx_L1_error:;
7547   __Pyx_XDECREF(__pyx_t_3);
7548   __Pyx_XDECREF(__pyx_t_5);
7549   __Pyx_XDECREF(__pyx_t_6);
7550   __Pyx_XDECREF(__pyx_t_10);
7551   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7552   __pyx_r = -1;
7553   __pyx_L0:;
7554   __Pyx_XDECREF(__pyx_v_format);
7555   __Pyx_RefNannyFinishContext();
7556   return __pyx_r;
7557 }
7558 
7559 /* "View.MemoryView":185
7560  *
7561  *     @cname('getbuffer')
7562  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
7563  *         cdef int bufmode = -1
7564  *         if self.mode == u"c":
7565  */
7566 
7567 /* Python wrapper */
7568 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_array_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)7569 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
7570   int __pyx_r;
7571   __Pyx_RefNannyDeclarations
7572   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
7573   __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));
7574 
7575   /* function exit code */
7576   __Pyx_RefNannyFinishContext();
7577   return __pyx_r;
7578 }
7579 
__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)7580 static 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) {
7581   int __pyx_v_bufmode;
7582   int __pyx_r;
7583   __Pyx_RefNannyDeclarations
7584   int __pyx_t_1;
7585   int __pyx_t_2;
7586   PyObject *__pyx_t_3 = NULL;
7587   char *__pyx_t_4;
7588   Py_ssize_t __pyx_t_5;
7589   int __pyx_t_6;
7590   Py_ssize_t *__pyx_t_7;
7591   if (__pyx_v_info == NULL) {
7592     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
7593     return -1;
7594   }
7595   __Pyx_RefNannySetupContext("__getbuffer__", 0);
7596   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
7597   __Pyx_GIVEREF(__pyx_v_info->obj);
7598 
7599   /* "View.MemoryView":186
7600  *     @cname('getbuffer')
7601  *     def __getbuffer__(self, Py_buffer *info, int flags):
7602  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
7603  *         if self.mode == u"c":
7604  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7605  */
7606   __pyx_v_bufmode = -1;
7607 
7608   /* "View.MemoryView":187
7609  *     def __getbuffer__(self, Py_buffer *info, int flags):
7610  *         cdef int bufmode = -1
7611  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
7612  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7613  *         elif self.mode == u"fortran":
7614  */
7615   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
7616   __pyx_t_2 = (__pyx_t_1 != 0);
7617   if (__pyx_t_2) {
7618 
7619     /* "View.MemoryView":188
7620  *         cdef int bufmode = -1
7621  *         if self.mode == u"c":
7622  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
7623  *         elif self.mode == u"fortran":
7624  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7625  */
7626     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
7627 
7628     /* "View.MemoryView":187
7629  *     def __getbuffer__(self, Py_buffer *info, int flags):
7630  *         cdef int bufmode = -1
7631  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
7632  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7633  *         elif self.mode == u"fortran":
7634  */
7635     goto __pyx_L3;
7636   }
7637 
7638   /* "View.MemoryView":189
7639  *         if self.mode == u"c":
7640  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7641  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
7642  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7643  *         if not (flags & bufmode):
7644  */
7645   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
7646   __pyx_t_1 = (__pyx_t_2 != 0);
7647   if (__pyx_t_1) {
7648 
7649     /* "View.MemoryView":190
7650  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7651  *         elif self.mode == u"fortran":
7652  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
7653  *         if not (flags & bufmode):
7654  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7655  */
7656     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
7657 
7658     /* "View.MemoryView":189
7659  *         if self.mode == u"c":
7660  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7661  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
7662  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7663  *         if not (flags & bufmode):
7664  */
7665   }
7666   __pyx_L3:;
7667 
7668   /* "View.MemoryView":191
7669  *         elif self.mode == u"fortran":
7670  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7671  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
7672  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7673  *         info.buf = self.data
7674  */
7675   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
7676   if (unlikely(__pyx_t_1)) {
7677 
7678     /* "View.MemoryView":192
7679  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7680  *         if not (flags & bufmode):
7681  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
7682  *         info.buf = self.data
7683  *         info.len = self.len
7684  */
7685     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
7686     __Pyx_GOTREF(__pyx_t_3);
7687     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7688     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7689     __PYX_ERR(1, 192, __pyx_L1_error)
7690 
7691     /* "View.MemoryView":191
7692  *         elif self.mode == u"fortran":
7693  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7694  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
7695  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7696  *         info.buf = self.data
7697  */
7698   }
7699 
7700   /* "View.MemoryView":193
7701  *         if not (flags & bufmode):
7702  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7703  *         info.buf = self.data             # <<<<<<<<<<<<<<
7704  *         info.len = self.len
7705  *         info.ndim = self.ndim
7706  */
7707   __pyx_t_4 = __pyx_v_self->data;
7708   __pyx_v_info->buf = __pyx_t_4;
7709 
7710   /* "View.MemoryView":194
7711  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7712  *         info.buf = self.data
7713  *         info.len = self.len             # <<<<<<<<<<<<<<
7714  *         info.ndim = self.ndim
7715  *         info.shape = self._shape
7716  */
7717   __pyx_t_5 = __pyx_v_self->len;
7718   __pyx_v_info->len = __pyx_t_5;
7719 
7720   /* "View.MemoryView":195
7721  *         info.buf = self.data
7722  *         info.len = self.len
7723  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
7724  *         info.shape = self._shape
7725  *         info.strides = self._strides
7726  */
7727   __pyx_t_6 = __pyx_v_self->ndim;
7728   __pyx_v_info->ndim = __pyx_t_6;
7729 
7730   /* "View.MemoryView":196
7731  *         info.len = self.len
7732  *         info.ndim = self.ndim
7733  *         info.shape = self._shape             # <<<<<<<<<<<<<<
7734  *         info.strides = self._strides
7735  *         info.suboffsets = NULL
7736  */
7737   __pyx_t_7 = __pyx_v_self->_shape;
7738   __pyx_v_info->shape = __pyx_t_7;
7739 
7740   /* "View.MemoryView":197
7741  *         info.ndim = self.ndim
7742  *         info.shape = self._shape
7743  *         info.strides = self._strides             # <<<<<<<<<<<<<<
7744  *         info.suboffsets = NULL
7745  *         info.itemsize = self.itemsize
7746  */
7747   __pyx_t_7 = __pyx_v_self->_strides;
7748   __pyx_v_info->strides = __pyx_t_7;
7749 
7750   /* "View.MemoryView":198
7751  *         info.shape = self._shape
7752  *         info.strides = self._strides
7753  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
7754  *         info.itemsize = self.itemsize
7755  *         info.readonly = 0
7756  */
7757   __pyx_v_info->suboffsets = NULL;
7758 
7759   /* "View.MemoryView":199
7760  *         info.strides = self._strides
7761  *         info.suboffsets = NULL
7762  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
7763  *         info.readonly = 0
7764  *
7765  */
7766   __pyx_t_5 = __pyx_v_self->itemsize;
7767   __pyx_v_info->itemsize = __pyx_t_5;
7768 
7769   /* "View.MemoryView":200
7770  *         info.suboffsets = NULL
7771  *         info.itemsize = self.itemsize
7772  *         info.readonly = 0             # <<<<<<<<<<<<<<
7773  *
7774  *         if flags & PyBUF_FORMAT:
7775  */
7776   __pyx_v_info->readonly = 0;
7777 
7778   /* "View.MemoryView":202
7779  *         info.readonly = 0
7780  *
7781  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
7782  *             info.format = self.format
7783  *         else:
7784  */
7785   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
7786   if (__pyx_t_1) {
7787 
7788     /* "View.MemoryView":203
7789  *
7790  *         if flags & PyBUF_FORMAT:
7791  *             info.format = self.format             # <<<<<<<<<<<<<<
7792  *         else:
7793  *             info.format = NULL
7794  */
7795     __pyx_t_4 = __pyx_v_self->format;
7796     __pyx_v_info->format = __pyx_t_4;
7797 
7798     /* "View.MemoryView":202
7799  *         info.readonly = 0
7800  *
7801  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
7802  *             info.format = self.format
7803  *         else:
7804  */
7805     goto __pyx_L5;
7806   }
7807 
7808   /* "View.MemoryView":205
7809  *             info.format = self.format
7810  *         else:
7811  *             info.format = NULL             # <<<<<<<<<<<<<<
7812  *
7813  *         info.obj = self
7814  */
7815   /*else*/ {
7816     __pyx_v_info->format = NULL;
7817   }
7818   __pyx_L5:;
7819 
7820   /* "View.MemoryView":207
7821  *             info.format = NULL
7822  *
7823  *         info.obj = self             # <<<<<<<<<<<<<<
7824  *
7825  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
7826  */
7827   __Pyx_INCREF(((PyObject *)__pyx_v_self));
7828   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
7829   __Pyx_GOTREF(__pyx_v_info->obj);
7830   __Pyx_DECREF(__pyx_v_info->obj);
7831   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
7832 
7833   /* "View.MemoryView":185
7834  *
7835  *     @cname('getbuffer')
7836  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
7837  *         cdef int bufmode = -1
7838  *         if self.mode == u"c":
7839  */
7840 
7841   /* function exit code */
7842   __pyx_r = 0;
7843   goto __pyx_L0;
7844   __pyx_L1_error:;
7845   __Pyx_XDECREF(__pyx_t_3);
7846   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7847   __pyx_r = -1;
7848   if (__pyx_v_info->obj != NULL) {
7849     __Pyx_GOTREF(__pyx_v_info->obj);
7850     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7851   }
7852   goto __pyx_L2;
7853   __pyx_L0:;
7854   if (__pyx_v_info->obj == Py_None) {
7855     __Pyx_GOTREF(__pyx_v_info->obj);
7856     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7857   }
7858   __pyx_L2:;
7859   __Pyx_RefNannyFinishContext();
7860   return __pyx_r;
7861 }
7862 
7863 /* "View.MemoryView":211
7864  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
7865  *
7866  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
7867  *         if self.callback_free_data != NULL:
7868  *             self.callback_free_data(self.data)
7869  */
7870 
7871 /* Python wrapper */
7872 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)7873 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
7874   __Pyx_RefNannyDeclarations
7875   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
7876   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
7877 
7878   /* function exit code */
7879   __Pyx_RefNannyFinishContext();
7880 }
7881 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)7882 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
7883   __Pyx_RefNannyDeclarations
7884   int __pyx_t_1;
7885   __Pyx_RefNannySetupContext("__dealloc__", 0);
7886 
7887   /* "View.MemoryView":212
7888  *
7889  *     def __dealloc__(array self):
7890  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
7891  *             self.callback_free_data(self.data)
7892  *         elif self.free_data:
7893  */
7894   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
7895   if (__pyx_t_1) {
7896 
7897     /* "View.MemoryView":213
7898  *     def __dealloc__(array self):
7899  *         if self.callback_free_data != NULL:
7900  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
7901  *         elif self.free_data:
7902  *             if self.dtype_is_object:
7903  */
7904     __pyx_v_self->callback_free_data(__pyx_v_self->data);
7905 
7906     /* "View.MemoryView":212
7907  *
7908  *     def __dealloc__(array self):
7909  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
7910  *             self.callback_free_data(self.data)
7911  *         elif self.free_data:
7912  */
7913     goto __pyx_L3;
7914   }
7915 
7916   /* "View.MemoryView":214
7917  *         if self.callback_free_data != NULL:
7918  *             self.callback_free_data(self.data)
7919  *         elif self.free_data:             # <<<<<<<<<<<<<<
7920  *             if self.dtype_is_object:
7921  *                 refcount_objects_in_slice(self.data, self._shape,
7922  */
7923   __pyx_t_1 = (__pyx_v_self->free_data != 0);
7924   if (__pyx_t_1) {
7925 
7926     /* "View.MemoryView":215
7927  *             self.callback_free_data(self.data)
7928  *         elif self.free_data:
7929  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7930  *                 refcount_objects_in_slice(self.data, self._shape,
7931  *                                           self._strides, self.ndim, False)
7932  */
7933     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
7934     if (__pyx_t_1) {
7935 
7936       /* "View.MemoryView":216
7937  *         elif self.free_data:
7938  *             if self.dtype_is_object:
7939  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
7940  *                                           self._strides, self.ndim, False)
7941  *             free(self.data)
7942  */
7943       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
7944 
7945       /* "View.MemoryView":215
7946  *             self.callback_free_data(self.data)
7947  *         elif self.free_data:
7948  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7949  *                 refcount_objects_in_slice(self.data, self._shape,
7950  *                                           self._strides, self.ndim, False)
7951  */
7952     }
7953 
7954     /* "View.MemoryView":218
7955  *                 refcount_objects_in_slice(self.data, self._shape,
7956  *                                           self._strides, self.ndim, False)
7957  *             free(self.data)             # <<<<<<<<<<<<<<
7958  *         PyObject_Free(self._shape)
7959  *
7960  */
7961     free(__pyx_v_self->data);
7962 
7963     /* "View.MemoryView":214
7964  *         if self.callback_free_data != NULL:
7965  *             self.callback_free_data(self.data)
7966  *         elif self.free_data:             # <<<<<<<<<<<<<<
7967  *             if self.dtype_is_object:
7968  *                 refcount_objects_in_slice(self.data, self._shape,
7969  */
7970   }
7971   __pyx_L3:;
7972 
7973   /* "View.MemoryView":219
7974  *                                           self._strides, self.ndim, False)
7975  *             free(self.data)
7976  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
7977  *
7978  *     @property
7979  */
7980   PyObject_Free(__pyx_v_self->_shape);
7981 
7982   /* "View.MemoryView":211
7983  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
7984  *
7985  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
7986  *         if self.callback_free_data != NULL:
7987  *             self.callback_free_data(self.data)
7988  */
7989 
7990   /* function exit code */
7991   __Pyx_RefNannyFinishContext();
7992 }
7993 
7994 /* "View.MemoryView":222
7995  *
7996  *     @property
7997  *     def memview(self):             # <<<<<<<<<<<<<<
7998  *         return self.get_memview()
7999  *
8000  */
8001 
8002 /* Python wrapper */
8003 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject * __pyx_v_self)8004 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
8005   PyObject *__pyx_r = 0;
8006   __Pyx_RefNannyDeclarations
8007   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8008   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
8009 
8010   /* function exit code */
8011   __Pyx_RefNannyFinishContext();
8012   return __pyx_r;
8013 }
8014 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)8015 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
8016   PyObject *__pyx_r = NULL;
8017   __Pyx_RefNannyDeclarations
8018   PyObject *__pyx_t_1 = NULL;
8019   __Pyx_RefNannySetupContext("__get__", 0);
8020 
8021   /* "View.MemoryView":223
8022  *     @property
8023  *     def memview(self):
8024  *         return self.get_memview()             # <<<<<<<<<<<<<<
8025  *
8026  *     @cname('get_memview')
8027  */
8028   __Pyx_XDECREF(__pyx_r);
8029   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
8030   __Pyx_GOTREF(__pyx_t_1);
8031   __pyx_r = __pyx_t_1;
8032   __pyx_t_1 = 0;
8033   goto __pyx_L0;
8034 
8035   /* "View.MemoryView":222
8036  *
8037  *     @property
8038  *     def memview(self):             # <<<<<<<<<<<<<<
8039  *         return self.get_memview()
8040  *
8041  */
8042 
8043   /* function exit code */
8044   __pyx_L1_error:;
8045   __Pyx_XDECREF(__pyx_t_1);
8046   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8047   __pyx_r = NULL;
8048   __pyx_L0:;
8049   __Pyx_XGIVEREF(__pyx_r);
8050   __Pyx_RefNannyFinishContext();
8051   return __pyx_r;
8052 }
8053 
8054 /* "View.MemoryView":226
8055  *
8056  *     @cname('get_memview')
8057  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
8058  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8059  *         return  memoryview(self, flags, self.dtype_is_object)
8060  */
8061 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)8062 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
8063   int __pyx_v_flags;
8064   PyObject *__pyx_r = NULL;
8065   __Pyx_RefNannyDeclarations
8066   PyObject *__pyx_t_1 = NULL;
8067   PyObject *__pyx_t_2 = NULL;
8068   PyObject *__pyx_t_3 = NULL;
8069   __Pyx_RefNannySetupContext("get_memview", 0);
8070 
8071   /* "View.MemoryView":227
8072  *     @cname('get_memview')
8073  *     cdef get_memview(self):
8074  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
8075  *         return  memoryview(self, flags, self.dtype_is_object)
8076  *
8077  */
8078   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
8079 
8080   /* "View.MemoryView":228
8081  *     cdef get_memview(self):
8082  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8083  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
8084  *
8085  *     def __len__(self):
8086  */
8087   __Pyx_XDECREF(__pyx_r);
8088   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
8089   __Pyx_GOTREF(__pyx_t_1);
8090   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
8091   __Pyx_GOTREF(__pyx_t_2);
8092   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
8093   __Pyx_GOTREF(__pyx_t_3);
8094   __Pyx_INCREF(((PyObject *)__pyx_v_self));
8095   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8096   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
8097   __Pyx_GIVEREF(__pyx_t_1);
8098   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
8099   __Pyx_GIVEREF(__pyx_t_2);
8100   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
8101   __pyx_t_1 = 0;
8102   __pyx_t_2 = 0;
8103   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
8104   __Pyx_GOTREF(__pyx_t_2);
8105   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8106   __pyx_r = __pyx_t_2;
8107   __pyx_t_2 = 0;
8108   goto __pyx_L0;
8109 
8110   /* "View.MemoryView":226
8111  *
8112  *     @cname('get_memview')
8113  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
8114  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8115  *         return  memoryview(self, flags, self.dtype_is_object)
8116  */
8117 
8118   /* function exit code */
8119   __pyx_L1_error:;
8120   __Pyx_XDECREF(__pyx_t_1);
8121   __Pyx_XDECREF(__pyx_t_2);
8122   __Pyx_XDECREF(__pyx_t_3);
8123   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
8124   __pyx_r = 0;
8125   __pyx_L0:;
8126   __Pyx_XGIVEREF(__pyx_r);
8127   __Pyx_RefNannyFinishContext();
8128   return __pyx_r;
8129 }
8130 
8131 /* "View.MemoryView":230
8132  *         return  memoryview(self, flags, self.dtype_is_object)
8133  *
8134  *     def __len__(self):             # <<<<<<<<<<<<<<
8135  *         return self._shape[0]
8136  *
8137  */
8138 
8139 /* Python wrapper */
8140 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)8141 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
8142   Py_ssize_t __pyx_r;
8143   __Pyx_RefNannyDeclarations
8144   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
8145   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
8146 
8147   /* function exit code */
8148   __Pyx_RefNannyFinishContext();
8149   return __pyx_r;
8150 }
8151 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)8152 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
8153   Py_ssize_t __pyx_r;
8154   __Pyx_RefNannyDeclarations
8155   __Pyx_RefNannySetupContext("__len__", 0);
8156 
8157   /* "View.MemoryView":231
8158  *
8159  *     def __len__(self):
8160  *         return self._shape[0]             # <<<<<<<<<<<<<<
8161  *
8162  *     def __getattr__(self, attr):
8163  */
8164   __pyx_r = (__pyx_v_self->_shape[0]);
8165   goto __pyx_L0;
8166 
8167   /* "View.MemoryView":230
8168  *         return  memoryview(self, flags, self.dtype_is_object)
8169  *
8170  *     def __len__(self):             # <<<<<<<<<<<<<<
8171  *         return self._shape[0]
8172  *
8173  */
8174 
8175   /* function exit code */
8176   __pyx_L0:;
8177   __Pyx_RefNannyFinishContext();
8178   return __pyx_r;
8179 }
8180 
8181 /* "View.MemoryView":233
8182  *         return self._shape[0]
8183  *
8184  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
8185  *         return getattr(self.memview, attr)
8186  *
8187  */
8188 
8189 /* Python wrapper */
8190 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
__pyx_array___getattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_attr)8191 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
8192   PyObject *__pyx_r = 0;
8193   __Pyx_RefNannyDeclarations
8194   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
8195   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
8196 
8197   /* function exit code */
8198   __Pyx_RefNannyFinishContext();
8199   return __pyx_r;
8200 }
8201 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)8202 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
8203   PyObject *__pyx_r = NULL;
8204   __Pyx_RefNannyDeclarations
8205   PyObject *__pyx_t_1 = NULL;
8206   PyObject *__pyx_t_2 = NULL;
8207   __Pyx_RefNannySetupContext("__getattr__", 0);
8208 
8209   /* "View.MemoryView":234
8210  *
8211  *     def __getattr__(self, attr):
8212  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
8213  *
8214  *     def __getitem__(self, item):
8215  */
8216   __Pyx_XDECREF(__pyx_r);
8217   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
8218   __Pyx_GOTREF(__pyx_t_1);
8219   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
8220   __Pyx_GOTREF(__pyx_t_2);
8221   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8222   __pyx_r = __pyx_t_2;
8223   __pyx_t_2 = 0;
8224   goto __pyx_L0;
8225 
8226   /* "View.MemoryView":233
8227  *         return self._shape[0]
8228  *
8229  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
8230  *         return getattr(self.memview, attr)
8231  *
8232  */
8233 
8234   /* function exit code */
8235   __pyx_L1_error:;
8236   __Pyx_XDECREF(__pyx_t_1);
8237   __Pyx_XDECREF(__pyx_t_2);
8238   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8239   __pyx_r = NULL;
8240   __pyx_L0:;
8241   __Pyx_XGIVEREF(__pyx_r);
8242   __Pyx_RefNannyFinishContext();
8243   return __pyx_r;
8244 }
8245 
8246 /* "View.MemoryView":236
8247  *         return getattr(self.memview, attr)
8248  *
8249  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
8250  *         return self.memview[item]
8251  *
8252  */
8253 
8254 /* Python wrapper */
8255 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_array___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item)8256 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
8257   PyObject *__pyx_r = 0;
8258   __Pyx_RefNannyDeclarations
8259   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
8260   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
8261 
8262   /* function exit code */
8263   __Pyx_RefNannyFinishContext();
8264   return __pyx_r;
8265 }
8266 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)8267 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
8268   PyObject *__pyx_r = NULL;
8269   __Pyx_RefNannyDeclarations
8270   PyObject *__pyx_t_1 = NULL;
8271   PyObject *__pyx_t_2 = NULL;
8272   __Pyx_RefNannySetupContext("__getitem__", 0);
8273 
8274   /* "View.MemoryView":237
8275  *
8276  *     def __getitem__(self, item):
8277  *         return self.memview[item]             # <<<<<<<<<<<<<<
8278  *
8279  *     def __setitem__(self, item, value):
8280  */
8281   __Pyx_XDECREF(__pyx_r);
8282   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
8283   __Pyx_GOTREF(__pyx_t_1);
8284   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
8285   __Pyx_GOTREF(__pyx_t_2);
8286   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8287   __pyx_r = __pyx_t_2;
8288   __pyx_t_2 = 0;
8289   goto __pyx_L0;
8290 
8291   /* "View.MemoryView":236
8292  *         return getattr(self.memview, attr)
8293  *
8294  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
8295  *         return self.memview[item]
8296  *
8297  */
8298 
8299   /* function exit code */
8300   __pyx_L1_error:;
8301   __Pyx_XDECREF(__pyx_t_1);
8302   __Pyx_XDECREF(__pyx_t_2);
8303   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8304   __pyx_r = NULL;
8305   __pyx_L0:;
8306   __Pyx_XGIVEREF(__pyx_r);
8307   __Pyx_RefNannyFinishContext();
8308   return __pyx_r;
8309 }
8310 
8311 /* "View.MemoryView":239
8312  *         return self.memview[item]
8313  *
8314  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
8315  *         self.memview[item] = value
8316  *
8317  */
8318 
8319 /* Python wrapper */
8320 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
__pyx_array___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)8321 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
8322   int __pyx_r;
8323   __Pyx_RefNannyDeclarations
8324   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
8325   __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));
8326 
8327   /* function exit code */
8328   __Pyx_RefNannyFinishContext();
8329   return __pyx_r;
8330 }
8331 
__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)8332 static 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) {
8333   int __pyx_r;
8334   __Pyx_RefNannyDeclarations
8335   PyObject *__pyx_t_1 = NULL;
8336   __Pyx_RefNannySetupContext("__setitem__", 0);
8337 
8338   /* "View.MemoryView":240
8339  *
8340  *     def __setitem__(self, item, value):
8341  *         self.memview[item] = value             # <<<<<<<<<<<<<<
8342  *
8343  *
8344  */
8345   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
8346   __Pyx_GOTREF(__pyx_t_1);
8347   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
8348   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8349 
8350   /* "View.MemoryView":239
8351  *         return self.memview[item]
8352  *
8353  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
8354  *         self.memview[item] = value
8355  *
8356  */
8357 
8358   /* function exit code */
8359   __pyx_r = 0;
8360   goto __pyx_L0;
8361   __pyx_L1_error:;
8362   __Pyx_XDECREF(__pyx_t_1);
8363   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8364   __pyx_r = -1;
8365   __pyx_L0:;
8366   __Pyx_RefNannyFinishContext();
8367   return __pyx_r;
8368 }
8369 
8370 /* "(tree fragment)":1
8371  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8372  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8373  * def __setstate_cython__(self, __pyx_state):
8374  */
8375 
8376 /* Python wrapper */
8377 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_array_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8378 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8379   PyObject *__pyx_r = 0;
8380   __Pyx_RefNannyDeclarations
8381   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8382   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
8383 
8384   /* function exit code */
8385   __Pyx_RefNannyFinishContext();
8386   return __pyx_r;
8387 }
8388 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)8389 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
8390   PyObject *__pyx_r = NULL;
8391   __Pyx_RefNannyDeclarations
8392   PyObject *__pyx_t_1 = NULL;
8393   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8394 
8395   /* "(tree fragment)":2
8396  * def __reduce_cython__(self):
8397  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8398  * def __setstate_cython__(self, __pyx_state):
8399  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8400  */
8401   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
8402   __Pyx_GOTREF(__pyx_t_1);
8403   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8404   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8405   __PYX_ERR(1, 2, __pyx_L1_error)
8406 
8407   /* "(tree fragment)":1
8408  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8409  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8410  * def __setstate_cython__(self, __pyx_state):
8411  */
8412 
8413   /* function exit code */
8414   __pyx_L1_error:;
8415   __Pyx_XDECREF(__pyx_t_1);
8416   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8417   __pyx_r = NULL;
8418   __Pyx_XGIVEREF(__pyx_r);
8419   __Pyx_RefNannyFinishContext();
8420   return __pyx_r;
8421 }
8422 
8423 /* "(tree fragment)":3
8424  * def __reduce_cython__(self):
8425  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8426  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8427  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8428  */
8429 
8430 /* Python wrapper */
8431 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_array_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)8432 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8433   PyObject *__pyx_r = 0;
8434   __Pyx_RefNannyDeclarations
8435   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8436   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8437 
8438   /* function exit code */
8439   __Pyx_RefNannyFinishContext();
8440   return __pyx_r;
8441 }
8442 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8443 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8444   PyObject *__pyx_r = NULL;
8445   __Pyx_RefNannyDeclarations
8446   PyObject *__pyx_t_1 = NULL;
8447   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8448 
8449   /* "(tree fragment)":4
8450  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8451  * def __setstate_cython__(self, __pyx_state):
8452  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8453  */
8454   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
8455   __Pyx_GOTREF(__pyx_t_1);
8456   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8457   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8458   __PYX_ERR(1, 4, __pyx_L1_error)
8459 
8460   /* "(tree fragment)":3
8461  * def __reduce_cython__(self):
8462  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8463  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8464  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8465  */
8466 
8467   /* function exit code */
8468   __pyx_L1_error:;
8469   __Pyx_XDECREF(__pyx_t_1);
8470   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8471   __pyx_r = NULL;
8472   __Pyx_XGIVEREF(__pyx_r);
8473   __Pyx_RefNannyFinishContext();
8474   return __pyx_r;
8475 }
8476 
8477 /* "View.MemoryView":244
8478  *
8479  * @cname("__pyx_array_new")
8480  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
8481  *                           char *mode, char *buf):
8482  *     cdef array result
8483  */
8484 
__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)8485 static 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) {
8486   struct __pyx_array_obj *__pyx_v_result = 0;
8487   struct __pyx_array_obj *__pyx_r = NULL;
8488   __Pyx_RefNannyDeclarations
8489   int __pyx_t_1;
8490   PyObject *__pyx_t_2 = NULL;
8491   PyObject *__pyx_t_3 = NULL;
8492   PyObject *__pyx_t_4 = NULL;
8493   PyObject *__pyx_t_5 = NULL;
8494   __Pyx_RefNannySetupContext("array_cwrapper", 0);
8495 
8496   /* "View.MemoryView":248
8497  *     cdef array result
8498  *
8499  *     if buf == NULL:             # <<<<<<<<<<<<<<
8500  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8501  *     else:
8502  */
8503   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
8504   if (__pyx_t_1) {
8505 
8506     /* "View.MemoryView":249
8507  *
8508  *     if buf == NULL:
8509  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
8510  *     else:
8511  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
8512  */
8513     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
8514     __Pyx_GOTREF(__pyx_t_2);
8515     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
8516     __Pyx_GOTREF(__pyx_t_3);
8517     __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(1, 249, __pyx_L1_error)
8518     __Pyx_GOTREF(__pyx_t_4);
8519     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
8520     __Pyx_GOTREF(__pyx_t_5);
8521     __Pyx_INCREF(__pyx_v_shape);
8522     __Pyx_GIVEREF(__pyx_v_shape);
8523     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
8524     __Pyx_GIVEREF(__pyx_t_2);
8525     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
8526     __Pyx_GIVEREF(__pyx_t_3);
8527     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
8528     __Pyx_GIVEREF(__pyx_t_4);
8529     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
8530     __pyx_t_2 = 0;
8531     __pyx_t_3 = 0;
8532     __pyx_t_4 = 0;
8533     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
8534     __Pyx_GOTREF(__pyx_t_4);
8535     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8536     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
8537     __pyx_t_4 = 0;
8538 
8539     /* "View.MemoryView":248
8540  *     cdef array result
8541  *
8542  *     if buf == NULL:             # <<<<<<<<<<<<<<
8543  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8544  *     else:
8545  */
8546     goto __pyx_L3;
8547   }
8548 
8549   /* "View.MemoryView":251
8550  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8551  *     else:
8552  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
8553  *                        allocate_buffer=False)
8554  *         result.data = buf
8555  */
8556   /*else*/ {
8557     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
8558     __Pyx_GOTREF(__pyx_t_4);
8559     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
8560     __Pyx_GOTREF(__pyx_t_5);
8561     __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(1, 251, __pyx_L1_error)
8562     __Pyx_GOTREF(__pyx_t_3);
8563     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
8564     __Pyx_GOTREF(__pyx_t_2);
8565     __Pyx_INCREF(__pyx_v_shape);
8566     __Pyx_GIVEREF(__pyx_v_shape);
8567     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
8568     __Pyx_GIVEREF(__pyx_t_4);
8569     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
8570     __Pyx_GIVEREF(__pyx_t_5);
8571     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
8572     __Pyx_GIVEREF(__pyx_t_3);
8573     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
8574     __pyx_t_4 = 0;
8575     __pyx_t_5 = 0;
8576     __pyx_t_3 = 0;
8577 
8578     /* "View.MemoryView":252
8579  *     else:
8580  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
8581  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
8582  *         result.data = buf
8583  *
8584  */
8585     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
8586     __Pyx_GOTREF(__pyx_t_3);
8587     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
8588 
8589     /* "View.MemoryView":251
8590  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8591  *     else:
8592  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
8593  *                        allocate_buffer=False)
8594  *         result.data = buf
8595  */
8596     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
8597     __Pyx_GOTREF(__pyx_t_5);
8598     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8599     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8600     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
8601     __pyx_t_5 = 0;
8602 
8603     /* "View.MemoryView":253
8604  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
8605  *                        allocate_buffer=False)
8606  *         result.data = buf             # <<<<<<<<<<<<<<
8607  *
8608  *     return result
8609  */
8610     __pyx_v_result->data = __pyx_v_buf;
8611   }
8612   __pyx_L3:;
8613 
8614   /* "View.MemoryView":255
8615  *         result.data = buf
8616  *
8617  *     return result             # <<<<<<<<<<<<<<
8618  *
8619  *
8620  */
8621   __Pyx_XDECREF(((PyObject *)__pyx_r));
8622   __Pyx_INCREF(((PyObject *)__pyx_v_result));
8623   __pyx_r = __pyx_v_result;
8624   goto __pyx_L0;
8625 
8626   /* "View.MemoryView":244
8627  *
8628  * @cname("__pyx_array_new")
8629  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
8630  *                           char *mode, char *buf):
8631  *     cdef array result
8632  */
8633 
8634   /* function exit code */
8635   __pyx_L1_error:;
8636   __Pyx_XDECREF(__pyx_t_2);
8637   __Pyx_XDECREF(__pyx_t_3);
8638   __Pyx_XDECREF(__pyx_t_4);
8639   __Pyx_XDECREF(__pyx_t_5);
8640   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
8641   __pyx_r = 0;
8642   __pyx_L0:;
8643   __Pyx_XDECREF((PyObject *)__pyx_v_result);
8644   __Pyx_XGIVEREF((PyObject *)__pyx_r);
8645   __Pyx_RefNannyFinishContext();
8646   return __pyx_r;
8647 }
8648 
8649 /* "View.MemoryView":281
8650  * cdef class Enum(object):
8651  *     cdef object name
8652  *     def __init__(self, name):             # <<<<<<<<<<<<<<
8653  *         self.name = name
8654  *     def __repr__(self):
8655  */
8656 
8657 /* Python wrapper */
8658 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_MemviewEnum___init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8659 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8660   PyObject *__pyx_v_name = 0;
8661   int __pyx_r;
8662   __Pyx_RefNannyDeclarations
8663   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
8664   {
8665     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
8666     PyObject* values[1] = {0};
8667     if (unlikely(__pyx_kwds)) {
8668       Py_ssize_t kw_args;
8669       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8670       switch (pos_args) {
8671         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8672         CYTHON_FALLTHROUGH;
8673         case  0: break;
8674         default: goto __pyx_L5_argtuple_error;
8675       }
8676       kw_args = PyDict_Size(__pyx_kwds);
8677       switch (pos_args) {
8678         case  0:
8679         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
8680         else goto __pyx_L5_argtuple_error;
8681       }
8682       if (unlikely(kw_args > 0)) {
8683         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
8684       }
8685     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
8686       goto __pyx_L5_argtuple_error;
8687     } else {
8688       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8689     }
8690     __pyx_v_name = values[0];
8691   }
8692   goto __pyx_L4_argument_unpacking_done;
8693   __pyx_L5_argtuple_error:;
8694   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
8695   __pyx_L3_error:;
8696   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8697   __Pyx_RefNannyFinishContext();
8698   return -1;
8699   __pyx_L4_argument_unpacking_done:;
8700   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
8701 
8702   /* function exit code */
8703   __Pyx_RefNannyFinishContext();
8704   return __pyx_r;
8705 }
8706 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)8707 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
8708   int __pyx_r;
8709   __Pyx_RefNannyDeclarations
8710   __Pyx_RefNannySetupContext("__init__", 0);
8711 
8712   /* "View.MemoryView":282
8713  *     cdef object name
8714  *     def __init__(self, name):
8715  *         self.name = name             # <<<<<<<<<<<<<<
8716  *     def __repr__(self):
8717  *         return self.name
8718  */
8719   __Pyx_INCREF(__pyx_v_name);
8720   __Pyx_GIVEREF(__pyx_v_name);
8721   __Pyx_GOTREF(__pyx_v_self->name);
8722   __Pyx_DECREF(__pyx_v_self->name);
8723   __pyx_v_self->name = __pyx_v_name;
8724 
8725   /* "View.MemoryView":281
8726  * cdef class Enum(object):
8727  *     cdef object name
8728  *     def __init__(self, name):             # <<<<<<<<<<<<<<
8729  *         self.name = name
8730  *     def __repr__(self):
8731  */
8732 
8733   /* function exit code */
8734   __pyx_r = 0;
8735   __Pyx_RefNannyFinishContext();
8736   return __pyx_r;
8737 }
8738 
8739 /* "View.MemoryView":283
8740  *     def __init__(self, name):
8741  *         self.name = name
8742  *     def __repr__(self):             # <<<<<<<<<<<<<<
8743  *         return self.name
8744  *
8745  */
8746 
8747 /* Python wrapper */
8748 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)8749 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
8750   PyObject *__pyx_r = 0;
8751   __Pyx_RefNannyDeclarations
8752   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
8753   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
8754 
8755   /* function exit code */
8756   __Pyx_RefNannyFinishContext();
8757   return __pyx_r;
8758 }
8759 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)8760 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
8761   PyObject *__pyx_r = NULL;
8762   __Pyx_RefNannyDeclarations
8763   __Pyx_RefNannySetupContext("__repr__", 0);
8764 
8765   /* "View.MemoryView":284
8766  *         self.name = name
8767  *     def __repr__(self):
8768  *         return self.name             # <<<<<<<<<<<<<<
8769  *
8770  * cdef generic = Enum("<strided and direct or indirect>")
8771  */
8772   __Pyx_XDECREF(__pyx_r);
8773   __Pyx_INCREF(__pyx_v_self->name);
8774   __pyx_r = __pyx_v_self->name;
8775   goto __pyx_L0;
8776 
8777   /* "View.MemoryView":283
8778  *     def __init__(self, name):
8779  *         self.name = name
8780  *     def __repr__(self):             # <<<<<<<<<<<<<<
8781  *         return self.name
8782  *
8783  */
8784 
8785   /* function exit code */
8786   __pyx_L0:;
8787   __Pyx_XGIVEREF(__pyx_r);
8788   __Pyx_RefNannyFinishContext();
8789   return __pyx_r;
8790 }
8791 
8792 /* "(tree fragment)":1
8793  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8794  *     cdef tuple state
8795  *     cdef object _dict
8796  */
8797 
8798 /* Python wrapper */
8799 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8800 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8801   PyObject *__pyx_r = 0;
8802   __Pyx_RefNannyDeclarations
8803   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8804   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
8805 
8806   /* function exit code */
8807   __Pyx_RefNannyFinishContext();
8808   return __pyx_r;
8809 }
8810 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)8811 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
8812   PyObject *__pyx_v_state = 0;
8813   PyObject *__pyx_v__dict = 0;
8814   int __pyx_v_use_setstate;
8815   PyObject *__pyx_r = NULL;
8816   __Pyx_RefNannyDeclarations
8817   PyObject *__pyx_t_1 = NULL;
8818   int __pyx_t_2;
8819   int __pyx_t_3;
8820   PyObject *__pyx_t_4 = NULL;
8821   PyObject *__pyx_t_5 = NULL;
8822   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8823 
8824   /* "(tree fragment)":5
8825  *     cdef object _dict
8826  *     cdef bint use_setstate
8827  *     state = (self.name,)             # <<<<<<<<<<<<<<
8828  *     _dict = getattr(self, '__dict__', None)
8829  *     if _dict is not None:
8830  */
8831   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
8832   __Pyx_GOTREF(__pyx_t_1);
8833   __Pyx_INCREF(__pyx_v_self->name);
8834   __Pyx_GIVEREF(__pyx_v_self->name);
8835   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
8836   __pyx_v_state = ((PyObject*)__pyx_t_1);
8837   __pyx_t_1 = 0;
8838 
8839   /* "(tree fragment)":6
8840  *     cdef bint use_setstate
8841  *     state = (self.name,)
8842  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
8843  *     if _dict is not None:
8844  *         state += (_dict,)
8845  */
8846   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
8847   __Pyx_GOTREF(__pyx_t_1);
8848   __pyx_v__dict = __pyx_t_1;
8849   __pyx_t_1 = 0;
8850 
8851   /* "(tree fragment)":7
8852  *     state = (self.name,)
8853  *     _dict = getattr(self, '__dict__', None)
8854  *     if _dict is not None:             # <<<<<<<<<<<<<<
8855  *         state += (_dict,)
8856  *         use_setstate = True
8857  */
8858   __pyx_t_2 = (__pyx_v__dict != Py_None);
8859   __pyx_t_3 = (__pyx_t_2 != 0);
8860   if (__pyx_t_3) {
8861 
8862     /* "(tree fragment)":8
8863  *     _dict = getattr(self, '__dict__', None)
8864  *     if _dict is not None:
8865  *         state += (_dict,)             # <<<<<<<<<<<<<<
8866  *         use_setstate = True
8867  *     else:
8868  */
8869     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
8870     __Pyx_GOTREF(__pyx_t_1);
8871     __Pyx_INCREF(__pyx_v__dict);
8872     __Pyx_GIVEREF(__pyx_v__dict);
8873     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
8874     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
8875     __Pyx_GOTREF(__pyx_t_4);
8876     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8877     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
8878     __pyx_t_4 = 0;
8879 
8880     /* "(tree fragment)":9
8881  *     if _dict is not None:
8882  *         state += (_dict,)
8883  *         use_setstate = True             # <<<<<<<<<<<<<<
8884  *     else:
8885  *         use_setstate = self.name is not None
8886  */
8887     __pyx_v_use_setstate = 1;
8888 
8889     /* "(tree fragment)":7
8890  *     state = (self.name,)
8891  *     _dict = getattr(self, '__dict__', None)
8892  *     if _dict is not None:             # <<<<<<<<<<<<<<
8893  *         state += (_dict,)
8894  *         use_setstate = True
8895  */
8896     goto __pyx_L3;
8897   }
8898 
8899   /* "(tree fragment)":11
8900  *         use_setstate = True
8901  *     else:
8902  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
8903  *     if use_setstate:
8904  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
8905  */
8906   /*else*/ {
8907     __pyx_t_3 = (__pyx_v_self->name != Py_None);
8908     __pyx_v_use_setstate = __pyx_t_3;
8909   }
8910   __pyx_L3:;
8911 
8912   /* "(tree fragment)":12
8913  *     else:
8914  *         use_setstate = self.name is not None
8915  *     if use_setstate:             # <<<<<<<<<<<<<<
8916  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
8917  *     else:
8918  */
8919   __pyx_t_3 = (__pyx_v_use_setstate != 0);
8920   if (__pyx_t_3) {
8921 
8922     /* "(tree fragment)":13
8923  *         use_setstate = self.name is not None
8924  *     if use_setstate:
8925  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
8926  *     else:
8927  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
8928  */
8929     __Pyx_XDECREF(__pyx_r);
8930     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
8931     __Pyx_GOTREF(__pyx_t_4);
8932     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
8933     __Pyx_GOTREF(__pyx_t_1);
8934     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8935     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8936     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8937     __Pyx_INCREF(__pyx_int_184977713);
8938     __Pyx_GIVEREF(__pyx_int_184977713);
8939     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
8940     __Pyx_INCREF(Py_None);
8941     __Pyx_GIVEREF(Py_None);
8942     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
8943     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
8944     __Pyx_GOTREF(__pyx_t_5);
8945     __Pyx_GIVEREF(__pyx_t_4);
8946     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
8947     __Pyx_GIVEREF(__pyx_t_1);
8948     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
8949     __Pyx_INCREF(__pyx_v_state);
8950     __Pyx_GIVEREF(__pyx_v_state);
8951     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
8952     __pyx_t_4 = 0;
8953     __pyx_t_1 = 0;
8954     __pyx_r = __pyx_t_5;
8955     __pyx_t_5 = 0;
8956     goto __pyx_L0;
8957 
8958     /* "(tree fragment)":12
8959  *     else:
8960  *         use_setstate = self.name is not None
8961  *     if use_setstate:             # <<<<<<<<<<<<<<
8962  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
8963  *     else:
8964  */
8965   }
8966 
8967   /* "(tree fragment)":15
8968  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
8969  *     else:
8970  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
8971  * def __setstate_cython__(self, __pyx_state):
8972  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
8973  */
8974   /*else*/ {
8975     __Pyx_XDECREF(__pyx_r);
8976     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
8977     __Pyx_GOTREF(__pyx_t_5);
8978     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
8979     __Pyx_GOTREF(__pyx_t_1);
8980     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8981     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8982     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8983     __Pyx_INCREF(__pyx_int_184977713);
8984     __Pyx_GIVEREF(__pyx_int_184977713);
8985     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
8986     __Pyx_INCREF(__pyx_v_state);
8987     __Pyx_GIVEREF(__pyx_v_state);
8988     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
8989     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
8990     __Pyx_GOTREF(__pyx_t_4);
8991     __Pyx_GIVEREF(__pyx_t_5);
8992     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
8993     __Pyx_GIVEREF(__pyx_t_1);
8994     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
8995     __pyx_t_5 = 0;
8996     __pyx_t_1 = 0;
8997     __pyx_r = __pyx_t_4;
8998     __pyx_t_4 = 0;
8999     goto __pyx_L0;
9000   }
9001 
9002   /* "(tree fragment)":1
9003  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
9004  *     cdef tuple state
9005  *     cdef object _dict
9006  */
9007 
9008   /* function exit code */
9009   __pyx_L1_error:;
9010   __Pyx_XDECREF(__pyx_t_1);
9011   __Pyx_XDECREF(__pyx_t_4);
9012   __Pyx_XDECREF(__pyx_t_5);
9013   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9014   __pyx_r = NULL;
9015   __pyx_L0:;
9016   __Pyx_XDECREF(__pyx_v_state);
9017   __Pyx_XDECREF(__pyx_v__dict);
9018   __Pyx_XGIVEREF(__pyx_r);
9019   __Pyx_RefNannyFinishContext();
9020   return __pyx_r;
9021 }
9022 
9023 /* "(tree fragment)":16
9024  *     else:
9025  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9026  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9027  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9028  */
9029 
9030 /* Python wrapper */
9031 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)9032 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9033   PyObject *__pyx_r = 0;
9034   __Pyx_RefNannyDeclarations
9035   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
9036   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9037 
9038   /* function exit code */
9039   __Pyx_RefNannyFinishContext();
9040   return __pyx_r;
9041 }
9042 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)9043 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9044   PyObject *__pyx_r = NULL;
9045   __Pyx_RefNannyDeclarations
9046   PyObject *__pyx_t_1 = NULL;
9047   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
9048 
9049   /* "(tree fragment)":17
9050  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9051  * def __setstate_cython__(self, __pyx_state):
9052  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
9053  */
9054   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(1, 17, __pyx_L1_error)
9055   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
9056   __Pyx_GOTREF(__pyx_t_1);
9057   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9058 
9059   /* "(tree fragment)":16
9060  *     else:
9061  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9062  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9063  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9064  */
9065 
9066   /* function exit code */
9067   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9068   goto __pyx_L0;
9069   __pyx_L1_error:;
9070   __Pyx_XDECREF(__pyx_t_1);
9071   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9072   __pyx_r = NULL;
9073   __pyx_L0:;
9074   __Pyx_XGIVEREF(__pyx_r);
9075   __Pyx_RefNannyFinishContext();
9076   return __pyx_r;
9077 }
9078 
9079 /* "View.MemoryView":298
9080  *
9081  * @cname('__pyx_align_pointer')
9082  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
9083  *     "Align pointer memory on a given boundary"
9084  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
9085  */
9086 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)9087 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
9088   Py_intptr_t __pyx_v_aligned_p;
9089   size_t __pyx_v_offset;
9090   void *__pyx_r;
9091   int __pyx_t_1;
9092 
9093   /* "View.MemoryView":300
9094  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
9095  *     "Align pointer memory on a given boundary"
9096  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
9097  *     cdef size_t offset
9098  *
9099  */
9100   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
9101 
9102   /* "View.MemoryView":304
9103  *
9104  *     with cython.cdivision(True):
9105  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
9106  *
9107  *     if offset > 0:
9108  */
9109   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
9110 
9111   /* "View.MemoryView":306
9112  *         offset = aligned_p % alignment
9113  *
9114  *     if offset > 0:             # <<<<<<<<<<<<<<
9115  *         aligned_p += alignment - offset
9116  *
9117  */
9118   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
9119   if (__pyx_t_1) {
9120 
9121     /* "View.MemoryView":307
9122  *
9123  *     if offset > 0:
9124  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
9125  *
9126  *     return <void *> aligned_p
9127  */
9128     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
9129 
9130     /* "View.MemoryView":306
9131  *         offset = aligned_p % alignment
9132  *
9133  *     if offset > 0:             # <<<<<<<<<<<<<<
9134  *         aligned_p += alignment - offset
9135  *
9136  */
9137   }
9138 
9139   /* "View.MemoryView":309
9140  *         aligned_p += alignment - offset
9141  *
9142  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
9143  *
9144  *
9145  */
9146   __pyx_r = ((void *)__pyx_v_aligned_p);
9147   goto __pyx_L0;
9148 
9149   /* "View.MemoryView":298
9150  *
9151  * @cname('__pyx_align_pointer')
9152  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
9153  *     "Align pointer memory on a given boundary"
9154  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
9155  */
9156 
9157   /* function exit code */
9158   __pyx_L0:;
9159   return __pyx_r;
9160 }
9161 
9162 /* "View.MemoryView":345
9163  *     cdef __Pyx_TypeInfo *typeinfo
9164  *
9165  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
9166  *         self.obj = obj
9167  *         self.flags = flags
9168  */
9169 
9170 /* Python wrapper */
9171 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_memoryview___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)9172 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9173   PyObject *__pyx_v_obj = 0;
9174   int __pyx_v_flags;
9175   int __pyx_v_dtype_is_object;
9176   int __pyx_r;
9177   __Pyx_RefNannyDeclarations
9178   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
9179   {
9180     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
9181     PyObject* values[3] = {0,0,0};
9182     if (unlikely(__pyx_kwds)) {
9183       Py_ssize_t kw_args;
9184       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9185       switch (pos_args) {
9186         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9187         CYTHON_FALLTHROUGH;
9188         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9189         CYTHON_FALLTHROUGH;
9190         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9191         CYTHON_FALLTHROUGH;
9192         case  0: break;
9193         default: goto __pyx_L5_argtuple_error;
9194       }
9195       kw_args = PyDict_Size(__pyx_kwds);
9196       switch (pos_args) {
9197         case  0:
9198         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
9199         else goto __pyx_L5_argtuple_error;
9200         CYTHON_FALLTHROUGH;
9201         case  1:
9202         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
9203         else {
9204           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
9205         }
9206         CYTHON_FALLTHROUGH;
9207         case  2:
9208         if (kw_args > 0) {
9209           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
9210           if (value) { values[2] = value; kw_args--; }
9211         }
9212       }
9213       if (unlikely(kw_args > 0)) {
9214         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
9215       }
9216     } else {
9217       switch (PyTuple_GET_SIZE(__pyx_args)) {
9218         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9219         CYTHON_FALLTHROUGH;
9220         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9221         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9222         break;
9223         default: goto __pyx_L5_argtuple_error;
9224       }
9225     }
9226     __pyx_v_obj = values[0];
9227     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
9228     if (values[2]) {
9229       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
9230     } else {
9231       __pyx_v_dtype_is_object = ((int)0);
9232     }
9233   }
9234   goto __pyx_L4_argument_unpacking_done;
9235   __pyx_L5_argtuple_error:;
9236   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
9237   __pyx_L3_error:;
9238   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9239   __Pyx_RefNannyFinishContext();
9240   return -1;
9241   __pyx_L4_argument_unpacking_done:;
9242   __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);
9243 
9244   /* function exit code */
9245   __Pyx_RefNannyFinishContext();
9246   return __pyx_r;
9247 }
9248 
__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)9249 static 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) {
9250   int __pyx_r;
9251   __Pyx_RefNannyDeclarations
9252   int __pyx_t_1;
9253   int __pyx_t_2;
9254   int __pyx_t_3;
9255   int __pyx_t_4;
9256   __Pyx_RefNannySetupContext("__cinit__", 0);
9257 
9258   /* "View.MemoryView":346
9259  *
9260  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
9261  *         self.obj = obj             # <<<<<<<<<<<<<<
9262  *         self.flags = flags
9263  *         if type(self) is memoryview or obj is not None:
9264  */
9265   __Pyx_INCREF(__pyx_v_obj);
9266   __Pyx_GIVEREF(__pyx_v_obj);
9267   __Pyx_GOTREF(__pyx_v_self->obj);
9268   __Pyx_DECREF(__pyx_v_self->obj);
9269   __pyx_v_self->obj = __pyx_v_obj;
9270 
9271   /* "View.MemoryView":347
9272  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
9273  *         self.obj = obj
9274  *         self.flags = flags             # <<<<<<<<<<<<<<
9275  *         if type(self) is memoryview or obj is not None:
9276  *             __Pyx_GetBuffer(obj, &self.view, flags)
9277  */
9278   __pyx_v_self->flags = __pyx_v_flags;
9279 
9280   /* "View.MemoryView":348
9281  *         self.obj = obj
9282  *         self.flags = flags
9283  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
9284  *             __Pyx_GetBuffer(obj, &self.view, flags)
9285  *             if <PyObject *> self.view.obj == NULL:
9286  */
9287   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
9288   __pyx_t_3 = (__pyx_t_2 != 0);
9289   if (!__pyx_t_3) {
9290   } else {
9291     __pyx_t_1 = __pyx_t_3;
9292     goto __pyx_L4_bool_binop_done;
9293   }
9294   __pyx_t_3 = (__pyx_v_obj != Py_None);
9295   __pyx_t_2 = (__pyx_t_3 != 0);
9296   __pyx_t_1 = __pyx_t_2;
9297   __pyx_L4_bool_binop_done:;
9298   if (__pyx_t_1) {
9299 
9300     /* "View.MemoryView":349
9301  *         self.flags = flags
9302  *         if type(self) is memoryview or obj is not None:
9303  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
9304  *             if <PyObject *> self.view.obj == NULL:
9305  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9306  */
9307     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
9308 
9309     /* "View.MemoryView":350
9310  *         if type(self) is memoryview or obj is not None:
9311  *             __Pyx_GetBuffer(obj, &self.view, flags)
9312  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
9313  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9314  *                 Py_INCREF(Py_None)
9315  */
9316     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
9317     if (__pyx_t_1) {
9318 
9319       /* "View.MemoryView":351
9320  *             __Pyx_GetBuffer(obj, &self.view, flags)
9321  *             if <PyObject *> self.view.obj == NULL:
9322  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
9323  *                 Py_INCREF(Py_None)
9324  *
9325  */
9326       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
9327 
9328       /* "View.MemoryView":352
9329  *             if <PyObject *> self.view.obj == NULL:
9330  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9331  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
9332  *
9333  *         global __pyx_memoryview_thread_locks_used
9334  */
9335       Py_INCREF(Py_None);
9336 
9337       /* "View.MemoryView":350
9338  *         if type(self) is memoryview or obj is not None:
9339  *             __Pyx_GetBuffer(obj, &self.view, flags)
9340  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
9341  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9342  *                 Py_INCREF(Py_None)
9343  */
9344     }
9345 
9346     /* "View.MemoryView":348
9347  *         self.obj = obj
9348  *         self.flags = flags
9349  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
9350  *             __Pyx_GetBuffer(obj, &self.view, flags)
9351  *             if <PyObject *> self.view.obj == NULL:
9352  */
9353   }
9354 
9355   /* "View.MemoryView":355
9356  *
9357  *         global __pyx_memoryview_thread_locks_used
9358  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
9359  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9360  *             __pyx_memoryview_thread_locks_used += 1
9361  */
9362   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
9363   if (__pyx_t_1) {
9364 
9365     /* "View.MemoryView":356
9366  *         global __pyx_memoryview_thread_locks_used
9367  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
9368  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
9369  *             __pyx_memoryview_thread_locks_used += 1
9370  *         if self.lock is NULL:
9371  */
9372     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9373 
9374     /* "View.MemoryView":357
9375  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
9376  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9377  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
9378  *         if self.lock is NULL:
9379  *             self.lock = PyThread_allocate_lock()
9380  */
9381     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
9382 
9383     /* "View.MemoryView":355
9384  *
9385  *         global __pyx_memoryview_thread_locks_used
9386  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
9387  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9388  *             __pyx_memoryview_thread_locks_used += 1
9389  */
9390   }
9391 
9392   /* "View.MemoryView":358
9393  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9394  *             __pyx_memoryview_thread_locks_used += 1
9395  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
9396  *             self.lock = PyThread_allocate_lock()
9397  *             if self.lock is NULL:
9398  */
9399   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9400   if (__pyx_t_1) {
9401 
9402     /* "View.MemoryView":359
9403  *             __pyx_memoryview_thread_locks_used += 1
9404  *         if self.lock is NULL:
9405  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
9406  *             if self.lock is NULL:
9407  *                 raise MemoryError
9408  */
9409     __pyx_v_self->lock = PyThread_allocate_lock();
9410 
9411     /* "View.MemoryView":360
9412  *         if self.lock is NULL:
9413  *             self.lock = PyThread_allocate_lock()
9414  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
9415  *                 raise MemoryError
9416  *
9417  */
9418     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9419     if (unlikely(__pyx_t_1)) {
9420 
9421       /* "View.MemoryView":361
9422  *             self.lock = PyThread_allocate_lock()
9423  *             if self.lock is NULL:
9424  *                 raise MemoryError             # <<<<<<<<<<<<<<
9425  *
9426  *         if flags & PyBUF_FORMAT:
9427  */
9428       PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
9429 
9430       /* "View.MemoryView":360
9431  *         if self.lock is NULL:
9432  *             self.lock = PyThread_allocate_lock()
9433  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
9434  *                 raise MemoryError
9435  *
9436  */
9437     }
9438 
9439     /* "View.MemoryView":358
9440  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9441  *             __pyx_memoryview_thread_locks_used += 1
9442  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
9443  *             self.lock = PyThread_allocate_lock()
9444  *             if self.lock is NULL:
9445  */
9446   }
9447 
9448   /* "View.MemoryView":363
9449  *                 raise MemoryError
9450  *
9451  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
9452  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9453  *         else:
9454  */
9455   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9456   if (__pyx_t_1) {
9457 
9458     /* "View.MemoryView":364
9459  *
9460  *         if flags & PyBUF_FORMAT:
9461  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
9462  *         else:
9463  *             self.dtype_is_object = dtype_is_object
9464  */
9465     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
9466     if (__pyx_t_2) {
9467     } else {
9468       __pyx_t_1 = __pyx_t_2;
9469       goto __pyx_L11_bool_binop_done;
9470     }
9471     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
9472     __pyx_t_1 = __pyx_t_2;
9473     __pyx_L11_bool_binop_done:;
9474     __pyx_v_self->dtype_is_object = __pyx_t_1;
9475 
9476     /* "View.MemoryView":363
9477  *                 raise MemoryError
9478  *
9479  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
9480  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9481  *         else:
9482  */
9483     goto __pyx_L10;
9484   }
9485 
9486   /* "View.MemoryView":366
9487  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9488  *         else:
9489  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
9490  *
9491  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
9492  */
9493   /*else*/ {
9494     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
9495   }
9496   __pyx_L10:;
9497 
9498   /* "View.MemoryView":368
9499  *             self.dtype_is_object = dtype_is_object
9500  *
9501  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
9502  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
9503  *         self.typeinfo = NULL
9504  */
9505   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
9506 
9507   /* "View.MemoryView":370
9508  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
9509  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
9510  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
9511  *
9512  *     def __dealloc__(memoryview self):
9513  */
9514   __pyx_v_self->typeinfo = NULL;
9515 
9516   /* "View.MemoryView":345
9517  *     cdef __Pyx_TypeInfo *typeinfo
9518  *
9519  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
9520  *         self.obj = obj
9521  *         self.flags = flags
9522  */
9523 
9524   /* function exit code */
9525   __pyx_r = 0;
9526   goto __pyx_L0;
9527   __pyx_L1_error:;
9528   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9529   __pyx_r = -1;
9530   __pyx_L0:;
9531   __Pyx_RefNannyFinishContext();
9532   return __pyx_r;
9533 }
9534 
9535 /* "View.MemoryView":372
9536  *         self.typeinfo = NULL
9537  *
9538  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
9539  *         if self.obj is not None:
9540  *             __Pyx_ReleaseBuffer(&self.view)
9541  */
9542 
9543 /* Python wrapper */
9544 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)9545 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
9546   __Pyx_RefNannyDeclarations
9547   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
9548   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
9549 
9550   /* function exit code */
9551   __Pyx_RefNannyFinishContext();
9552 }
9553 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)9554 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
9555   int __pyx_v_i;
9556   __Pyx_RefNannyDeclarations
9557   int __pyx_t_1;
9558   int __pyx_t_2;
9559   int __pyx_t_3;
9560   int __pyx_t_4;
9561   int __pyx_t_5;
9562   PyThread_type_lock __pyx_t_6;
9563   PyThread_type_lock __pyx_t_7;
9564   __Pyx_RefNannySetupContext("__dealloc__", 0);
9565 
9566   /* "View.MemoryView":373
9567  *
9568  *     def __dealloc__(memoryview self):
9569  *         if self.obj is not None:             # <<<<<<<<<<<<<<
9570  *             __Pyx_ReleaseBuffer(&self.view)
9571  *
9572  */
9573   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
9574   __pyx_t_2 = (__pyx_t_1 != 0);
9575   if (__pyx_t_2) {
9576 
9577     /* "View.MemoryView":374
9578  *     def __dealloc__(memoryview self):
9579  *         if self.obj is not None:
9580  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
9581  *
9582  *         cdef int i
9583  */
9584     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
9585 
9586     /* "View.MemoryView":373
9587  *
9588  *     def __dealloc__(memoryview self):
9589  *         if self.obj is not None:             # <<<<<<<<<<<<<<
9590  *             __Pyx_ReleaseBuffer(&self.view)
9591  *
9592  */
9593   }
9594 
9595   /* "View.MemoryView":378
9596  *         cdef int i
9597  *         global __pyx_memoryview_thread_locks_used
9598  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
9599  *             for i in range(__pyx_memoryview_thread_locks_used):
9600  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9601  */
9602   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
9603   if (__pyx_t_2) {
9604 
9605     /* "View.MemoryView":379
9606  *         global __pyx_memoryview_thread_locks_used
9607  *         if self.lock != NULL:
9608  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
9609  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9610  *                     __pyx_memoryview_thread_locks_used -= 1
9611  */
9612     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
9613     __pyx_t_4 = __pyx_t_3;
9614     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
9615       __pyx_v_i = __pyx_t_5;
9616 
9617       /* "View.MemoryView":380
9618  *         if self.lock != NULL:
9619  *             for i in range(__pyx_memoryview_thread_locks_used):
9620  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
9621  *                     __pyx_memoryview_thread_locks_used -= 1
9622  *                     if i != __pyx_memoryview_thread_locks_used:
9623  */
9624       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
9625       if (__pyx_t_2) {
9626 
9627         /* "View.MemoryView":381
9628  *             for i in range(__pyx_memoryview_thread_locks_used):
9629  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9630  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
9631  *                     if i != __pyx_memoryview_thread_locks_used:
9632  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9633  */
9634         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
9635 
9636         /* "View.MemoryView":382
9637  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9638  *                     __pyx_memoryview_thread_locks_used -= 1
9639  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
9640  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9641  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9642  */
9643         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
9644         if (__pyx_t_2) {
9645 
9646           /* "View.MemoryView":384
9647  *                     if i != __pyx_memoryview_thread_locks_used:
9648  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9649  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
9650  *                     break
9651  *             else:
9652  */
9653           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9654           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
9655 
9656           /* "View.MemoryView":383
9657  *                     __pyx_memoryview_thread_locks_used -= 1
9658  *                     if i != __pyx_memoryview_thread_locks_used:
9659  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
9660  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9661  *                     break
9662  */
9663           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
9664           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
9665 
9666           /* "View.MemoryView":382
9667  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9668  *                     __pyx_memoryview_thread_locks_used -= 1
9669  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
9670  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9671  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9672  */
9673         }
9674 
9675         /* "View.MemoryView":385
9676  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9677  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9678  *                     break             # <<<<<<<<<<<<<<
9679  *             else:
9680  *                 PyThread_free_lock(self.lock)
9681  */
9682         goto __pyx_L6_break;
9683 
9684         /* "View.MemoryView":380
9685  *         if self.lock != NULL:
9686  *             for i in range(__pyx_memoryview_thread_locks_used):
9687  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
9688  *                     __pyx_memoryview_thread_locks_used -= 1
9689  *                     if i != __pyx_memoryview_thread_locks_used:
9690  */
9691       }
9692     }
9693     /*else*/ {
9694 
9695       /* "View.MemoryView":387
9696  *                     break
9697  *             else:
9698  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
9699  *
9700  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
9701  */
9702       PyThread_free_lock(__pyx_v_self->lock);
9703     }
9704     __pyx_L6_break:;
9705 
9706     /* "View.MemoryView":378
9707  *         cdef int i
9708  *         global __pyx_memoryview_thread_locks_used
9709  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
9710  *             for i in range(__pyx_memoryview_thread_locks_used):
9711  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9712  */
9713   }
9714 
9715   /* "View.MemoryView":372
9716  *         self.typeinfo = NULL
9717  *
9718  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
9719  *         if self.obj is not None:
9720  *             __Pyx_ReleaseBuffer(&self.view)
9721  */
9722 
9723   /* function exit code */
9724   __Pyx_RefNannyFinishContext();
9725 }
9726 
9727 /* "View.MemoryView":389
9728  *                 PyThread_free_lock(self.lock)
9729  *
9730  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
9731  *         cdef Py_ssize_t dim
9732  *         cdef char *itemp = <char *> self.view.buf
9733  */
9734 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)9735 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
9736   Py_ssize_t __pyx_v_dim;
9737   char *__pyx_v_itemp;
9738   PyObject *__pyx_v_idx = NULL;
9739   char *__pyx_r;
9740   __Pyx_RefNannyDeclarations
9741   Py_ssize_t __pyx_t_1;
9742   PyObject *__pyx_t_2 = NULL;
9743   Py_ssize_t __pyx_t_3;
9744   PyObject *(*__pyx_t_4)(PyObject *);
9745   PyObject *__pyx_t_5 = NULL;
9746   Py_ssize_t __pyx_t_6;
9747   char *__pyx_t_7;
9748   __Pyx_RefNannySetupContext("get_item_pointer", 0);
9749 
9750   /* "View.MemoryView":391
9751  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
9752  *         cdef Py_ssize_t dim
9753  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
9754  *
9755  *         for dim, idx in enumerate(index):
9756  */
9757   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
9758 
9759   /* "View.MemoryView":393
9760  *         cdef char *itemp = <char *> self.view.buf
9761  *
9762  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
9763  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
9764  *
9765  */
9766   __pyx_t_1 = 0;
9767   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
9768     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
9769     __pyx_t_4 = NULL;
9770   } else {
9771     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 393, __pyx_L1_error)
9772     __Pyx_GOTREF(__pyx_t_2);
9773     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 393, __pyx_L1_error)
9774   }
9775   for (;;) {
9776     if (likely(!__pyx_t_4)) {
9777       if (likely(PyList_CheckExact(__pyx_t_2))) {
9778         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
9779         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9780         __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(1, 393, __pyx_L1_error)
9781         #else
9782         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 393, __pyx_L1_error)
9783         __Pyx_GOTREF(__pyx_t_5);
9784         #endif
9785       } else {
9786         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
9787         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9788         __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(1, 393, __pyx_L1_error)
9789         #else
9790         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 393, __pyx_L1_error)
9791         __Pyx_GOTREF(__pyx_t_5);
9792         #endif
9793       }
9794     } else {
9795       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
9796       if (unlikely(!__pyx_t_5)) {
9797         PyObject* exc_type = PyErr_Occurred();
9798         if (exc_type) {
9799           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9800           else __PYX_ERR(1, 393, __pyx_L1_error)
9801         }
9802         break;
9803       }
9804       __Pyx_GOTREF(__pyx_t_5);
9805     }
9806     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
9807     __pyx_t_5 = 0;
9808     __pyx_v_dim = __pyx_t_1;
9809     __pyx_t_1 = (__pyx_t_1 + 1);
9810 
9811     /* "View.MemoryView":394
9812  *
9813  *         for dim, idx in enumerate(index):
9814  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
9815  *
9816  *         return itemp
9817  */
9818     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 394, __pyx_L1_error)
9819     __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(1, 394, __pyx_L1_error)
9820     __pyx_v_itemp = __pyx_t_7;
9821 
9822     /* "View.MemoryView":393
9823  *         cdef char *itemp = <char *> self.view.buf
9824  *
9825  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
9826  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
9827  *
9828  */
9829   }
9830   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9831 
9832   /* "View.MemoryView":396
9833  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
9834  *
9835  *         return itemp             # <<<<<<<<<<<<<<
9836  *
9837  *
9838  */
9839   __pyx_r = __pyx_v_itemp;
9840   goto __pyx_L0;
9841 
9842   /* "View.MemoryView":389
9843  *                 PyThread_free_lock(self.lock)
9844  *
9845  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
9846  *         cdef Py_ssize_t dim
9847  *         cdef char *itemp = <char *> self.view.buf
9848  */
9849 
9850   /* function exit code */
9851   __pyx_L1_error:;
9852   __Pyx_XDECREF(__pyx_t_2);
9853   __Pyx_XDECREF(__pyx_t_5);
9854   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
9855   __pyx_r = NULL;
9856   __pyx_L0:;
9857   __Pyx_XDECREF(__pyx_v_idx);
9858   __Pyx_RefNannyFinishContext();
9859   return __pyx_r;
9860 }
9861 
9862 /* "View.MemoryView":399
9863  *
9864  *
9865  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
9866  *         if index is Ellipsis:
9867  *             return self
9868  */
9869 
9870 /* Python wrapper */
9871 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
__pyx_memoryview___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index)9872 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
9873   PyObject *__pyx_r = 0;
9874   __Pyx_RefNannyDeclarations
9875   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
9876   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
9877 
9878   /* function exit code */
9879   __Pyx_RefNannyFinishContext();
9880   return __pyx_r;
9881 }
9882 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)9883 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
9884   PyObject *__pyx_v_have_slices = NULL;
9885   PyObject *__pyx_v_indices = NULL;
9886   char *__pyx_v_itemp;
9887   PyObject *__pyx_r = NULL;
9888   __Pyx_RefNannyDeclarations
9889   int __pyx_t_1;
9890   int __pyx_t_2;
9891   PyObject *__pyx_t_3 = NULL;
9892   PyObject *__pyx_t_4 = NULL;
9893   PyObject *__pyx_t_5 = NULL;
9894   char *__pyx_t_6;
9895   __Pyx_RefNannySetupContext("__getitem__", 0);
9896 
9897   /* "View.MemoryView":400
9898  *
9899  *     def __getitem__(memoryview self, object index):
9900  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
9901  *             return self
9902  *
9903  */
9904   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
9905   __pyx_t_2 = (__pyx_t_1 != 0);
9906   if (__pyx_t_2) {
9907 
9908     /* "View.MemoryView":401
9909  *     def __getitem__(memoryview self, object index):
9910  *         if index is Ellipsis:
9911  *             return self             # <<<<<<<<<<<<<<
9912  *
9913  *         have_slices, indices = _unellipsify(index, self.view.ndim)
9914  */
9915     __Pyx_XDECREF(__pyx_r);
9916     __Pyx_INCREF(((PyObject *)__pyx_v_self));
9917     __pyx_r = ((PyObject *)__pyx_v_self);
9918     goto __pyx_L0;
9919 
9920     /* "View.MemoryView":400
9921  *
9922  *     def __getitem__(memoryview self, object index):
9923  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
9924  *             return self
9925  *
9926  */
9927   }
9928 
9929   /* "View.MemoryView":403
9930  *             return self
9931  *
9932  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
9933  *
9934  *         cdef char *itemp
9935  */
9936   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 403, __pyx_L1_error)
9937   __Pyx_GOTREF(__pyx_t_3);
9938   if (likely(__pyx_t_3 != Py_None)) {
9939     PyObject* sequence = __pyx_t_3;
9940     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9941     if (unlikely(size != 2)) {
9942       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9943       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9944       __PYX_ERR(1, 403, __pyx_L1_error)
9945     }
9946     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9947     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
9948     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
9949     __Pyx_INCREF(__pyx_t_4);
9950     __Pyx_INCREF(__pyx_t_5);
9951     #else
9952     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 403, __pyx_L1_error)
9953     __Pyx_GOTREF(__pyx_t_4);
9954     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 403, __pyx_L1_error)
9955     __Pyx_GOTREF(__pyx_t_5);
9956     #endif
9957     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9958   } else {
9959     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 403, __pyx_L1_error)
9960   }
9961   __pyx_v_have_slices = __pyx_t_4;
9962   __pyx_t_4 = 0;
9963   __pyx_v_indices = __pyx_t_5;
9964   __pyx_t_5 = 0;
9965 
9966   /* "View.MemoryView":406
9967  *
9968  *         cdef char *itemp
9969  *         if have_slices:             # <<<<<<<<<<<<<<
9970  *             return memview_slice(self, indices)
9971  *         else:
9972  */
9973   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 406, __pyx_L1_error)
9974   if (__pyx_t_2) {
9975 
9976     /* "View.MemoryView":407
9977  *         cdef char *itemp
9978  *         if have_slices:
9979  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
9980  *         else:
9981  *             itemp = self.get_item_pointer(indices)
9982  */
9983     __Pyx_XDECREF(__pyx_r);
9984     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
9985     __Pyx_GOTREF(__pyx_t_3);
9986     __pyx_r = __pyx_t_3;
9987     __pyx_t_3 = 0;
9988     goto __pyx_L0;
9989 
9990     /* "View.MemoryView":406
9991  *
9992  *         cdef char *itemp
9993  *         if have_slices:             # <<<<<<<<<<<<<<
9994  *             return memview_slice(self, indices)
9995  *         else:
9996  */
9997   }
9998 
9999   /* "View.MemoryView":409
10000  *             return memview_slice(self, indices)
10001  *         else:
10002  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
10003  *             return self.convert_item_to_object(itemp)
10004  *
10005  */
10006   /*else*/ {
10007     __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(1, 409, __pyx_L1_error)
10008     __pyx_v_itemp = __pyx_t_6;
10009 
10010     /* "View.MemoryView":410
10011  *         else:
10012  *             itemp = self.get_item_pointer(indices)
10013  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
10014  *
10015  *     def __setitem__(memoryview self, object index, object value):
10016  */
10017     __Pyx_XDECREF(__pyx_r);
10018     __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(1, 410, __pyx_L1_error)
10019     __Pyx_GOTREF(__pyx_t_3);
10020     __pyx_r = __pyx_t_3;
10021     __pyx_t_3 = 0;
10022     goto __pyx_L0;
10023   }
10024 
10025   /* "View.MemoryView":399
10026  *
10027  *
10028  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
10029  *         if index is Ellipsis:
10030  *             return self
10031  */
10032 
10033   /* function exit code */
10034   __pyx_L1_error:;
10035   __Pyx_XDECREF(__pyx_t_3);
10036   __Pyx_XDECREF(__pyx_t_4);
10037   __Pyx_XDECREF(__pyx_t_5);
10038   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10039   __pyx_r = NULL;
10040   __pyx_L0:;
10041   __Pyx_XDECREF(__pyx_v_have_slices);
10042   __Pyx_XDECREF(__pyx_v_indices);
10043   __Pyx_XGIVEREF(__pyx_r);
10044   __Pyx_RefNannyFinishContext();
10045   return __pyx_r;
10046 }
10047 
10048 /* "View.MemoryView":412
10049  *             return self.convert_item_to_object(itemp)
10050  *
10051  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
10052  *         if self.view.readonly:
10053  *             raise TypeError("Cannot assign to read-only memoryview")
10054  */
10055 
10056 /* Python wrapper */
10057 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
__pyx_memoryview___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)10058 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10059   int __pyx_r;
10060   __Pyx_RefNannyDeclarations
10061   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
10062   __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));
10063 
10064   /* function exit code */
10065   __Pyx_RefNannyFinishContext();
10066   return __pyx_r;
10067 }
10068 
__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)10069 static 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) {
10070   PyObject *__pyx_v_have_slices = NULL;
10071   PyObject *__pyx_v_obj = NULL;
10072   int __pyx_r;
10073   __Pyx_RefNannyDeclarations
10074   int __pyx_t_1;
10075   PyObject *__pyx_t_2 = NULL;
10076   PyObject *__pyx_t_3 = NULL;
10077   PyObject *__pyx_t_4 = NULL;
10078   __Pyx_RefNannySetupContext("__setitem__", 0);
10079   __Pyx_INCREF(__pyx_v_index);
10080 
10081   /* "View.MemoryView":413
10082  *
10083  *     def __setitem__(memoryview self, object index, object value):
10084  *         if self.view.readonly:             # <<<<<<<<<<<<<<
10085  *             raise TypeError("Cannot assign to read-only memoryview")
10086  *
10087  */
10088   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
10089   if (unlikely(__pyx_t_1)) {
10090 
10091     /* "View.MemoryView":414
10092  *     def __setitem__(memoryview self, object index, object value):
10093  *         if self.view.readonly:
10094  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
10095  *
10096  *         have_slices, index = _unellipsify(index, self.view.ndim)
10097  */
10098     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 414, __pyx_L1_error)
10099     __Pyx_GOTREF(__pyx_t_2);
10100     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10101     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10102     __PYX_ERR(1, 414, __pyx_L1_error)
10103 
10104     /* "View.MemoryView":413
10105  *
10106  *     def __setitem__(memoryview self, object index, object value):
10107  *         if self.view.readonly:             # <<<<<<<<<<<<<<
10108  *             raise TypeError("Cannot assign to read-only memoryview")
10109  *
10110  */
10111   }
10112 
10113   /* "View.MemoryView":416
10114  *             raise TypeError("Cannot assign to read-only memoryview")
10115  *
10116  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
10117  *
10118  *         if have_slices:
10119  */
10120   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error)
10121   __Pyx_GOTREF(__pyx_t_2);
10122   if (likely(__pyx_t_2 != Py_None)) {
10123     PyObject* sequence = __pyx_t_2;
10124     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10125     if (unlikely(size != 2)) {
10126       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10127       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10128       __PYX_ERR(1, 416, __pyx_L1_error)
10129     }
10130     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10131     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
10132     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
10133     __Pyx_INCREF(__pyx_t_3);
10134     __Pyx_INCREF(__pyx_t_4);
10135     #else
10136     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 416, __pyx_L1_error)
10137     __Pyx_GOTREF(__pyx_t_3);
10138     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 416, __pyx_L1_error)
10139     __Pyx_GOTREF(__pyx_t_4);
10140     #endif
10141     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10142   } else {
10143     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 416, __pyx_L1_error)
10144   }
10145   __pyx_v_have_slices = __pyx_t_3;
10146   __pyx_t_3 = 0;
10147   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
10148   __pyx_t_4 = 0;
10149 
10150   /* "View.MemoryView":418
10151  *         have_slices, index = _unellipsify(index, self.view.ndim)
10152  *
10153  *         if have_slices:             # <<<<<<<<<<<<<<
10154  *             obj = self.is_slice(value)
10155  *             if obj:
10156  */
10157   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 418, __pyx_L1_error)
10158   if (__pyx_t_1) {
10159 
10160     /* "View.MemoryView":419
10161  *
10162  *         if have_slices:
10163  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
10164  *             if obj:
10165  *                 self.setitem_slice_assignment(self[index], obj)
10166  */
10167     __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(1, 419, __pyx_L1_error)
10168     __Pyx_GOTREF(__pyx_t_2);
10169     __pyx_v_obj = __pyx_t_2;
10170     __pyx_t_2 = 0;
10171 
10172     /* "View.MemoryView":420
10173  *         if have_slices:
10174  *             obj = self.is_slice(value)
10175  *             if obj:             # <<<<<<<<<<<<<<
10176  *                 self.setitem_slice_assignment(self[index], obj)
10177  *             else:
10178  */
10179     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 420, __pyx_L1_error)
10180     if (__pyx_t_1) {
10181 
10182       /* "View.MemoryView":421
10183  *             obj = self.is_slice(value)
10184  *             if obj:
10185  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
10186  *             else:
10187  *                 self.setitem_slice_assign_scalar(self[index], value)
10188  */
10189       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 421, __pyx_L1_error)
10190       __Pyx_GOTREF(__pyx_t_2);
10191       __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(1, 421, __pyx_L1_error)
10192       __Pyx_GOTREF(__pyx_t_4);
10193       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10194       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10195 
10196       /* "View.MemoryView":420
10197  *         if have_slices:
10198  *             obj = self.is_slice(value)
10199  *             if obj:             # <<<<<<<<<<<<<<
10200  *                 self.setitem_slice_assignment(self[index], obj)
10201  *             else:
10202  */
10203       goto __pyx_L5;
10204     }
10205 
10206     /* "View.MemoryView":423
10207  *                 self.setitem_slice_assignment(self[index], obj)
10208  *             else:
10209  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
10210  *         else:
10211  *             self.setitem_indexed(index, value)
10212  */
10213     /*else*/ {
10214       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 423, __pyx_L1_error)
10215       __Pyx_GOTREF(__pyx_t_4);
10216       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 423, __pyx_L1_error)
10217       __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(1, 423, __pyx_L1_error)
10218       __Pyx_GOTREF(__pyx_t_2);
10219       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10220       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10221     }
10222     __pyx_L5:;
10223 
10224     /* "View.MemoryView":418
10225  *         have_slices, index = _unellipsify(index, self.view.ndim)
10226  *
10227  *         if have_slices:             # <<<<<<<<<<<<<<
10228  *             obj = self.is_slice(value)
10229  *             if obj:
10230  */
10231     goto __pyx_L4;
10232   }
10233 
10234   /* "View.MemoryView":425
10235  *                 self.setitem_slice_assign_scalar(self[index], value)
10236  *         else:
10237  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
10238  *
10239  *     cdef is_slice(self, obj):
10240  */
10241   /*else*/ {
10242     __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(1, 425, __pyx_L1_error)
10243     __Pyx_GOTREF(__pyx_t_2);
10244     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10245   }
10246   __pyx_L4:;
10247 
10248   /* "View.MemoryView":412
10249  *             return self.convert_item_to_object(itemp)
10250  *
10251  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
10252  *         if self.view.readonly:
10253  *             raise TypeError("Cannot assign to read-only memoryview")
10254  */
10255 
10256   /* function exit code */
10257   __pyx_r = 0;
10258   goto __pyx_L0;
10259   __pyx_L1_error:;
10260   __Pyx_XDECREF(__pyx_t_2);
10261   __Pyx_XDECREF(__pyx_t_3);
10262   __Pyx_XDECREF(__pyx_t_4);
10263   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10264   __pyx_r = -1;
10265   __pyx_L0:;
10266   __Pyx_XDECREF(__pyx_v_have_slices);
10267   __Pyx_XDECREF(__pyx_v_obj);
10268   __Pyx_XDECREF(__pyx_v_index);
10269   __Pyx_RefNannyFinishContext();
10270   return __pyx_r;
10271 }
10272 
10273 /* "View.MemoryView":427
10274  *             self.setitem_indexed(index, value)
10275  *
10276  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
10277  *         if not isinstance(obj, memoryview):
10278  *             try:
10279  */
10280 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)10281 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
10282   PyObject *__pyx_r = NULL;
10283   __Pyx_RefNannyDeclarations
10284   int __pyx_t_1;
10285   int __pyx_t_2;
10286   PyObject *__pyx_t_3 = NULL;
10287   PyObject *__pyx_t_4 = NULL;
10288   PyObject *__pyx_t_5 = NULL;
10289   PyObject *__pyx_t_6 = NULL;
10290   PyObject *__pyx_t_7 = NULL;
10291   PyObject *__pyx_t_8 = NULL;
10292   int __pyx_t_9;
10293   __Pyx_RefNannySetupContext("is_slice", 0);
10294   __Pyx_INCREF(__pyx_v_obj);
10295 
10296   /* "View.MemoryView":428
10297  *
10298  *     cdef is_slice(self, obj):
10299  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
10300  *             try:
10301  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10302  */
10303   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
10304   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
10305   if (__pyx_t_2) {
10306 
10307     /* "View.MemoryView":429
10308  *     cdef is_slice(self, obj):
10309  *         if not isinstance(obj, memoryview):
10310  *             try:             # <<<<<<<<<<<<<<
10311  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10312  *                                  self.dtype_is_object)
10313  */
10314     {
10315       __Pyx_PyThreadState_declare
10316       __Pyx_PyThreadState_assign
10317       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
10318       __Pyx_XGOTREF(__pyx_t_3);
10319       __Pyx_XGOTREF(__pyx_t_4);
10320       __Pyx_XGOTREF(__pyx_t_5);
10321       /*try:*/ {
10322 
10323         /* "View.MemoryView":430
10324  *         if not isinstance(obj, memoryview):
10325  *             try:
10326  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
10327  *                                  self.dtype_is_object)
10328  *             except TypeError:
10329  */
10330         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 430, __pyx_L4_error)
10331         __Pyx_GOTREF(__pyx_t_6);
10332 
10333         /* "View.MemoryView":431
10334  *             try:
10335  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10336  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
10337  *             except TypeError:
10338  *                 return None
10339  */
10340         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 431, __pyx_L4_error)
10341         __Pyx_GOTREF(__pyx_t_7);
10342 
10343         /* "View.MemoryView":430
10344  *         if not isinstance(obj, memoryview):
10345  *             try:
10346  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
10347  *                                  self.dtype_is_object)
10348  *             except TypeError:
10349  */
10350         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 430, __pyx_L4_error)
10351         __Pyx_GOTREF(__pyx_t_8);
10352         __Pyx_INCREF(__pyx_v_obj);
10353         __Pyx_GIVEREF(__pyx_v_obj);
10354         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
10355         __Pyx_GIVEREF(__pyx_t_6);
10356         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
10357         __Pyx_GIVEREF(__pyx_t_7);
10358         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
10359         __pyx_t_6 = 0;
10360         __pyx_t_7 = 0;
10361         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 430, __pyx_L4_error)
10362         __Pyx_GOTREF(__pyx_t_7);
10363         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10364         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
10365         __pyx_t_7 = 0;
10366 
10367         /* "View.MemoryView":429
10368  *     cdef is_slice(self, obj):
10369  *         if not isinstance(obj, memoryview):
10370  *             try:             # <<<<<<<<<<<<<<
10371  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10372  *                                  self.dtype_is_object)
10373  */
10374       }
10375       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10376       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10377       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10378       goto __pyx_L9_try_end;
10379       __pyx_L4_error:;
10380       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10381       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10382       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
10383 
10384       /* "View.MemoryView":432
10385  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10386  *                                  self.dtype_is_object)
10387  *             except TypeError:             # <<<<<<<<<<<<<<
10388  *                 return None
10389  *
10390  */
10391       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
10392       if (__pyx_t_9) {
10393         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10394         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 432, __pyx_L6_except_error)
10395         __Pyx_GOTREF(__pyx_t_7);
10396         __Pyx_GOTREF(__pyx_t_8);
10397         __Pyx_GOTREF(__pyx_t_6);
10398 
10399         /* "View.MemoryView":433
10400  *                                  self.dtype_is_object)
10401  *             except TypeError:
10402  *                 return None             # <<<<<<<<<<<<<<
10403  *
10404  *         return obj
10405  */
10406         __Pyx_XDECREF(__pyx_r);
10407         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10408         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10409         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10410         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10411         goto __pyx_L7_except_return;
10412       }
10413       goto __pyx_L6_except_error;
10414       __pyx_L6_except_error:;
10415 
10416       /* "View.MemoryView":429
10417  *     cdef is_slice(self, obj):
10418  *         if not isinstance(obj, memoryview):
10419  *             try:             # <<<<<<<<<<<<<<
10420  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10421  *                                  self.dtype_is_object)
10422  */
10423       __Pyx_XGIVEREF(__pyx_t_3);
10424       __Pyx_XGIVEREF(__pyx_t_4);
10425       __Pyx_XGIVEREF(__pyx_t_5);
10426       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10427       goto __pyx_L1_error;
10428       __pyx_L7_except_return:;
10429       __Pyx_XGIVEREF(__pyx_t_3);
10430       __Pyx_XGIVEREF(__pyx_t_4);
10431       __Pyx_XGIVEREF(__pyx_t_5);
10432       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10433       goto __pyx_L0;
10434       __pyx_L9_try_end:;
10435     }
10436 
10437     /* "View.MemoryView":428
10438  *
10439  *     cdef is_slice(self, obj):
10440  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
10441  *             try:
10442  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10443  */
10444   }
10445 
10446   /* "View.MemoryView":435
10447  *                 return None
10448  *
10449  *         return obj             # <<<<<<<<<<<<<<
10450  *
10451  *     cdef setitem_slice_assignment(self, dst, src):
10452  */
10453   __Pyx_XDECREF(__pyx_r);
10454   __Pyx_INCREF(__pyx_v_obj);
10455   __pyx_r = __pyx_v_obj;
10456   goto __pyx_L0;
10457 
10458   /* "View.MemoryView":427
10459  *             self.setitem_indexed(index, value)
10460  *
10461  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
10462  *         if not isinstance(obj, memoryview):
10463  *             try:
10464  */
10465 
10466   /* function exit code */
10467   __pyx_L1_error:;
10468   __Pyx_XDECREF(__pyx_t_6);
10469   __Pyx_XDECREF(__pyx_t_7);
10470   __Pyx_XDECREF(__pyx_t_8);
10471   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10472   __pyx_r = 0;
10473   __pyx_L0:;
10474   __Pyx_XDECREF(__pyx_v_obj);
10475   __Pyx_XGIVEREF(__pyx_r);
10476   __Pyx_RefNannyFinishContext();
10477   return __pyx_r;
10478 }
10479 
10480 /* "View.MemoryView":437
10481  *         return obj
10482  *
10483  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
10484  *         cdef __Pyx_memviewslice dst_slice
10485  *         cdef __Pyx_memviewslice src_slice
10486  */
10487 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)10488 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
10489   __Pyx_memviewslice __pyx_v_dst_slice;
10490   __Pyx_memviewslice __pyx_v_src_slice;
10491   PyObject *__pyx_r = NULL;
10492   __Pyx_RefNannyDeclarations
10493   PyObject *__pyx_t_1 = NULL;
10494   int __pyx_t_2;
10495   int __pyx_t_3;
10496   int __pyx_t_4;
10497   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
10498 
10499   /* "View.MemoryView":441
10500  *         cdef __Pyx_memviewslice src_slice
10501  *
10502  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
10503  *                                  get_slice_from_memview(dst, &dst_slice)[0],
10504  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10505  */
10506   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 441, __pyx_L1_error)
10507 
10508   /* "View.MemoryView":442
10509  *
10510  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
10511  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
10512  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10513  *
10514  */
10515   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 442, __pyx_L1_error)
10516 
10517   /* "View.MemoryView":443
10518  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
10519  *                                  get_slice_from_memview(dst, &dst_slice)[0],
10520  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
10521  *
10522  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
10523  */
10524   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 443, __pyx_L1_error)
10525   __Pyx_GOTREF(__pyx_t_1);
10526   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 443, __pyx_L1_error)
10527   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10528   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 443, __pyx_L1_error)
10529   __Pyx_GOTREF(__pyx_t_1);
10530   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 443, __pyx_L1_error)
10531   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10532 
10533   /* "View.MemoryView":441
10534  *         cdef __Pyx_memviewslice src_slice
10535  *
10536  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
10537  *                                  get_slice_from_memview(dst, &dst_slice)[0],
10538  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10539  */
10540   __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 441, __pyx_L1_error)
10541 
10542   /* "View.MemoryView":437
10543  *         return obj
10544  *
10545  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
10546  *         cdef __Pyx_memviewslice dst_slice
10547  *         cdef __Pyx_memviewslice src_slice
10548  */
10549 
10550   /* function exit code */
10551   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10552   goto __pyx_L0;
10553   __pyx_L1_error:;
10554   __Pyx_XDECREF(__pyx_t_1);
10555   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
10556   __pyx_r = 0;
10557   __pyx_L0:;
10558   __Pyx_XGIVEREF(__pyx_r);
10559   __Pyx_RefNannyFinishContext();
10560   return __pyx_r;
10561 }
10562 
10563 /* "View.MemoryView":445
10564  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10565  *
10566  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
10567  *         cdef int array[128]
10568  *         cdef void *tmp = NULL
10569  */
10570 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)10571 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
10572   int __pyx_v_array[0x80];
10573   void *__pyx_v_tmp;
10574   void *__pyx_v_item;
10575   __Pyx_memviewslice *__pyx_v_dst_slice;
10576   __Pyx_memviewslice __pyx_v_tmp_slice;
10577   PyObject *__pyx_r = NULL;
10578   __Pyx_RefNannyDeclarations
10579   int __pyx_t_1;
10580   PyObject *__pyx_t_2 = NULL;
10581   int __pyx_t_3;
10582   int __pyx_t_4;
10583   char const *__pyx_t_5;
10584   PyObject *__pyx_t_6 = NULL;
10585   PyObject *__pyx_t_7 = NULL;
10586   PyObject *__pyx_t_8 = NULL;
10587   PyObject *__pyx_t_9 = NULL;
10588   PyObject *__pyx_t_10 = NULL;
10589   PyObject *__pyx_t_11 = NULL;
10590   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
10591 
10592   /* "View.MemoryView":447
10593  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
10594  *         cdef int array[128]
10595  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
10596  *         cdef void *item
10597  *
10598  */
10599   __pyx_v_tmp = NULL;
10600 
10601   /* "View.MemoryView":452
10602  *         cdef __Pyx_memviewslice *dst_slice
10603  *         cdef __Pyx_memviewslice tmp_slice
10604  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
10605  *
10606  *         if <size_t>self.view.itemsize > sizeof(array):
10607  */
10608   __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
10609 
10610   /* "View.MemoryView":454
10611  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
10612  *
10613  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
10614  *             tmp = PyMem_Malloc(self.view.itemsize)
10615  *             if tmp == NULL:
10616  */
10617   __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
10618   if (__pyx_t_1) {
10619 
10620     /* "View.MemoryView":455
10621  *
10622  *         if <size_t>self.view.itemsize > sizeof(array):
10623  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
10624  *             if tmp == NULL:
10625  *                 raise MemoryError
10626  */
10627     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
10628 
10629     /* "View.MemoryView":456
10630  *         if <size_t>self.view.itemsize > sizeof(array):
10631  *             tmp = PyMem_Malloc(self.view.itemsize)
10632  *             if tmp == NULL:             # <<<<<<<<<<<<<<
10633  *                 raise MemoryError
10634  *             item = tmp
10635  */
10636     __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
10637     if (unlikely(__pyx_t_1)) {
10638 
10639       /* "View.MemoryView":457
10640  *             tmp = PyMem_Malloc(self.view.itemsize)
10641  *             if tmp == NULL:
10642  *                 raise MemoryError             # <<<<<<<<<<<<<<
10643  *             item = tmp
10644  *         else:
10645  */
10646       PyErr_NoMemory(); __PYX_ERR(1, 457, __pyx_L1_error)
10647 
10648       /* "View.MemoryView":456
10649  *         if <size_t>self.view.itemsize > sizeof(array):
10650  *             tmp = PyMem_Malloc(self.view.itemsize)
10651  *             if tmp == NULL:             # <<<<<<<<<<<<<<
10652  *                 raise MemoryError
10653  *             item = tmp
10654  */
10655     }
10656 
10657     /* "View.MemoryView":458
10658  *             if tmp == NULL:
10659  *                 raise MemoryError
10660  *             item = tmp             # <<<<<<<<<<<<<<
10661  *         else:
10662  *             item = <void *> array
10663  */
10664     __pyx_v_item = __pyx_v_tmp;
10665 
10666     /* "View.MemoryView":454
10667  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
10668  *
10669  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
10670  *             tmp = PyMem_Malloc(self.view.itemsize)
10671  *             if tmp == NULL:
10672  */
10673     goto __pyx_L3;
10674   }
10675 
10676   /* "View.MemoryView":460
10677  *             item = tmp
10678  *         else:
10679  *             item = <void *> array             # <<<<<<<<<<<<<<
10680  *
10681  *         try:
10682  */
10683   /*else*/ {
10684     __pyx_v_item = ((void *)__pyx_v_array);
10685   }
10686   __pyx_L3:;
10687 
10688   /* "View.MemoryView":462
10689  *             item = <void *> array
10690  *
10691  *         try:             # <<<<<<<<<<<<<<
10692  *             if self.dtype_is_object:
10693  *                 (<PyObject **> item)[0] = <PyObject *> value
10694  */
10695   /*try:*/ {
10696 
10697     /* "View.MemoryView":463
10698  *
10699  *         try:
10700  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
10701  *                 (<PyObject **> item)[0] = <PyObject *> value
10702  *             else:
10703  */
10704     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
10705     if (__pyx_t_1) {
10706 
10707       /* "View.MemoryView":464
10708  *         try:
10709  *             if self.dtype_is_object:
10710  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
10711  *             else:
10712  *                 self.assign_item_from_object(<char *> item, value)
10713  */
10714       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
10715 
10716       /* "View.MemoryView":463
10717  *
10718  *         try:
10719  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
10720  *                 (<PyObject **> item)[0] = <PyObject *> value
10721  *             else:
10722  */
10723       goto __pyx_L8;
10724     }
10725 
10726     /* "View.MemoryView":466
10727  *                 (<PyObject **> item)[0] = <PyObject *> value
10728  *             else:
10729  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
10730  *
10731  *
10732  */
10733     /*else*/ {
10734       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 466, __pyx_L6_error)
10735       __Pyx_GOTREF(__pyx_t_2);
10736       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10737     }
10738     __pyx_L8:;
10739 
10740     /* "View.MemoryView":470
10741  *
10742  *
10743  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
10744  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
10745  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
10746  */
10747     __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
10748     if (__pyx_t_1) {
10749 
10750       /* "View.MemoryView":471
10751  *
10752  *             if self.view.suboffsets != NULL:
10753  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
10754  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
10755  *                                 item, self.dtype_is_object)
10756  */
10757       __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 471, __pyx_L6_error)
10758       __Pyx_GOTREF(__pyx_t_2);
10759       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10760 
10761       /* "View.MemoryView":470
10762  *
10763  *
10764  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
10765  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
10766  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
10767  */
10768     }
10769 
10770     /* "View.MemoryView":472
10771  *             if self.view.suboffsets != NULL:
10772  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
10773  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
10774  *                                 item, self.dtype_is_object)
10775  *         finally:
10776  */
10777     __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);
10778   }
10779 
10780   /* "View.MemoryView":475
10781  *                                 item, self.dtype_is_object)
10782  *         finally:
10783  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
10784  *
10785  *     cdef setitem_indexed(self, index, value):
10786  */
10787   /*finally:*/ {
10788     /*normal exit:*/{
10789       PyMem_Free(__pyx_v_tmp);
10790       goto __pyx_L7;
10791     }
10792     __pyx_L6_error:;
10793     /*exception exit:*/{
10794       __Pyx_PyThreadState_declare
10795       __Pyx_PyThreadState_assign
10796       __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
10797       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10798       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
10799       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
10800       __Pyx_XGOTREF(__pyx_t_6);
10801       __Pyx_XGOTREF(__pyx_t_7);
10802       __Pyx_XGOTREF(__pyx_t_8);
10803       __Pyx_XGOTREF(__pyx_t_9);
10804       __Pyx_XGOTREF(__pyx_t_10);
10805       __Pyx_XGOTREF(__pyx_t_11);
10806       __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
10807       {
10808         PyMem_Free(__pyx_v_tmp);
10809       }
10810       if (PY_MAJOR_VERSION >= 3) {
10811         __Pyx_XGIVEREF(__pyx_t_9);
10812         __Pyx_XGIVEREF(__pyx_t_10);
10813         __Pyx_XGIVEREF(__pyx_t_11);
10814         __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
10815       }
10816       __Pyx_XGIVEREF(__pyx_t_6);
10817       __Pyx_XGIVEREF(__pyx_t_7);
10818       __Pyx_XGIVEREF(__pyx_t_8);
10819       __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
10820       __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
10821       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
10822       goto __pyx_L1_error;
10823     }
10824     __pyx_L7:;
10825   }
10826 
10827   /* "View.MemoryView":445
10828  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10829  *
10830  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
10831  *         cdef int array[128]
10832  *         cdef void *tmp = NULL
10833  */
10834 
10835   /* function exit code */
10836   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10837   goto __pyx_L0;
10838   __pyx_L1_error:;
10839   __Pyx_XDECREF(__pyx_t_2);
10840   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
10841   __pyx_r = 0;
10842   __pyx_L0:;
10843   __Pyx_XGIVEREF(__pyx_r);
10844   __Pyx_RefNannyFinishContext();
10845   return __pyx_r;
10846 }
10847 
10848 /* "View.MemoryView":477
10849  *             PyMem_Free(tmp)
10850  *
10851  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
10852  *         cdef char *itemp = self.get_item_pointer(index)
10853  *         self.assign_item_from_object(itemp, value)
10854  */
10855 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)10856 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10857   char *__pyx_v_itemp;
10858   PyObject *__pyx_r = NULL;
10859   __Pyx_RefNannyDeclarations
10860   char *__pyx_t_1;
10861   PyObject *__pyx_t_2 = NULL;
10862   __Pyx_RefNannySetupContext("setitem_indexed", 0);
10863 
10864   /* "View.MemoryView":478
10865  *
10866  *     cdef setitem_indexed(self, index, value):
10867  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
10868  *         self.assign_item_from_object(itemp, value)
10869  *
10870  */
10871   __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(1, 478, __pyx_L1_error)
10872   __pyx_v_itemp = __pyx_t_1;
10873 
10874   /* "View.MemoryView":479
10875  *     cdef setitem_indexed(self, index, value):
10876  *         cdef char *itemp = self.get_item_pointer(index)
10877  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
10878  *
10879  *     cdef convert_item_to_object(self, char *itemp):
10880  */
10881   __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(1, 479, __pyx_L1_error)
10882   __Pyx_GOTREF(__pyx_t_2);
10883   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10884 
10885   /* "View.MemoryView":477
10886  *             PyMem_Free(tmp)
10887  *
10888  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
10889  *         cdef char *itemp = self.get_item_pointer(index)
10890  *         self.assign_item_from_object(itemp, value)
10891  */
10892 
10893   /* function exit code */
10894   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10895   goto __pyx_L0;
10896   __pyx_L1_error:;
10897   __Pyx_XDECREF(__pyx_t_2);
10898   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
10899   __pyx_r = 0;
10900   __pyx_L0:;
10901   __Pyx_XGIVEREF(__pyx_r);
10902   __Pyx_RefNannyFinishContext();
10903   return __pyx_r;
10904 }
10905 
10906 /* "View.MemoryView":481
10907  *         self.assign_item_from_object(itemp, value)
10908  *
10909  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
10910  *         """Only used if instantiated manually by the user, or if Cython doesn't
10911  *         know how to convert the type"""
10912  */
10913 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)10914 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
10915   PyObject *__pyx_v_struct = NULL;
10916   PyObject *__pyx_v_bytesitem = 0;
10917   PyObject *__pyx_v_result = NULL;
10918   PyObject *__pyx_r = NULL;
10919   __Pyx_RefNannyDeclarations
10920   PyObject *__pyx_t_1 = NULL;
10921   PyObject *__pyx_t_2 = NULL;
10922   PyObject *__pyx_t_3 = NULL;
10923   PyObject *__pyx_t_4 = NULL;
10924   PyObject *__pyx_t_5 = NULL;
10925   PyObject *__pyx_t_6 = NULL;
10926   PyObject *__pyx_t_7 = NULL;
10927   int __pyx_t_8;
10928   PyObject *__pyx_t_9 = NULL;
10929   size_t __pyx_t_10;
10930   int __pyx_t_11;
10931   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
10932 
10933   /* "View.MemoryView":484
10934  *         """Only used if instantiated manually by the user, or if Cython doesn't
10935  *         know how to convert the type"""
10936  *         import struct             # <<<<<<<<<<<<<<
10937  *         cdef bytes bytesitem
10938  *
10939  */
10940   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 484, __pyx_L1_error)
10941   __Pyx_GOTREF(__pyx_t_1);
10942   __pyx_v_struct = __pyx_t_1;
10943   __pyx_t_1 = 0;
10944 
10945   /* "View.MemoryView":487
10946  *         cdef bytes bytesitem
10947  *
10948  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
10949  *         try:
10950  *             result = struct.unpack(self.view.format, bytesitem)
10951  */
10952   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 487, __pyx_L1_error)
10953   __Pyx_GOTREF(__pyx_t_1);
10954   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
10955   __pyx_t_1 = 0;
10956 
10957   /* "View.MemoryView":488
10958  *
10959  *         bytesitem = itemp[:self.view.itemsize]
10960  *         try:             # <<<<<<<<<<<<<<
10961  *             result = struct.unpack(self.view.format, bytesitem)
10962  *         except struct.error:
10963  */
10964   {
10965     __Pyx_PyThreadState_declare
10966     __Pyx_PyThreadState_assign
10967     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
10968     __Pyx_XGOTREF(__pyx_t_2);
10969     __Pyx_XGOTREF(__pyx_t_3);
10970     __Pyx_XGOTREF(__pyx_t_4);
10971     /*try:*/ {
10972 
10973       /* "View.MemoryView":489
10974  *         bytesitem = itemp[:self.view.itemsize]
10975  *         try:
10976  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
10977  *         except struct.error:
10978  *             raise ValueError("Unable to convert item to object")
10979  */
10980       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 489, __pyx_L3_error)
10981       __Pyx_GOTREF(__pyx_t_5);
10982       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 489, __pyx_L3_error)
10983       __Pyx_GOTREF(__pyx_t_6);
10984       __pyx_t_7 = NULL;
10985       __pyx_t_8 = 0;
10986       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
10987         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
10988         if (likely(__pyx_t_7)) {
10989           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
10990           __Pyx_INCREF(__pyx_t_7);
10991           __Pyx_INCREF(function);
10992           __Pyx_DECREF_SET(__pyx_t_5, function);
10993           __pyx_t_8 = 1;
10994         }
10995       }
10996       #if CYTHON_FAST_PYCALL
10997       if (PyFunction_Check(__pyx_t_5)) {
10998         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
10999         __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(1, 489, __pyx_L3_error)
11000         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11001         __Pyx_GOTREF(__pyx_t_1);
11002         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11003       } else
11004       #endif
11005       #if CYTHON_FAST_PYCCALL
11006       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
11007         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11008         __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(1, 489, __pyx_L3_error)
11009         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11010         __Pyx_GOTREF(__pyx_t_1);
11011         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11012       } else
11013       #endif
11014       {
11015         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 489, __pyx_L3_error)
11016         __Pyx_GOTREF(__pyx_t_9);
11017         if (__pyx_t_7) {
11018           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
11019         }
11020         __Pyx_GIVEREF(__pyx_t_6);
11021         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
11022         __Pyx_INCREF(__pyx_v_bytesitem);
11023         __Pyx_GIVEREF(__pyx_v_bytesitem);
11024         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
11025         __pyx_t_6 = 0;
11026         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 489, __pyx_L3_error)
11027         __Pyx_GOTREF(__pyx_t_1);
11028         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
11029       }
11030       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11031       __pyx_v_result = __pyx_t_1;
11032       __pyx_t_1 = 0;
11033 
11034       /* "View.MemoryView":488
11035  *
11036  *         bytesitem = itemp[:self.view.itemsize]
11037  *         try:             # <<<<<<<<<<<<<<
11038  *             result = struct.unpack(self.view.format, bytesitem)
11039  *         except struct.error:
11040  */
11041     }
11042 
11043     /* "View.MemoryView":493
11044  *             raise ValueError("Unable to convert item to object")
11045  *         else:
11046  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
11047  *                 return result[0]
11048  *             return result
11049  */
11050     /*else:*/ {
11051       __pyx_t_10 = strlen(__pyx_v_self->view.format);
11052       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
11053       if (__pyx_t_11) {
11054 
11055         /* "View.MemoryView":494
11056  *         else:
11057  *             if len(self.view.format) == 1:
11058  *                 return result[0]             # <<<<<<<<<<<<<<
11059  *             return result
11060  *
11061  */
11062         __Pyx_XDECREF(__pyx_r);
11063         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 494, __pyx_L5_except_error)
11064         __Pyx_GOTREF(__pyx_t_1);
11065         __pyx_r = __pyx_t_1;
11066         __pyx_t_1 = 0;
11067         goto __pyx_L6_except_return;
11068 
11069         /* "View.MemoryView":493
11070  *             raise ValueError("Unable to convert item to object")
11071  *         else:
11072  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
11073  *                 return result[0]
11074  *             return result
11075  */
11076       }
11077 
11078       /* "View.MemoryView":495
11079  *             if len(self.view.format) == 1:
11080  *                 return result[0]
11081  *             return result             # <<<<<<<<<<<<<<
11082  *
11083  *     cdef assign_item_from_object(self, char *itemp, object value):
11084  */
11085       __Pyx_XDECREF(__pyx_r);
11086       __Pyx_INCREF(__pyx_v_result);
11087       __pyx_r = __pyx_v_result;
11088       goto __pyx_L6_except_return;
11089     }
11090     __pyx_L3_error:;
11091     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11092     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11093     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11094     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11095     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
11096 
11097     /* "View.MemoryView":490
11098  *         try:
11099  *             result = struct.unpack(self.view.format, bytesitem)
11100  *         except struct.error:             # <<<<<<<<<<<<<<
11101  *             raise ValueError("Unable to convert item to object")
11102  *         else:
11103  */
11104     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
11105     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 490, __pyx_L5_except_error)
11106     __Pyx_GOTREF(__pyx_t_6);
11107     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
11108     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11109     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
11110     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
11111     if (__pyx_t_8) {
11112       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11113       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 490, __pyx_L5_except_error)
11114       __Pyx_GOTREF(__pyx_t_9);
11115       __Pyx_GOTREF(__pyx_t_5);
11116       __Pyx_GOTREF(__pyx_t_1);
11117 
11118       /* "View.MemoryView":491
11119  *             result = struct.unpack(self.view.format, bytesitem)
11120  *         except struct.error:
11121  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
11122  *         else:
11123  *             if len(self.view.format) == 1:
11124  */
11125       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 491, __pyx_L5_except_error)
11126       __Pyx_GOTREF(__pyx_t_6);
11127       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
11128       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11129       __PYX_ERR(1, 491, __pyx_L5_except_error)
11130     }
11131     goto __pyx_L5_except_error;
11132     __pyx_L5_except_error:;
11133 
11134     /* "View.MemoryView":488
11135  *
11136  *         bytesitem = itemp[:self.view.itemsize]
11137  *         try:             # <<<<<<<<<<<<<<
11138  *             result = struct.unpack(self.view.format, bytesitem)
11139  *         except struct.error:
11140  */
11141     __Pyx_XGIVEREF(__pyx_t_2);
11142     __Pyx_XGIVEREF(__pyx_t_3);
11143     __Pyx_XGIVEREF(__pyx_t_4);
11144     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11145     goto __pyx_L1_error;
11146     __pyx_L6_except_return:;
11147     __Pyx_XGIVEREF(__pyx_t_2);
11148     __Pyx_XGIVEREF(__pyx_t_3);
11149     __Pyx_XGIVEREF(__pyx_t_4);
11150     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11151     goto __pyx_L0;
11152   }
11153 
11154   /* "View.MemoryView":481
11155  *         self.assign_item_from_object(itemp, value)
11156  *
11157  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
11158  *         """Only used if instantiated manually by the user, or if Cython doesn't
11159  *         know how to convert the type"""
11160  */
11161 
11162   /* function exit code */
11163   __pyx_L1_error:;
11164   __Pyx_XDECREF(__pyx_t_1);
11165   __Pyx_XDECREF(__pyx_t_5);
11166   __Pyx_XDECREF(__pyx_t_6);
11167   __Pyx_XDECREF(__pyx_t_7);
11168   __Pyx_XDECREF(__pyx_t_9);
11169   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11170   __pyx_r = 0;
11171   __pyx_L0:;
11172   __Pyx_XDECREF(__pyx_v_struct);
11173   __Pyx_XDECREF(__pyx_v_bytesitem);
11174   __Pyx_XDECREF(__pyx_v_result);
11175   __Pyx_XGIVEREF(__pyx_r);
11176   __Pyx_RefNannyFinishContext();
11177   return __pyx_r;
11178 }
11179 
11180 /* "View.MemoryView":497
11181  *             return result
11182  *
11183  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
11184  *         """Only used if instantiated manually by the user, or if Cython doesn't
11185  *         know how to convert the type"""
11186  */
11187 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)11188 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
11189   PyObject *__pyx_v_struct = NULL;
11190   char __pyx_v_c;
11191   PyObject *__pyx_v_bytesvalue = 0;
11192   Py_ssize_t __pyx_v_i;
11193   PyObject *__pyx_r = NULL;
11194   __Pyx_RefNannyDeclarations
11195   PyObject *__pyx_t_1 = NULL;
11196   int __pyx_t_2;
11197   int __pyx_t_3;
11198   PyObject *__pyx_t_4 = NULL;
11199   PyObject *__pyx_t_5 = NULL;
11200   PyObject *__pyx_t_6 = NULL;
11201   int __pyx_t_7;
11202   PyObject *__pyx_t_8 = NULL;
11203   Py_ssize_t __pyx_t_9;
11204   PyObject *__pyx_t_10 = NULL;
11205   char *__pyx_t_11;
11206   char *__pyx_t_12;
11207   char *__pyx_t_13;
11208   char *__pyx_t_14;
11209   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
11210 
11211   /* "View.MemoryView":500
11212  *         """Only used if instantiated manually by the user, or if Cython doesn't
11213  *         know how to convert the type"""
11214  *         import struct             # <<<<<<<<<<<<<<
11215  *         cdef char c
11216  *         cdef bytes bytesvalue
11217  */
11218   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 500, __pyx_L1_error)
11219   __Pyx_GOTREF(__pyx_t_1);
11220   __pyx_v_struct = __pyx_t_1;
11221   __pyx_t_1 = 0;
11222 
11223   /* "View.MemoryView":505
11224  *         cdef Py_ssize_t i
11225  *
11226  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
11227  *             bytesvalue = struct.pack(self.view.format, *value)
11228  *         else:
11229  */
11230   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
11231   __pyx_t_3 = (__pyx_t_2 != 0);
11232   if (__pyx_t_3) {
11233 
11234     /* "View.MemoryView":506
11235  *
11236  *         if isinstance(value, tuple):
11237  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
11238  *         else:
11239  *             bytesvalue = struct.pack(self.view.format, value)
11240  */
11241     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 506, __pyx_L1_error)
11242     __Pyx_GOTREF(__pyx_t_1);
11243     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 506, __pyx_L1_error)
11244     __Pyx_GOTREF(__pyx_t_4);
11245     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 506, __pyx_L1_error)
11246     __Pyx_GOTREF(__pyx_t_5);
11247     __Pyx_GIVEREF(__pyx_t_4);
11248     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
11249     __pyx_t_4 = 0;
11250     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 506, __pyx_L1_error)
11251     __Pyx_GOTREF(__pyx_t_4);
11252     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 506, __pyx_L1_error)
11253     __Pyx_GOTREF(__pyx_t_6);
11254     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11255     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11256     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 506, __pyx_L1_error)
11257     __Pyx_GOTREF(__pyx_t_4);
11258     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11259     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11260     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(1, 506, __pyx_L1_error)
11261     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11262     __pyx_t_4 = 0;
11263 
11264     /* "View.MemoryView":505
11265  *         cdef Py_ssize_t i
11266  *
11267  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
11268  *             bytesvalue = struct.pack(self.view.format, *value)
11269  *         else:
11270  */
11271     goto __pyx_L3;
11272   }
11273 
11274   /* "View.MemoryView":508
11275  *             bytesvalue = struct.pack(self.view.format, *value)
11276  *         else:
11277  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
11278  *
11279  *         for i, c in enumerate(bytesvalue):
11280  */
11281   /*else*/ {
11282     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 508, __pyx_L1_error)
11283     __Pyx_GOTREF(__pyx_t_6);
11284     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error)
11285     __Pyx_GOTREF(__pyx_t_1);
11286     __pyx_t_5 = NULL;
11287     __pyx_t_7 = 0;
11288     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
11289       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
11290       if (likely(__pyx_t_5)) {
11291         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
11292         __Pyx_INCREF(__pyx_t_5);
11293         __Pyx_INCREF(function);
11294         __Pyx_DECREF_SET(__pyx_t_6, function);
11295         __pyx_t_7 = 1;
11296       }
11297     }
11298     #if CYTHON_FAST_PYCALL
11299     if (PyFunction_Check(__pyx_t_6)) {
11300       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11301       __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(1, 508, __pyx_L1_error)
11302       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11303       __Pyx_GOTREF(__pyx_t_4);
11304       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11305     } else
11306     #endif
11307     #if CYTHON_FAST_PYCCALL
11308     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
11309       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11310       __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(1, 508, __pyx_L1_error)
11311       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11312       __Pyx_GOTREF(__pyx_t_4);
11313       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11314     } else
11315     #endif
11316     {
11317       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 508, __pyx_L1_error)
11318       __Pyx_GOTREF(__pyx_t_8);
11319       if (__pyx_t_5) {
11320         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
11321       }
11322       __Pyx_GIVEREF(__pyx_t_1);
11323       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
11324       __Pyx_INCREF(__pyx_v_value);
11325       __Pyx_GIVEREF(__pyx_v_value);
11326       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
11327       __pyx_t_1 = 0;
11328       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 508, __pyx_L1_error)
11329       __Pyx_GOTREF(__pyx_t_4);
11330       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11331     }
11332     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11333     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(1, 508, __pyx_L1_error)
11334     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11335     __pyx_t_4 = 0;
11336   }
11337   __pyx_L3:;
11338 
11339   /* "View.MemoryView":510
11340  *             bytesvalue = struct.pack(self.view.format, value)
11341  *
11342  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
11343  *             itemp[i] = c
11344  *
11345  */
11346   __pyx_t_9 = 0;
11347   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
11348     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
11349     __PYX_ERR(1, 510, __pyx_L1_error)
11350   }
11351   __Pyx_INCREF(__pyx_v_bytesvalue);
11352   __pyx_t_10 = __pyx_v_bytesvalue;
11353   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
11354   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
11355   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
11356     __pyx_t_11 = __pyx_t_14;
11357     __pyx_v_c = (__pyx_t_11[0]);
11358 
11359     /* "View.MemoryView":511
11360  *
11361  *         for i, c in enumerate(bytesvalue):
11362  *             itemp[i] = c             # <<<<<<<<<<<<<<
11363  *
11364  *     @cname('getbuffer')
11365  */
11366     __pyx_v_i = __pyx_t_9;
11367 
11368     /* "View.MemoryView":510
11369  *             bytesvalue = struct.pack(self.view.format, value)
11370  *
11371  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
11372  *             itemp[i] = c
11373  *
11374  */
11375     __pyx_t_9 = (__pyx_t_9 + 1);
11376 
11377     /* "View.MemoryView":511
11378  *
11379  *         for i, c in enumerate(bytesvalue):
11380  *             itemp[i] = c             # <<<<<<<<<<<<<<
11381  *
11382  *     @cname('getbuffer')
11383  */
11384     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
11385   }
11386   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11387 
11388   /* "View.MemoryView":497
11389  *             return result
11390  *
11391  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
11392  *         """Only used if instantiated manually by the user, or if Cython doesn't
11393  *         know how to convert the type"""
11394  */
11395 
11396   /* function exit code */
11397   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11398   goto __pyx_L0;
11399   __pyx_L1_error:;
11400   __Pyx_XDECREF(__pyx_t_1);
11401   __Pyx_XDECREF(__pyx_t_4);
11402   __Pyx_XDECREF(__pyx_t_5);
11403   __Pyx_XDECREF(__pyx_t_6);
11404   __Pyx_XDECREF(__pyx_t_8);
11405   __Pyx_XDECREF(__pyx_t_10);
11406   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11407   __pyx_r = 0;
11408   __pyx_L0:;
11409   __Pyx_XDECREF(__pyx_v_struct);
11410   __Pyx_XDECREF(__pyx_v_bytesvalue);
11411   __Pyx_XGIVEREF(__pyx_r);
11412   __Pyx_RefNannyFinishContext();
11413   return __pyx_r;
11414 }
11415 
11416 /* "View.MemoryView":514
11417  *
11418  *     @cname('getbuffer')
11419  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
11420  *         if flags & PyBUF_WRITABLE and self.view.readonly:
11421  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11422  */
11423 
11424 /* Python wrapper */
11425 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_memoryview_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)11426 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
11427   int __pyx_r;
11428   __Pyx_RefNannyDeclarations
11429   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
11430   __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));
11431 
11432   /* function exit code */
11433   __Pyx_RefNannyFinishContext();
11434   return __pyx_r;
11435 }
11436 
__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)11437 static 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) {
11438   int __pyx_r;
11439   __Pyx_RefNannyDeclarations
11440   int __pyx_t_1;
11441   int __pyx_t_2;
11442   PyObject *__pyx_t_3 = NULL;
11443   Py_ssize_t *__pyx_t_4;
11444   char *__pyx_t_5;
11445   void *__pyx_t_6;
11446   int __pyx_t_7;
11447   Py_ssize_t __pyx_t_8;
11448   if (__pyx_v_info == NULL) {
11449     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
11450     return -1;
11451   }
11452   __Pyx_RefNannySetupContext("__getbuffer__", 0);
11453   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
11454   __Pyx_GIVEREF(__pyx_v_info->obj);
11455 
11456   /* "View.MemoryView":515
11457  *     @cname('getbuffer')
11458  *     def __getbuffer__(self, Py_buffer *info, int flags):
11459  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
11460  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11461  *
11462  */
11463   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
11464   if (__pyx_t_2) {
11465   } else {
11466     __pyx_t_1 = __pyx_t_2;
11467     goto __pyx_L4_bool_binop_done;
11468   }
11469   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
11470   __pyx_t_1 = __pyx_t_2;
11471   __pyx_L4_bool_binop_done:;
11472   if (unlikely(__pyx_t_1)) {
11473 
11474     /* "View.MemoryView":516
11475  *     def __getbuffer__(self, Py_buffer *info, int flags):
11476  *         if flags & PyBUF_WRITABLE and self.view.readonly:
11477  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
11478  *
11479  *         if flags & PyBUF_ND:
11480  */
11481     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error)
11482     __Pyx_GOTREF(__pyx_t_3);
11483     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
11484     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11485     __PYX_ERR(1, 516, __pyx_L1_error)
11486 
11487     /* "View.MemoryView":515
11488  *     @cname('getbuffer')
11489  *     def __getbuffer__(self, Py_buffer *info, int flags):
11490  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
11491  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11492  *
11493  */
11494   }
11495 
11496   /* "View.MemoryView":518
11497  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11498  *
11499  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
11500  *             info.shape = self.view.shape
11501  *         else:
11502  */
11503   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
11504   if (__pyx_t_1) {
11505 
11506     /* "View.MemoryView":519
11507  *
11508  *         if flags & PyBUF_ND:
11509  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
11510  *         else:
11511  *             info.shape = NULL
11512  */
11513     __pyx_t_4 = __pyx_v_self->view.shape;
11514     __pyx_v_info->shape = __pyx_t_4;
11515 
11516     /* "View.MemoryView":518
11517  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11518  *
11519  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
11520  *             info.shape = self.view.shape
11521  *         else:
11522  */
11523     goto __pyx_L6;
11524   }
11525 
11526   /* "View.MemoryView":521
11527  *             info.shape = self.view.shape
11528  *         else:
11529  *             info.shape = NULL             # <<<<<<<<<<<<<<
11530  *
11531  *         if flags & PyBUF_STRIDES:
11532  */
11533   /*else*/ {
11534     __pyx_v_info->shape = NULL;
11535   }
11536   __pyx_L6:;
11537 
11538   /* "View.MemoryView":523
11539  *             info.shape = NULL
11540  *
11541  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
11542  *             info.strides = self.view.strides
11543  *         else:
11544  */
11545   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
11546   if (__pyx_t_1) {
11547 
11548     /* "View.MemoryView":524
11549  *
11550  *         if flags & PyBUF_STRIDES:
11551  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
11552  *         else:
11553  *             info.strides = NULL
11554  */
11555     __pyx_t_4 = __pyx_v_self->view.strides;
11556     __pyx_v_info->strides = __pyx_t_4;
11557 
11558     /* "View.MemoryView":523
11559  *             info.shape = NULL
11560  *
11561  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
11562  *             info.strides = self.view.strides
11563  *         else:
11564  */
11565     goto __pyx_L7;
11566   }
11567 
11568   /* "View.MemoryView":526
11569  *             info.strides = self.view.strides
11570  *         else:
11571  *             info.strides = NULL             # <<<<<<<<<<<<<<
11572  *
11573  *         if flags & PyBUF_INDIRECT:
11574  */
11575   /*else*/ {
11576     __pyx_v_info->strides = NULL;
11577   }
11578   __pyx_L7:;
11579 
11580   /* "View.MemoryView":528
11581  *             info.strides = NULL
11582  *
11583  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
11584  *             info.suboffsets = self.view.suboffsets
11585  *         else:
11586  */
11587   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
11588   if (__pyx_t_1) {
11589 
11590     /* "View.MemoryView":529
11591  *
11592  *         if flags & PyBUF_INDIRECT:
11593  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
11594  *         else:
11595  *             info.suboffsets = NULL
11596  */
11597     __pyx_t_4 = __pyx_v_self->view.suboffsets;
11598     __pyx_v_info->suboffsets = __pyx_t_4;
11599 
11600     /* "View.MemoryView":528
11601  *             info.strides = NULL
11602  *
11603  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
11604  *             info.suboffsets = self.view.suboffsets
11605  *         else:
11606  */
11607     goto __pyx_L8;
11608   }
11609 
11610   /* "View.MemoryView":531
11611  *             info.suboffsets = self.view.suboffsets
11612  *         else:
11613  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
11614  *
11615  *         if flags & PyBUF_FORMAT:
11616  */
11617   /*else*/ {
11618     __pyx_v_info->suboffsets = NULL;
11619   }
11620   __pyx_L8:;
11621 
11622   /* "View.MemoryView":533
11623  *             info.suboffsets = NULL
11624  *
11625  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
11626  *             info.format = self.view.format
11627  *         else:
11628  */
11629   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
11630   if (__pyx_t_1) {
11631 
11632     /* "View.MemoryView":534
11633  *
11634  *         if flags & PyBUF_FORMAT:
11635  *             info.format = self.view.format             # <<<<<<<<<<<<<<
11636  *         else:
11637  *             info.format = NULL
11638  */
11639     __pyx_t_5 = __pyx_v_self->view.format;
11640     __pyx_v_info->format = __pyx_t_5;
11641 
11642     /* "View.MemoryView":533
11643  *             info.suboffsets = NULL
11644  *
11645  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
11646  *             info.format = self.view.format
11647  *         else:
11648  */
11649     goto __pyx_L9;
11650   }
11651 
11652   /* "View.MemoryView":536
11653  *             info.format = self.view.format
11654  *         else:
11655  *             info.format = NULL             # <<<<<<<<<<<<<<
11656  *
11657  *         info.buf = self.view.buf
11658  */
11659   /*else*/ {
11660     __pyx_v_info->format = NULL;
11661   }
11662   __pyx_L9:;
11663 
11664   /* "View.MemoryView":538
11665  *             info.format = NULL
11666  *
11667  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
11668  *         info.ndim = self.view.ndim
11669  *         info.itemsize = self.view.itemsize
11670  */
11671   __pyx_t_6 = __pyx_v_self->view.buf;
11672   __pyx_v_info->buf = __pyx_t_6;
11673 
11674   /* "View.MemoryView":539
11675  *
11676  *         info.buf = self.view.buf
11677  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
11678  *         info.itemsize = self.view.itemsize
11679  *         info.len = self.view.len
11680  */
11681   __pyx_t_7 = __pyx_v_self->view.ndim;
11682   __pyx_v_info->ndim = __pyx_t_7;
11683 
11684   /* "View.MemoryView":540
11685  *         info.buf = self.view.buf
11686  *         info.ndim = self.view.ndim
11687  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
11688  *         info.len = self.view.len
11689  *         info.readonly = self.view.readonly
11690  */
11691   __pyx_t_8 = __pyx_v_self->view.itemsize;
11692   __pyx_v_info->itemsize = __pyx_t_8;
11693 
11694   /* "View.MemoryView":541
11695  *         info.ndim = self.view.ndim
11696  *         info.itemsize = self.view.itemsize
11697  *         info.len = self.view.len             # <<<<<<<<<<<<<<
11698  *         info.readonly = self.view.readonly
11699  *         info.obj = self
11700  */
11701   __pyx_t_8 = __pyx_v_self->view.len;
11702   __pyx_v_info->len = __pyx_t_8;
11703 
11704   /* "View.MemoryView":542
11705  *         info.itemsize = self.view.itemsize
11706  *         info.len = self.view.len
11707  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
11708  *         info.obj = self
11709  *
11710  */
11711   __pyx_t_1 = __pyx_v_self->view.readonly;
11712   __pyx_v_info->readonly = __pyx_t_1;
11713 
11714   /* "View.MemoryView":543
11715  *         info.len = self.view.len
11716  *         info.readonly = self.view.readonly
11717  *         info.obj = self             # <<<<<<<<<<<<<<
11718  *
11719  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
11720  */
11721   __Pyx_INCREF(((PyObject *)__pyx_v_self));
11722   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11723   __Pyx_GOTREF(__pyx_v_info->obj);
11724   __Pyx_DECREF(__pyx_v_info->obj);
11725   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
11726 
11727   /* "View.MemoryView":514
11728  *
11729  *     @cname('getbuffer')
11730  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
11731  *         if flags & PyBUF_WRITABLE and self.view.readonly:
11732  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11733  */
11734 
11735   /* function exit code */
11736   __pyx_r = 0;
11737   goto __pyx_L0;
11738   __pyx_L1_error:;
11739   __Pyx_XDECREF(__pyx_t_3);
11740   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11741   __pyx_r = -1;
11742   if (__pyx_v_info->obj != NULL) {
11743     __Pyx_GOTREF(__pyx_v_info->obj);
11744     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11745   }
11746   goto __pyx_L2;
11747   __pyx_L0:;
11748   if (__pyx_v_info->obj == Py_None) {
11749     __Pyx_GOTREF(__pyx_v_info->obj);
11750     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11751   }
11752   __pyx_L2:;
11753   __Pyx_RefNannyFinishContext();
11754   return __pyx_r;
11755 }
11756 
11757 /* "View.MemoryView":549
11758  *
11759  *     @property
11760  *     def T(self):             # <<<<<<<<<<<<<<
11761  *         cdef _memoryviewslice result = memoryview_copy(self)
11762  *         transpose_memslice(&result.from_slice)
11763  */
11764 
11765 /* Python wrapper */
11766 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject * __pyx_v_self)11767 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
11768   PyObject *__pyx_r = 0;
11769   __Pyx_RefNannyDeclarations
11770   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11771   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11772 
11773   /* function exit code */
11774   __Pyx_RefNannyFinishContext();
11775   return __pyx_r;
11776 }
11777 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)11778 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11779   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
11780   PyObject *__pyx_r = NULL;
11781   __Pyx_RefNannyDeclarations
11782   PyObject *__pyx_t_1 = NULL;
11783   int __pyx_t_2;
11784   __Pyx_RefNannySetupContext("__get__", 0);
11785 
11786   /* "View.MemoryView":550
11787  *     @property
11788  *     def T(self):
11789  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
11790  *         transpose_memslice(&result.from_slice)
11791  *         return result
11792  */
11793   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 550, __pyx_L1_error)
11794   __Pyx_GOTREF(__pyx_t_1);
11795   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 550, __pyx_L1_error)
11796   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
11797   __pyx_t_1 = 0;
11798 
11799   /* "View.MemoryView":551
11800  *     def T(self):
11801  *         cdef _memoryviewslice result = memoryview_copy(self)
11802  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
11803  *         return result
11804  *
11805  */
11806   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 551, __pyx_L1_error)
11807 
11808   /* "View.MemoryView":552
11809  *         cdef _memoryviewslice result = memoryview_copy(self)
11810  *         transpose_memslice(&result.from_slice)
11811  *         return result             # <<<<<<<<<<<<<<
11812  *
11813  *     @property
11814  */
11815   __Pyx_XDECREF(__pyx_r);
11816   __Pyx_INCREF(((PyObject *)__pyx_v_result));
11817   __pyx_r = ((PyObject *)__pyx_v_result);
11818   goto __pyx_L0;
11819 
11820   /* "View.MemoryView":549
11821  *
11822  *     @property
11823  *     def T(self):             # <<<<<<<<<<<<<<
11824  *         cdef _memoryviewslice result = memoryview_copy(self)
11825  *         transpose_memslice(&result.from_slice)
11826  */
11827 
11828   /* function exit code */
11829   __pyx_L1_error:;
11830   __Pyx_XDECREF(__pyx_t_1);
11831   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11832   __pyx_r = NULL;
11833   __pyx_L0:;
11834   __Pyx_XDECREF((PyObject *)__pyx_v_result);
11835   __Pyx_XGIVEREF(__pyx_r);
11836   __Pyx_RefNannyFinishContext();
11837   return __pyx_r;
11838 }
11839 
11840 /* "View.MemoryView":555
11841  *
11842  *     @property
11843  *     def base(self):             # <<<<<<<<<<<<<<
11844  *         return self.obj
11845  *
11846  */
11847 
11848 /* Python wrapper */
11849 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject * __pyx_v_self)11850 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
11851   PyObject *__pyx_r = 0;
11852   __Pyx_RefNannyDeclarations
11853   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11854   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11855 
11856   /* function exit code */
11857   __Pyx_RefNannyFinishContext();
11858   return __pyx_r;
11859 }
11860 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)11861 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11862   PyObject *__pyx_r = NULL;
11863   __Pyx_RefNannyDeclarations
11864   __Pyx_RefNannySetupContext("__get__", 0);
11865 
11866   /* "View.MemoryView":556
11867  *     @property
11868  *     def base(self):
11869  *         return self.obj             # <<<<<<<<<<<<<<
11870  *
11871  *     @property
11872  */
11873   __Pyx_XDECREF(__pyx_r);
11874   __Pyx_INCREF(__pyx_v_self->obj);
11875   __pyx_r = __pyx_v_self->obj;
11876   goto __pyx_L0;
11877 
11878   /* "View.MemoryView":555
11879  *
11880  *     @property
11881  *     def base(self):             # <<<<<<<<<<<<<<
11882  *         return self.obj
11883  *
11884  */
11885 
11886   /* function exit code */
11887   __pyx_L0:;
11888   __Pyx_XGIVEREF(__pyx_r);
11889   __Pyx_RefNannyFinishContext();
11890   return __pyx_r;
11891 }
11892 
11893 /* "View.MemoryView":559
11894  *
11895  *     @property
11896  *     def shape(self):             # <<<<<<<<<<<<<<
11897  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
11898  *
11899  */
11900 
11901 /* Python wrapper */
11902 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject * __pyx_v_self)11903 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
11904   PyObject *__pyx_r = 0;
11905   __Pyx_RefNannyDeclarations
11906   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11907   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11908 
11909   /* function exit code */
11910   __Pyx_RefNannyFinishContext();
11911   return __pyx_r;
11912 }
11913 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)11914 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11915   Py_ssize_t __pyx_v_length;
11916   PyObject *__pyx_r = NULL;
11917   __Pyx_RefNannyDeclarations
11918   PyObject *__pyx_t_1 = NULL;
11919   Py_ssize_t *__pyx_t_2;
11920   Py_ssize_t *__pyx_t_3;
11921   Py_ssize_t *__pyx_t_4;
11922   PyObject *__pyx_t_5 = NULL;
11923   __Pyx_RefNannySetupContext("__get__", 0);
11924 
11925   /* "View.MemoryView":560
11926  *     @property
11927  *     def shape(self):
11928  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
11929  *
11930  *     @property
11931  */
11932   __Pyx_XDECREF(__pyx_r);
11933   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 560, __pyx_L1_error)
11934   __Pyx_GOTREF(__pyx_t_1);
11935   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
11936   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
11937     __pyx_t_2 = __pyx_t_4;
11938     __pyx_v_length = (__pyx_t_2[0]);
11939     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 560, __pyx_L1_error)
11940     __Pyx_GOTREF(__pyx_t_5);
11941     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 560, __pyx_L1_error)
11942     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11943   }
11944   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 560, __pyx_L1_error)
11945   __Pyx_GOTREF(__pyx_t_5);
11946   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11947   __pyx_r = __pyx_t_5;
11948   __pyx_t_5 = 0;
11949   goto __pyx_L0;
11950 
11951   /* "View.MemoryView":559
11952  *
11953  *     @property
11954  *     def shape(self):             # <<<<<<<<<<<<<<
11955  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
11956  *
11957  */
11958 
11959   /* function exit code */
11960   __pyx_L1_error:;
11961   __Pyx_XDECREF(__pyx_t_1);
11962   __Pyx_XDECREF(__pyx_t_5);
11963   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11964   __pyx_r = NULL;
11965   __pyx_L0:;
11966   __Pyx_XGIVEREF(__pyx_r);
11967   __Pyx_RefNannyFinishContext();
11968   return __pyx_r;
11969 }
11970 
11971 /* "View.MemoryView":563
11972  *
11973  *     @property
11974  *     def strides(self):             # <<<<<<<<<<<<<<
11975  *         if self.view.strides == NULL:
11976  *
11977  */
11978 
11979 /* Python wrapper */
11980 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject * __pyx_v_self)11981 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
11982   PyObject *__pyx_r = 0;
11983   __Pyx_RefNannyDeclarations
11984   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11985   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11986 
11987   /* function exit code */
11988   __Pyx_RefNannyFinishContext();
11989   return __pyx_r;
11990 }
11991 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)11992 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
11993   Py_ssize_t __pyx_v_stride;
11994   PyObject *__pyx_r = NULL;
11995   __Pyx_RefNannyDeclarations
11996   int __pyx_t_1;
11997   PyObject *__pyx_t_2 = NULL;
11998   Py_ssize_t *__pyx_t_3;
11999   Py_ssize_t *__pyx_t_4;
12000   Py_ssize_t *__pyx_t_5;
12001   PyObject *__pyx_t_6 = NULL;
12002   __Pyx_RefNannySetupContext("__get__", 0);
12003 
12004   /* "View.MemoryView":564
12005  *     @property
12006  *     def strides(self):
12007  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
12008  *
12009  *             raise ValueError("Buffer view does not expose strides")
12010  */
12011   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
12012   if (unlikely(__pyx_t_1)) {
12013 
12014     /* "View.MemoryView":566
12015  *         if self.view.strides == NULL:
12016  *
12017  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
12018  *
12019  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
12020  */
12021     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 566, __pyx_L1_error)
12022     __Pyx_GOTREF(__pyx_t_2);
12023     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12024     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12025     __PYX_ERR(1, 566, __pyx_L1_error)
12026 
12027     /* "View.MemoryView":564
12028  *     @property
12029  *     def strides(self):
12030  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
12031  *
12032  *             raise ValueError("Buffer view does not expose strides")
12033  */
12034   }
12035 
12036   /* "View.MemoryView":568
12037  *             raise ValueError("Buffer view does not expose strides")
12038  *
12039  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
12040  *
12041  *     @property
12042  */
12043   __Pyx_XDECREF(__pyx_r);
12044   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 568, __pyx_L1_error)
12045   __Pyx_GOTREF(__pyx_t_2);
12046   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
12047   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12048     __pyx_t_3 = __pyx_t_5;
12049     __pyx_v_stride = (__pyx_t_3[0]);
12050     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 568, __pyx_L1_error)
12051     __Pyx_GOTREF(__pyx_t_6);
12052     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 568, __pyx_L1_error)
12053     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12054   }
12055   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 568, __pyx_L1_error)
12056   __Pyx_GOTREF(__pyx_t_6);
12057   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12058   __pyx_r = __pyx_t_6;
12059   __pyx_t_6 = 0;
12060   goto __pyx_L0;
12061 
12062   /* "View.MemoryView":563
12063  *
12064  *     @property
12065  *     def strides(self):             # <<<<<<<<<<<<<<
12066  *         if self.view.strides == NULL:
12067  *
12068  */
12069 
12070   /* function exit code */
12071   __pyx_L1_error:;
12072   __Pyx_XDECREF(__pyx_t_2);
12073   __Pyx_XDECREF(__pyx_t_6);
12074   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12075   __pyx_r = NULL;
12076   __pyx_L0:;
12077   __Pyx_XGIVEREF(__pyx_r);
12078   __Pyx_RefNannyFinishContext();
12079   return __pyx_r;
12080 }
12081 
12082 /* "View.MemoryView":571
12083  *
12084  *     @property
12085  *     def suboffsets(self):             # <<<<<<<<<<<<<<
12086  *         if self.view.suboffsets == NULL:
12087  *             return (-1,) * self.view.ndim
12088  */
12089 
12090 /* Python wrapper */
12091 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject * __pyx_v_self)12092 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
12093   PyObject *__pyx_r = 0;
12094   __Pyx_RefNannyDeclarations
12095   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12096   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12097 
12098   /* function exit code */
12099   __Pyx_RefNannyFinishContext();
12100   return __pyx_r;
12101 }
12102 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)12103 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12104   Py_ssize_t __pyx_v_suboffset;
12105   PyObject *__pyx_r = NULL;
12106   __Pyx_RefNannyDeclarations
12107   int __pyx_t_1;
12108   PyObject *__pyx_t_2 = NULL;
12109   PyObject *__pyx_t_3 = NULL;
12110   Py_ssize_t *__pyx_t_4;
12111   Py_ssize_t *__pyx_t_5;
12112   Py_ssize_t *__pyx_t_6;
12113   __Pyx_RefNannySetupContext("__get__", 0);
12114 
12115   /* "View.MemoryView":572
12116  *     @property
12117  *     def suboffsets(self):
12118  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
12119  *             return (-1,) * self.view.ndim
12120  *
12121  */
12122   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
12123   if (__pyx_t_1) {
12124 
12125     /* "View.MemoryView":573
12126  *     def suboffsets(self):
12127  *         if self.view.suboffsets == NULL:
12128  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
12129  *
12130  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
12131  */
12132     __Pyx_XDECREF(__pyx_r);
12133     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 573, __pyx_L1_error)
12134     __Pyx_GOTREF(__pyx_t_2);
12135     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__23, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 573, __pyx_L1_error)
12136     __Pyx_GOTREF(__pyx_t_3);
12137     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12138     __pyx_r = __pyx_t_3;
12139     __pyx_t_3 = 0;
12140     goto __pyx_L0;
12141 
12142     /* "View.MemoryView":572
12143  *     @property
12144  *     def suboffsets(self):
12145  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
12146  *             return (-1,) * self.view.ndim
12147  *
12148  */
12149   }
12150 
12151   /* "View.MemoryView":575
12152  *             return (-1,) * self.view.ndim
12153  *
12154  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
12155  *
12156  *     @property
12157  */
12158   __Pyx_XDECREF(__pyx_r);
12159   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 575, __pyx_L1_error)
12160   __Pyx_GOTREF(__pyx_t_3);
12161   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
12162   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
12163     __pyx_t_4 = __pyx_t_6;
12164     __pyx_v_suboffset = (__pyx_t_4[0]);
12165     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 575, __pyx_L1_error)
12166     __Pyx_GOTREF(__pyx_t_2);
12167     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 575, __pyx_L1_error)
12168     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12169   }
12170   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 575, __pyx_L1_error)
12171   __Pyx_GOTREF(__pyx_t_2);
12172   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12173   __pyx_r = __pyx_t_2;
12174   __pyx_t_2 = 0;
12175   goto __pyx_L0;
12176 
12177   /* "View.MemoryView":571
12178  *
12179  *     @property
12180  *     def suboffsets(self):             # <<<<<<<<<<<<<<
12181  *         if self.view.suboffsets == NULL:
12182  *             return (-1,) * self.view.ndim
12183  */
12184 
12185   /* function exit code */
12186   __pyx_L1_error:;
12187   __Pyx_XDECREF(__pyx_t_2);
12188   __Pyx_XDECREF(__pyx_t_3);
12189   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12190   __pyx_r = NULL;
12191   __pyx_L0:;
12192   __Pyx_XGIVEREF(__pyx_r);
12193   __Pyx_RefNannyFinishContext();
12194   return __pyx_r;
12195 }
12196 
12197 /* "View.MemoryView":578
12198  *
12199  *     @property
12200  *     def ndim(self):             # <<<<<<<<<<<<<<
12201  *         return self.view.ndim
12202  *
12203  */
12204 
12205 /* Python wrapper */
12206 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject * __pyx_v_self)12207 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
12208   PyObject *__pyx_r = 0;
12209   __Pyx_RefNannyDeclarations
12210   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12211   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12212 
12213   /* function exit code */
12214   __Pyx_RefNannyFinishContext();
12215   return __pyx_r;
12216 }
12217 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)12218 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12219   PyObject *__pyx_r = NULL;
12220   __Pyx_RefNannyDeclarations
12221   PyObject *__pyx_t_1 = NULL;
12222   __Pyx_RefNannySetupContext("__get__", 0);
12223 
12224   /* "View.MemoryView":579
12225  *     @property
12226  *     def ndim(self):
12227  *         return self.view.ndim             # <<<<<<<<<<<<<<
12228  *
12229  *     @property
12230  */
12231   __Pyx_XDECREF(__pyx_r);
12232   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 579, __pyx_L1_error)
12233   __Pyx_GOTREF(__pyx_t_1);
12234   __pyx_r = __pyx_t_1;
12235   __pyx_t_1 = 0;
12236   goto __pyx_L0;
12237 
12238   /* "View.MemoryView":578
12239  *
12240  *     @property
12241  *     def ndim(self):             # <<<<<<<<<<<<<<
12242  *         return self.view.ndim
12243  *
12244  */
12245 
12246   /* function exit code */
12247   __pyx_L1_error:;
12248   __Pyx_XDECREF(__pyx_t_1);
12249   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12250   __pyx_r = NULL;
12251   __pyx_L0:;
12252   __Pyx_XGIVEREF(__pyx_r);
12253   __Pyx_RefNannyFinishContext();
12254   return __pyx_r;
12255 }
12256 
12257 /* "View.MemoryView":582
12258  *
12259  *     @property
12260  *     def itemsize(self):             # <<<<<<<<<<<<<<
12261  *         return self.view.itemsize
12262  *
12263  */
12264 
12265 /* Python wrapper */
12266 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject * __pyx_v_self)12267 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
12268   PyObject *__pyx_r = 0;
12269   __Pyx_RefNannyDeclarations
12270   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12271   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12272 
12273   /* function exit code */
12274   __Pyx_RefNannyFinishContext();
12275   return __pyx_r;
12276 }
12277 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)12278 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12279   PyObject *__pyx_r = NULL;
12280   __Pyx_RefNannyDeclarations
12281   PyObject *__pyx_t_1 = NULL;
12282   __Pyx_RefNannySetupContext("__get__", 0);
12283 
12284   /* "View.MemoryView":583
12285  *     @property
12286  *     def itemsize(self):
12287  *         return self.view.itemsize             # <<<<<<<<<<<<<<
12288  *
12289  *     @property
12290  */
12291   __Pyx_XDECREF(__pyx_r);
12292   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
12293   __Pyx_GOTREF(__pyx_t_1);
12294   __pyx_r = __pyx_t_1;
12295   __pyx_t_1 = 0;
12296   goto __pyx_L0;
12297 
12298   /* "View.MemoryView":582
12299  *
12300  *     @property
12301  *     def itemsize(self):             # <<<<<<<<<<<<<<
12302  *         return self.view.itemsize
12303  *
12304  */
12305 
12306   /* function exit code */
12307   __pyx_L1_error:;
12308   __Pyx_XDECREF(__pyx_t_1);
12309   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12310   __pyx_r = NULL;
12311   __pyx_L0:;
12312   __Pyx_XGIVEREF(__pyx_r);
12313   __Pyx_RefNannyFinishContext();
12314   return __pyx_r;
12315 }
12316 
12317 /* "View.MemoryView":586
12318  *
12319  *     @property
12320  *     def nbytes(self):             # <<<<<<<<<<<<<<
12321  *         return self.size * self.view.itemsize
12322  *
12323  */
12324 
12325 /* Python wrapper */
12326 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject * __pyx_v_self)12327 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
12328   PyObject *__pyx_r = 0;
12329   __Pyx_RefNannyDeclarations
12330   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12331   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12332 
12333   /* function exit code */
12334   __Pyx_RefNannyFinishContext();
12335   return __pyx_r;
12336 }
12337 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)12338 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12339   PyObject *__pyx_r = NULL;
12340   __Pyx_RefNannyDeclarations
12341   PyObject *__pyx_t_1 = NULL;
12342   PyObject *__pyx_t_2 = NULL;
12343   PyObject *__pyx_t_3 = NULL;
12344   __Pyx_RefNannySetupContext("__get__", 0);
12345 
12346   /* "View.MemoryView":587
12347  *     @property
12348  *     def nbytes(self):
12349  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
12350  *
12351  *     @property
12352  */
12353   __Pyx_XDECREF(__pyx_r);
12354   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
12355   __Pyx_GOTREF(__pyx_t_1);
12356   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 587, __pyx_L1_error)
12357   __Pyx_GOTREF(__pyx_t_2);
12358   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 587, __pyx_L1_error)
12359   __Pyx_GOTREF(__pyx_t_3);
12360   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12361   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12362   __pyx_r = __pyx_t_3;
12363   __pyx_t_3 = 0;
12364   goto __pyx_L0;
12365 
12366   /* "View.MemoryView":586
12367  *
12368  *     @property
12369  *     def nbytes(self):             # <<<<<<<<<<<<<<
12370  *         return self.size * self.view.itemsize
12371  *
12372  */
12373 
12374   /* function exit code */
12375   __pyx_L1_error:;
12376   __Pyx_XDECREF(__pyx_t_1);
12377   __Pyx_XDECREF(__pyx_t_2);
12378   __Pyx_XDECREF(__pyx_t_3);
12379   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12380   __pyx_r = NULL;
12381   __pyx_L0:;
12382   __Pyx_XGIVEREF(__pyx_r);
12383   __Pyx_RefNannyFinishContext();
12384   return __pyx_r;
12385 }
12386 
12387 /* "View.MemoryView":590
12388  *
12389  *     @property
12390  *     def size(self):             # <<<<<<<<<<<<<<
12391  *         if self._size is None:
12392  *             result = 1
12393  */
12394 
12395 /* Python wrapper */
12396 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject * __pyx_v_self)12397 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
12398   PyObject *__pyx_r = 0;
12399   __Pyx_RefNannyDeclarations
12400   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12401   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12402 
12403   /* function exit code */
12404   __Pyx_RefNannyFinishContext();
12405   return __pyx_r;
12406 }
12407 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)12408 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12409   PyObject *__pyx_v_result = NULL;
12410   PyObject *__pyx_v_length = NULL;
12411   PyObject *__pyx_r = NULL;
12412   __Pyx_RefNannyDeclarations
12413   int __pyx_t_1;
12414   int __pyx_t_2;
12415   Py_ssize_t *__pyx_t_3;
12416   Py_ssize_t *__pyx_t_4;
12417   Py_ssize_t *__pyx_t_5;
12418   PyObject *__pyx_t_6 = NULL;
12419   __Pyx_RefNannySetupContext("__get__", 0);
12420 
12421   /* "View.MemoryView":591
12422  *     @property
12423  *     def size(self):
12424  *         if self._size is None:             # <<<<<<<<<<<<<<
12425  *             result = 1
12426  *
12427  */
12428   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
12429   __pyx_t_2 = (__pyx_t_1 != 0);
12430   if (__pyx_t_2) {
12431 
12432     /* "View.MemoryView":592
12433  *     def size(self):
12434  *         if self._size is None:
12435  *             result = 1             # <<<<<<<<<<<<<<
12436  *
12437  *             for length in self.view.shape[:self.view.ndim]:
12438  */
12439     __Pyx_INCREF(__pyx_int_1);
12440     __pyx_v_result = __pyx_int_1;
12441 
12442     /* "View.MemoryView":594
12443  *             result = 1
12444  *
12445  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
12446  *                 result *= length
12447  *
12448  */
12449     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12450     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12451       __pyx_t_3 = __pyx_t_5;
12452       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 594, __pyx_L1_error)
12453       __Pyx_GOTREF(__pyx_t_6);
12454       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
12455       __pyx_t_6 = 0;
12456 
12457       /* "View.MemoryView":595
12458  *
12459  *             for length in self.view.shape[:self.view.ndim]:
12460  *                 result *= length             # <<<<<<<<<<<<<<
12461  *
12462  *             self._size = result
12463  */
12464       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 595, __pyx_L1_error)
12465       __Pyx_GOTREF(__pyx_t_6);
12466       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
12467       __pyx_t_6 = 0;
12468     }
12469 
12470     /* "View.MemoryView":597
12471  *                 result *= length
12472  *
12473  *             self._size = result             # <<<<<<<<<<<<<<
12474  *
12475  *         return self._size
12476  */
12477     __Pyx_INCREF(__pyx_v_result);
12478     __Pyx_GIVEREF(__pyx_v_result);
12479     __Pyx_GOTREF(__pyx_v_self->_size);
12480     __Pyx_DECREF(__pyx_v_self->_size);
12481     __pyx_v_self->_size = __pyx_v_result;
12482 
12483     /* "View.MemoryView":591
12484  *     @property
12485  *     def size(self):
12486  *         if self._size is None:             # <<<<<<<<<<<<<<
12487  *             result = 1
12488  *
12489  */
12490   }
12491 
12492   /* "View.MemoryView":599
12493  *             self._size = result
12494  *
12495  *         return self._size             # <<<<<<<<<<<<<<
12496  *
12497  *     def __len__(self):
12498  */
12499   __Pyx_XDECREF(__pyx_r);
12500   __Pyx_INCREF(__pyx_v_self->_size);
12501   __pyx_r = __pyx_v_self->_size;
12502   goto __pyx_L0;
12503 
12504   /* "View.MemoryView":590
12505  *
12506  *     @property
12507  *     def size(self):             # <<<<<<<<<<<<<<
12508  *         if self._size is None:
12509  *             result = 1
12510  */
12511 
12512   /* function exit code */
12513   __pyx_L1_error:;
12514   __Pyx_XDECREF(__pyx_t_6);
12515   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12516   __pyx_r = NULL;
12517   __pyx_L0:;
12518   __Pyx_XDECREF(__pyx_v_result);
12519   __Pyx_XDECREF(__pyx_v_length);
12520   __Pyx_XGIVEREF(__pyx_r);
12521   __Pyx_RefNannyFinishContext();
12522   return __pyx_r;
12523 }
12524 
12525 /* "View.MemoryView":601
12526  *         return self._size
12527  *
12528  *     def __len__(self):             # <<<<<<<<<<<<<<
12529  *         if self.view.ndim >= 1:
12530  *             return self.view.shape[0]
12531  */
12532 
12533 /* Python wrapper */
12534 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)12535 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
12536   Py_ssize_t __pyx_r;
12537   __Pyx_RefNannyDeclarations
12538   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
12539   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12540 
12541   /* function exit code */
12542   __Pyx_RefNannyFinishContext();
12543   return __pyx_r;
12544 }
12545 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)12546 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
12547   Py_ssize_t __pyx_r;
12548   __Pyx_RefNannyDeclarations
12549   int __pyx_t_1;
12550   __Pyx_RefNannySetupContext("__len__", 0);
12551 
12552   /* "View.MemoryView":602
12553  *
12554  *     def __len__(self):
12555  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
12556  *             return self.view.shape[0]
12557  *
12558  */
12559   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
12560   if (__pyx_t_1) {
12561 
12562     /* "View.MemoryView":603
12563  *     def __len__(self):
12564  *         if self.view.ndim >= 1:
12565  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
12566  *
12567  *         return 0
12568  */
12569     __pyx_r = (__pyx_v_self->view.shape[0]);
12570     goto __pyx_L0;
12571 
12572     /* "View.MemoryView":602
12573  *
12574  *     def __len__(self):
12575  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
12576  *             return self.view.shape[0]
12577  *
12578  */
12579   }
12580 
12581   /* "View.MemoryView":605
12582  *             return self.view.shape[0]
12583  *
12584  *         return 0             # <<<<<<<<<<<<<<
12585  *
12586  *     def __repr__(self):
12587  */
12588   __pyx_r = 0;
12589   goto __pyx_L0;
12590 
12591   /* "View.MemoryView":601
12592  *         return self._size
12593  *
12594  *     def __len__(self):             # <<<<<<<<<<<<<<
12595  *         if self.view.ndim >= 1:
12596  *             return self.view.shape[0]
12597  */
12598 
12599   /* function exit code */
12600   __pyx_L0:;
12601   __Pyx_RefNannyFinishContext();
12602   return __pyx_r;
12603 }
12604 
12605 /* "View.MemoryView":607
12606  *         return 0
12607  *
12608  *     def __repr__(self):             # <<<<<<<<<<<<<<
12609  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
12610  *                                                id(self))
12611  */
12612 
12613 /* Python wrapper */
12614 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)12615 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
12616   PyObject *__pyx_r = 0;
12617   __Pyx_RefNannyDeclarations
12618   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
12619   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12620 
12621   /* function exit code */
12622   __Pyx_RefNannyFinishContext();
12623   return __pyx_r;
12624 }
12625 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)12626 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
12627   PyObject *__pyx_r = NULL;
12628   __Pyx_RefNannyDeclarations
12629   PyObject *__pyx_t_1 = NULL;
12630   PyObject *__pyx_t_2 = NULL;
12631   PyObject *__pyx_t_3 = NULL;
12632   __Pyx_RefNannySetupContext("__repr__", 0);
12633 
12634   /* "View.MemoryView":608
12635  *
12636  *     def __repr__(self):
12637  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
12638  *                                                id(self))
12639  *
12640  */
12641   __Pyx_XDECREF(__pyx_r);
12642   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 608, __pyx_L1_error)
12643   __Pyx_GOTREF(__pyx_t_1);
12644   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 608, __pyx_L1_error)
12645   __Pyx_GOTREF(__pyx_t_2);
12646   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12647   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 608, __pyx_L1_error)
12648   __Pyx_GOTREF(__pyx_t_1);
12649   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12650 
12651   /* "View.MemoryView":609
12652  *     def __repr__(self):
12653  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
12654  *                                                id(self))             # <<<<<<<<<<<<<<
12655  *
12656  *     def __str__(self):
12657  */
12658   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 609, __pyx_L1_error)
12659   __Pyx_GOTREF(__pyx_t_2);
12660 
12661   /* "View.MemoryView":608
12662  *
12663  *     def __repr__(self):
12664  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
12665  *                                                id(self))
12666  *
12667  */
12668   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 608, __pyx_L1_error)
12669   __Pyx_GOTREF(__pyx_t_3);
12670   __Pyx_GIVEREF(__pyx_t_1);
12671   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
12672   __Pyx_GIVEREF(__pyx_t_2);
12673   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
12674   __pyx_t_1 = 0;
12675   __pyx_t_2 = 0;
12676   __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(1, 608, __pyx_L1_error)
12677   __Pyx_GOTREF(__pyx_t_2);
12678   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12679   __pyx_r = __pyx_t_2;
12680   __pyx_t_2 = 0;
12681   goto __pyx_L0;
12682 
12683   /* "View.MemoryView":607
12684  *         return 0
12685  *
12686  *     def __repr__(self):             # <<<<<<<<<<<<<<
12687  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
12688  *                                                id(self))
12689  */
12690 
12691   /* function exit code */
12692   __pyx_L1_error:;
12693   __Pyx_XDECREF(__pyx_t_1);
12694   __Pyx_XDECREF(__pyx_t_2);
12695   __Pyx_XDECREF(__pyx_t_3);
12696   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12697   __pyx_r = NULL;
12698   __pyx_L0:;
12699   __Pyx_XGIVEREF(__pyx_r);
12700   __Pyx_RefNannyFinishContext();
12701   return __pyx_r;
12702 }
12703 
12704 /* "View.MemoryView":611
12705  *                                                id(self))
12706  *
12707  *     def __str__(self):             # <<<<<<<<<<<<<<
12708  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
12709  *
12710  */
12711 
12712 /* Python wrapper */
12713 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)12714 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
12715   PyObject *__pyx_r = 0;
12716   __Pyx_RefNannyDeclarations
12717   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
12718   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12719 
12720   /* function exit code */
12721   __Pyx_RefNannyFinishContext();
12722   return __pyx_r;
12723 }
12724 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)12725 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
12726   PyObject *__pyx_r = NULL;
12727   __Pyx_RefNannyDeclarations
12728   PyObject *__pyx_t_1 = NULL;
12729   PyObject *__pyx_t_2 = NULL;
12730   __Pyx_RefNannySetupContext("__str__", 0);
12731 
12732   /* "View.MemoryView":612
12733  *
12734  *     def __str__(self):
12735  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
12736  *
12737  *
12738  */
12739   __Pyx_XDECREF(__pyx_r);
12740   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
12741   __Pyx_GOTREF(__pyx_t_1);
12742   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
12743   __Pyx_GOTREF(__pyx_t_2);
12744   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12745   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
12746   __Pyx_GOTREF(__pyx_t_1);
12747   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12748   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
12749   __Pyx_GOTREF(__pyx_t_2);
12750   __Pyx_GIVEREF(__pyx_t_1);
12751   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
12752   __pyx_t_1 = 0;
12753   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
12754   __Pyx_GOTREF(__pyx_t_1);
12755   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12756   __pyx_r = __pyx_t_1;
12757   __pyx_t_1 = 0;
12758   goto __pyx_L0;
12759 
12760   /* "View.MemoryView":611
12761  *                                                id(self))
12762  *
12763  *     def __str__(self):             # <<<<<<<<<<<<<<
12764  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
12765  *
12766  */
12767 
12768   /* function exit code */
12769   __pyx_L1_error:;
12770   __Pyx_XDECREF(__pyx_t_1);
12771   __Pyx_XDECREF(__pyx_t_2);
12772   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12773   __pyx_r = NULL;
12774   __pyx_L0:;
12775   __Pyx_XGIVEREF(__pyx_r);
12776   __Pyx_RefNannyFinishContext();
12777   return __pyx_r;
12778 }
12779 
12780 /* "View.MemoryView":615
12781  *
12782  *
12783  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
12784  *         cdef __Pyx_memviewslice *mslice
12785  *         cdef __Pyx_memviewslice tmp
12786  */
12787 
12788 /* Python wrapper */
12789 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_c_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)12790 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12791   PyObject *__pyx_r = 0;
12792   __Pyx_RefNannyDeclarations
12793   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
12794   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
12795 
12796   /* function exit code */
12797   __Pyx_RefNannyFinishContext();
12798   return __pyx_r;
12799 }
12800 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)12801 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
12802   __Pyx_memviewslice *__pyx_v_mslice;
12803   __Pyx_memviewslice __pyx_v_tmp;
12804   PyObject *__pyx_r = NULL;
12805   __Pyx_RefNannyDeclarations
12806   PyObject *__pyx_t_1 = NULL;
12807   __Pyx_RefNannySetupContext("is_c_contig", 0);
12808 
12809   /* "View.MemoryView":618
12810  *         cdef __Pyx_memviewslice *mslice
12811  *         cdef __Pyx_memviewslice tmp
12812  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
12813  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
12814  *
12815  */
12816   __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
12817 
12818   /* "View.MemoryView":619
12819  *         cdef __Pyx_memviewslice tmp
12820  *         mslice = get_slice_from_memview(self, &tmp)
12821  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
12822  *
12823  *     def is_f_contig(self):
12824  */
12825   __Pyx_XDECREF(__pyx_r);
12826   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error)
12827   __Pyx_GOTREF(__pyx_t_1);
12828   __pyx_r = __pyx_t_1;
12829   __pyx_t_1 = 0;
12830   goto __pyx_L0;
12831 
12832   /* "View.MemoryView":615
12833  *
12834  *
12835  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
12836  *         cdef __Pyx_memviewslice *mslice
12837  *         cdef __Pyx_memviewslice tmp
12838  */
12839 
12840   /* function exit code */
12841   __pyx_L1_error:;
12842   __Pyx_XDECREF(__pyx_t_1);
12843   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
12844   __pyx_r = NULL;
12845   __pyx_L0:;
12846   __Pyx_XGIVEREF(__pyx_r);
12847   __Pyx_RefNannyFinishContext();
12848   return __pyx_r;
12849 }
12850 
12851 /* "View.MemoryView":621
12852  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
12853  *
12854  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
12855  *         cdef __Pyx_memviewslice *mslice
12856  *         cdef __Pyx_memviewslice tmp
12857  */
12858 
12859 /* Python wrapper */
12860 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_f_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)12861 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12862   PyObject *__pyx_r = 0;
12863   __Pyx_RefNannyDeclarations
12864   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
12865   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
12866 
12867   /* function exit code */
12868   __Pyx_RefNannyFinishContext();
12869   return __pyx_r;
12870 }
12871 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)12872 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
12873   __Pyx_memviewslice *__pyx_v_mslice;
12874   __Pyx_memviewslice __pyx_v_tmp;
12875   PyObject *__pyx_r = NULL;
12876   __Pyx_RefNannyDeclarations
12877   PyObject *__pyx_t_1 = NULL;
12878   __Pyx_RefNannySetupContext("is_f_contig", 0);
12879 
12880   /* "View.MemoryView":624
12881  *         cdef __Pyx_memviewslice *mslice
12882  *         cdef __Pyx_memviewslice tmp
12883  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
12884  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
12885  *
12886  */
12887   __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
12888 
12889   /* "View.MemoryView":625
12890  *         cdef __Pyx_memviewslice tmp
12891  *         mslice = get_slice_from_memview(self, &tmp)
12892  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
12893  *
12894  *     def copy(self):
12895  */
12896   __Pyx_XDECREF(__pyx_r);
12897   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 625, __pyx_L1_error)
12898   __Pyx_GOTREF(__pyx_t_1);
12899   __pyx_r = __pyx_t_1;
12900   __pyx_t_1 = 0;
12901   goto __pyx_L0;
12902 
12903   /* "View.MemoryView":621
12904  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
12905  *
12906  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
12907  *         cdef __Pyx_memviewslice *mslice
12908  *         cdef __Pyx_memviewslice tmp
12909  */
12910 
12911   /* function exit code */
12912   __pyx_L1_error:;
12913   __Pyx_XDECREF(__pyx_t_1);
12914   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
12915   __pyx_r = NULL;
12916   __pyx_L0:;
12917   __Pyx_XGIVEREF(__pyx_r);
12918   __Pyx_RefNannyFinishContext();
12919   return __pyx_r;
12920 }
12921 
12922 /* "View.MemoryView":627
12923  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
12924  *
12925  *     def copy(self):             # <<<<<<<<<<<<<<
12926  *         cdef __Pyx_memviewslice mslice
12927  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
12928  */
12929 
12930 /* Python wrapper */
12931 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)12932 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12933   PyObject *__pyx_r = 0;
12934   __Pyx_RefNannyDeclarations
12935   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
12936   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
12937 
12938   /* function exit code */
12939   __Pyx_RefNannyFinishContext();
12940   return __pyx_r;
12941 }
12942 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)12943 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
12944   __Pyx_memviewslice __pyx_v_mslice;
12945   int __pyx_v_flags;
12946   PyObject *__pyx_r = NULL;
12947   __Pyx_RefNannyDeclarations
12948   __Pyx_memviewslice __pyx_t_1;
12949   PyObject *__pyx_t_2 = NULL;
12950   __Pyx_RefNannySetupContext("copy", 0);
12951 
12952   /* "View.MemoryView":629
12953  *     def copy(self):
12954  *         cdef __Pyx_memviewslice mslice
12955  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
12956  *
12957  *         slice_copy(self, &mslice)
12958  */
12959   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
12960 
12961   /* "View.MemoryView":631
12962  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
12963  *
12964  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
12965  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
12966  *                                    self.view.itemsize,
12967  */
12968   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
12969 
12970   /* "View.MemoryView":632
12971  *
12972  *         slice_copy(self, &mslice)
12973  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
12974  *                                    self.view.itemsize,
12975  *                                    flags|PyBUF_C_CONTIGUOUS,
12976  */
12977   __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(1, 632, __pyx_L1_error)
12978   __pyx_v_mslice = __pyx_t_1;
12979 
12980   /* "View.MemoryView":637
12981  *                                    self.dtype_is_object)
12982  *
12983  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
12984  *
12985  *     def copy_fortran(self):
12986  */
12987   __Pyx_XDECREF(__pyx_r);
12988   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 637, __pyx_L1_error)
12989   __Pyx_GOTREF(__pyx_t_2);
12990   __pyx_r = __pyx_t_2;
12991   __pyx_t_2 = 0;
12992   goto __pyx_L0;
12993 
12994   /* "View.MemoryView":627
12995  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
12996  *
12997  *     def copy(self):             # <<<<<<<<<<<<<<
12998  *         cdef __Pyx_memviewslice mslice
12999  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13000  */
13001 
13002   /* function exit code */
13003   __pyx_L1_error:;
13004   __Pyx_XDECREF(__pyx_t_2);
13005   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
13006   __pyx_r = NULL;
13007   __pyx_L0:;
13008   __Pyx_XGIVEREF(__pyx_r);
13009   __Pyx_RefNannyFinishContext();
13010   return __pyx_r;
13011 }
13012 
13013 /* "View.MemoryView":639
13014  *         return memoryview_copy_from_slice(self, &mslice)
13015  *
13016  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
13017  *         cdef __Pyx_memviewslice src, dst
13018  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13019  */
13020 
13021 /* Python wrapper */
13022 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy_fortran(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13023 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13024   PyObject *__pyx_r = 0;
13025   __Pyx_RefNannyDeclarations
13026   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
13027   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
13028 
13029   /* function exit code */
13030   __Pyx_RefNannyFinishContext();
13031   return __pyx_r;
13032 }
13033 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)13034 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
13035   __Pyx_memviewslice __pyx_v_src;
13036   __Pyx_memviewslice __pyx_v_dst;
13037   int __pyx_v_flags;
13038   PyObject *__pyx_r = NULL;
13039   __Pyx_RefNannyDeclarations
13040   __Pyx_memviewslice __pyx_t_1;
13041   PyObject *__pyx_t_2 = NULL;
13042   __Pyx_RefNannySetupContext("copy_fortran", 0);
13043 
13044   /* "View.MemoryView":641
13045  *     def copy_fortran(self):
13046  *         cdef __Pyx_memviewslice src, dst
13047  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
13048  *
13049  *         slice_copy(self, &src)
13050  */
13051   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
13052 
13053   /* "View.MemoryView":643
13054  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13055  *
13056  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
13057  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
13058  *                                 self.view.itemsize,
13059  */
13060   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
13061 
13062   /* "View.MemoryView":644
13063  *
13064  *         slice_copy(self, &src)
13065  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
13066  *                                 self.view.itemsize,
13067  *                                 flags|PyBUF_F_CONTIGUOUS,
13068  */
13069   __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(1, 644, __pyx_L1_error)
13070   __pyx_v_dst = __pyx_t_1;
13071 
13072   /* "View.MemoryView":649
13073  *                                 self.dtype_is_object)
13074  *
13075  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
13076  *
13077  *
13078  */
13079   __Pyx_XDECREF(__pyx_r);
13080   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 649, __pyx_L1_error)
13081   __Pyx_GOTREF(__pyx_t_2);
13082   __pyx_r = __pyx_t_2;
13083   __pyx_t_2 = 0;
13084   goto __pyx_L0;
13085 
13086   /* "View.MemoryView":639
13087  *         return memoryview_copy_from_slice(self, &mslice)
13088  *
13089  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
13090  *         cdef __Pyx_memviewslice src, dst
13091  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13092  */
13093 
13094   /* function exit code */
13095   __pyx_L1_error:;
13096   __Pyx_XDECREF(__pyx_t_2);
13097   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
13098   __pyx_r = NULL;
13099   __pyx_L0:;
13100   __Pyx_XGIVEREF(__pyx_r);
13101   __Pyx_RefNannyFinishContext();
13102   return __pyx_r;
13103 }
13104 
13105 /* "(tree fragment)":1
13106  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13107  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13108  * def __setstate_cython__(self, __pyx_state):
13109  */
13110 
13111 /* Python wrapper */
13112 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13113 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13114   PyObject *__pyx_r = 0;
13115   __Pyx_RefNannyDeclarations
13116   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
13117   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13118 
13119   /* function exit code */
13120   __Pyx_RefNannyFinishContext();
13121   return __pyx_r;
13122 }
13123 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)13124 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
13125   PyObject *__pyx_r = NULL;
13126   __Pyx_RefNannyDeclarations
13127   PyObject *__pyx_t_1 = NULL;
13128   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
13129 
13130   /* "(tree fragment)":2
13131  * def __reduce_cython__(self):
13132  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13133  * def __setstate_cython__(self, __pyx_state):
13134  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13135  */
13136   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
13137   __Pyx_GOTREF(__pyx_t_1);
13138   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13139   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13140   __PYX_ERR(1, 2, __pyx_L1_error)
13141 
13142   /* "(tree fragment)":1
13143  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13144  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13145  * def __setstate_cython__(self, __pyx_state):
13146  */
13147 
13148   /* function exit code */
13149   __pyx_L1_error:;
13150   __Pyx_XDECREF(__pyx_t_1);
13151   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13152   __pyx_r = NULL;
13153   __Pyx_XGIVEREF(__pyx_r);
13154   __Pyx_RefNannyFinishContext();
13155   return __pyx_r;
13156 }
13157 
13158 /* "(tree fragment)":3
13159  * def __reduce_cython__(self):
13160  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13161  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13162  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13163  */
13164 
13165 /* Python wrapper */
13166 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)13167 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
13168   PyObject *__pyx_r = 0;
13169   __Pyx_RefNannyDeclarations
13170   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
13171   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
13172 
13173   /* function exit code */
13174   __Pyx_RefNannyFinishContext();
13175   return __pyx_r;
13176 }
13177 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)13178 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
13179   PyObject *__pyx_r = NULL;
13180   __Pyx_RefNannyDeclarations
13181   PyObject *__pyx_t_1 = NULL;
13182   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
13183 
13184   /* "(tree fragment)":4
13185  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13186  * def __setstate_cython__(self, __pyx_state):
13187  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13188  */
13189   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
13190   __Pyx_GOTREF(__pyx_t_1);
13191   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13192   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13193   __PYX_ERR(1, 4, __pyx_L1_error)
13194 
13195   /* "(tree fragment)":3
13196  * def __reduce_cython__(self):
13197  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13198  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13199  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13200  */
13201 
13202   /* function exit code */
13203   __pyx_L1_error:;
13204   __Pyx_XDECREF(__pyx_t_1);
13205   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13206   __pyx_r = NULL;
13207   __Pyx_XGIVEREF(__pyx_r);
13208   __Pyx_RefNannyFinishContext();
13209   return __pyx_r;
13210 }
13211 
13212 /* "View.MemoryView":653
13213  *
13214  * @cname('__pyx_memoryview_new')
13215  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
13216  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13217  *     result.typeinfo = typeinfo
13218  */
13219 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)13220 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
13221   struct __pyx_memoryview_obj *__pyx_v_result = 0;
13222   PyObject *__pyx_r = NULL;
13223   __Pyx_RefNannyDeclarations
13224   PyObject *__pyx_t_1 = NULL;
13225   PyObject *__pyx_t_2 = NULL;
13226   PyObject *__pyx_t_3 = NULL;
13227   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
13228 
13229   /* "View.MemoryView":654
13230  * @cname('__pyx_memoryview_new')
13231  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
13232  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
13233  *     result.typeinfo = typeinfo
13234  *     return result
13235  */
13236   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 654, __pyx_L1_error)
13237   __Pyx_GOTREF(__pyx_t_1);
13238   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 654, __pyx_L1_error)
13239   __Pyx_GOTREF(__pyx_t_2);
13240   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 654, __pyx_L1_error)
13241   __Pyx_GOTREF(__pyx_t_3);
13242   __Pyx_INCREF(__pyx_v_o);
13243   __Pyx_GIVEREF(__pyx_v_o);
13244   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
13245   __Pyx_GIVEREF(__pyx_t_1);
13246   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
13247   __Pyx_GIVEREF(__pyx_t_2);
13248   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
13249   __pyx_t_1 = 0;
13250   __pyx_t_2 = 0;
13251   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 654, __pyx_L1_error)
13252   __Pyx_GOTREF(__pyx_t_2);
13253   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13254   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
13255   __pyx_t_2 = 0;
13256 
13257   /* "View.MemoryView":655
13258  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
13259  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13260  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
13261  *     return result
13262  *
13263  */
13264   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
13265 
13266   /* "View.MemoryView":656
13267  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13268  *     result.typeinfo = typeinfo
13269  *     return result             # <<<<<<<<<<<<<<
13270  *
13271  * @cname('__pyx_memoryview_check')
13272  */
13273   __Pyx_XDECREF(__pyx_r);
13274   __Pyx_INCREF(((PyObject *)__pyx_v_result));
13275   __pyx_r = ((PyObject *)__pyx_v_result);
13276   goto __pyx_L0;
13277 
13278   /* "View.MemoryView":653
13279  *
13280  * @cname('__pyx_memoryview_new')
13281  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
13282  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13283  *     result.typeinfo = typeinfo
13284  */
13285 
13286   /* function exit code */
13287   __pyx_L1_error:;
13288   __Pyx_XDECREF(__pyx_t_1);
13289   __Pyx_XDECREF(__pyx_t_2);
13290   __Pyx_XDECREF(__pyx_t_3);
13291   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
13292   __pyx_r = 0;
13293   __pyx_L0:;
13294   __Pyx_XDECREF((PyObject *)__pyx_v_result);
13295   __Pyx_XGIVEREF(__pyx_r);
13296   __Pyx_RefNannyFinishContext();
13297   return __pyx_r;
13298 }
13299 
13300 /* "View.MemoryView":659
13301  *
13302  * @cname('__pyx_memoryview_check')
13303  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
13304  *     return isinstance(o, memoryview)
13305  *
13306  */
13307 
__pyx_memoryview_check(PyObject * __pyx_v_o)13308 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
13309   int __pyx_r;
13310   __Pyx_RefNannyDeclarations
13311   int __pyx_t_1;
13312   __Pyx_RefNannySetupContext("memoryview_check", 0);
13313 
13314   /* "View.MemoryView":660
13315  * @cname('__pyx_memoryview_check')
13316  * cdef inline bint memoryview_check(object o):
13317  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
13318  *
13319  * cdef tuple _unellipsify(object index, int ndim):
13320  */
13321   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
13322   __pyx_r = __pyx_t_1;
13323   goto __pyx_L0;
13324 
13325   /* "View.MemoryView":659
13326  *
13327  * @cname('__pyx_memoryview_check')
13328  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
13329  *     return isinstance(o, memoryview)
13330  *
13331  */
13332 
13333   /* function exit code */
13334   __pyx_L0:;
13335   __Pyx_RefNannyFinishContext();
13336   return __pyx_r;
13337 }
13338 
13339 /* "View.MemoryView":662
13340  *     return isinstance(o, memoryview)
13341  *
13342  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
13343  *     """
13344  *     Replace all ellipses with full slices and fill incomplete indices with
13345  */
13346 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)13347 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
13348   PyObject *__pyx_v_tup = NULL;
13349   PyObject *__pyx_v_result = NULL;
13350   int __pyx_v_have_slices;
13351   int __pyx_v_seen_ellipsis;
13352   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
13353   PyObject *__pyx_v_item = NULL;
13354   Py_ssize_t __pyx_v_nslices;
13355   PyObject *__pyx_r = NULL;
13356   __Pyx_RefNannyDeclarations
13357   int __pyx_t_1;
13358   int __pyx_t_2;
13359   PyObject *__pyx_t_3 = NULL;
13360   PyObject *__pyx_t_4 = NULL;
13361   Py_ssize_t __pyx_t_5;
13362   PyObject *(*__pyx_t_6)(PyObject *);
13363   PyObject *__pyx_t_7 = NULL;
13364   Py_ssize_t __pyx_t_8;
13365   int __pyx_t_9;
13366   int __pyx_t_10;
13367   PyObject *__pyx_t_11 = NULL;
13368   __Pyx_RefNannySetupContext("_unellipsify", 0);
13369 
13370   /* "View.MemoryView":667
13371  *     full slices.
13372  *     """
13373  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
13374  *         tup = (index,)
13375  *     else:
13376  */
13377   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
13378   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13379   if (__pyx_t_2) {
13380 
13381     /* "View.MemoryView":668
13382  *     """
13383  *     if not isinstance(index, tuple):
13384  *         tup = (index,)             # <<<<<<<<<<<<<<
13385  *     else:
13386  *         tup = index
13387  */
13388     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 668, __pyx_L1_error)
13389     __Pyx_GOTREF(__pyx_t_3);
13390     __Pyx_INCREF(__pyx_v_index);
13391     __Pyx_GIVEREF(__pyx_v_index);
13392     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
13393     __pyx_v_tup = __pyx_t_3;
13394     __pyx_t_3 = 0;
13395 
13396     /* "View.MemoryView":667
13397  *     full slices.
13398  *     """
13399  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
13400  *         tup = (index,)
13401  *     else:
13402  */
13403     goto __pyx_L3;
13404   }
13405 
13406   /* "View.MemoryView":670
13407  *         tup = (index,)
13408  *     else:
13409  *         tup = index             # <<<<<<<<<<<<<<
13410  *
13411  *     result = []
13412  */
13413   /*else*/ {
13414     __Pyx_INCREF(__pyx_v_index);
13415     __pyx_v_tup = __pyx_v_index;
13416   }
13417   __pyx_L3:;
13418 
13419   /* "View.MemoryView":672
13420  *         tup = index
13421  *
13422  *     result = []             # <<<<<<<<<<<<<<
13423  *     have_slices = False
13424  *     seen_ellipsis = False
13425  */
13426   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
13427   __Pyx_GOTREF(__pyx_t_3);
13428   __pyx_v_result = ((PyObject*)__pyx_t_3);
13429   __pyx_t_3 = 0;
13430 
13431   /* "View.MemoryView":673
13432  *
13433  *     result = []
13434  *     have_slices = False             # <<<<<<<<<<<<<<
13435  *     seen_ellipsis = False
13436  *     for idx, item in enumerate(tup):
13437  */
13438   __pyx_v_have_slices = 0;
13439 
13440   /* "View.MemoryView":674
13441  *     result = []
13442  *     have_slices = False
13443  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
13444  *     for idx, item in enumerate(tup):
13445  *         if item is Ellipsis:
13446  */
13447   __pyx_v_seen_ellipsis = 0;
13448 
13449   /* "View.MemoryView":675
13450  *     have_slices = False
13451  *     seen_ellipsis = False
13452  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
13453  *         if item is Ellipsis:
13454  *             if not seen_ellipsis:
13455  */
13456   __Pyx_INCREF(__pyx_int_0);
13457   __pyx_t_3 = __pyx_int_0;
13458   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
13459     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
13460     __pyx_t_6 = NULL;
13461   } else {
13462     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 675, __pyx_L1_error)
13463     __Pyx_GOTREF(__pyx_t_4);
13464     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 675, __pyx_L1_error)
13465   }
13466   for (;;) {
13467     if (likely(!__pyx_t_6)) {
13468       if (likely(PyList_CheckExact(__pyx_t_4))) {
13469         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
13470         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13471         __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(1, 675, __pyx_L1_error)
13472         #else
13473         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 675, __pyx_L1_error)
13474         __Pyx_GOTREF(__pyx_t_7);
13475         #endif
13476       } else {
13477         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
13478         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13479         __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(1, 675, __pyx_L1_error)
13480         #else
13481         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 675, __pyx_L1_error)
13482         __Pyx_GOTREF(__pyx_t_7);
13483         #endif
13484       }
13485     } else {
13486       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
13487       if (unlikely(!__pyx_t_7)) {
13488         PyObject* exc_type = PyErr_Occurred();
13489         if (exc_type) {
13490           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13491           else __PYX_ERR(1, 675, __pyx_L1_error)
13492         }
13493         break;
13494       }
13495       __Pyx_GOTREF(__pyx_t_7);
13496     }
13497     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
13498     __pyx_t_7 = 0;
13499     __Pyx_INCREF(__pyx_t_3);
13500     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
13501     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 675, __pyx_L1_error)
13502     __Pyx_GOTREF(__pyx_t_7);
13503     __Pyx_DECREF(__pyx_t_3);
13504     __pyx_t_3 = __pyx_t_7;
13505     __pyx_t_7 = 0;
13506 
13507     /* "View.MemoryView":676
13508  *     seen_ellipsis = False
13509  *     for idx, item in enumerate(tup):
13510  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
13511  *             if not seen_ellipsis:
13512  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13513  */
13514     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
13515     __pyx_t_1 = (__pyx_t_2 != 0);
13516     if (__pyx_t_1) {
13517 
13518       /* "View.MemoryView":677
13519  *     for idx, item in enumerate(tup):
13520  *         if item is Ellipsis:
13521  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
13522  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13523  *                 seen_ellipsis = True
13524  */
13525       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
13526       if (__pyx_t_1) {
13527 
13528         /* "View.MemoryView":678
13529  *         if item is Ellipsis:
13530  *             if not seen_ellipsis:
13531  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
13532  *                 seen_ellipsis = True
13533  *             else:
13534  */
13535         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 678, __pyx_L1_error)
13536         __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(1, 678, __pyx_L1_error)
13537         __Pyx_GOTREF(__pyx_t_7);
13538         { Py_ssize_t __pyx_temp;
13539           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
13540             __Pyx_INCREF(__pyx_slice__26);
13541             __Pyx_GIVEREF(__pyx_slice__26);
13542             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__26);
13543           }
13544         }
13545         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 678, __pyx_L1_error)
13546         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13547 
13548         /* "View.MemoryView":679
13549  *             if not seen_ellipsis:
13550  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13551  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
13552  *             else:
13553  *                 result.append(slice(None))
13554  */
13555         __pyx_v_seen_ellipsis = 1;
13556 
13557         /* "View.MemoryView":677
13558  *     for idx, item in enumerate(tup):
13559  *         if item is Ellipsis:
13560  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
13561  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13562  *                 seen_ellipsis = True
13563  */
13564         goto __pyx_L7;
13565       }
13566 
13567       /* "View.MemoryView":681
13568  *                 seen_ellipsis = True
13569  *             else:
13570  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
13571  *             have_slices = True
13572  *         else:
13573  */
13574       /*else*/ {
13575         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__26); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 681, __pyx_L1_error)
13576       }
13577       __pyx_L7:;
13578 
13579       /* "View.MemoryView":682
13580  *             else:
13581  *                 result.append(slice(None))
13582  *             have_slices = True             # <<<<<<<<<<<<<<
13583  *         else:
13584  *             if not isinstance(item, slice) and not PyIndex_Check(item):
13585  */
13586       __pyx_v_have_slices = 1;
13587 
13588       /* "View.MemoryView":676
13589  *     seen_ellipsis = False
13590  *     for idx, item in enumerate(tup):
13591  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
13592  *             if not seen_ellipsis:
13593  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13594  */
13595       goto __pyx_L6;
13596     }
13597 
13598     /* "View.MemoryView":684
13599  *             have_slices = True
13600  *         else:
13601  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
13602  *                 raise TypeError("Cannot index with type '%s'" % type(item))
13603  *
13604  */
13605     /*else*/ {
13606       __pyx_t_2 = PySlice_Check(__pyx_v_item);
13607       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
13608       if (__pyx_t_10) {
13609       } else {
13610         __pyx_t_1 = __pyx_t_10;
13611         goto __pyx_L9_bool_binop_done;
13612       }
13613       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
13614       __pyx_t_1 = __pyx_t_10;
13615       __pyx_L9_bool_binop_done:;
13616       if (unlikely(__pyx_t_1)) {
13617 
13618         /* "View.MemoryView":685
13619  *         else:
13620  *             if not isinstance(item, slice) and not PyIndex_Check(item):
13621  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
13622  *
13623  *             have_slices = have_slices or isinstance(item, slice)
13624  */
13625         __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(1, 685, __pyx_L1_error)
13626         __Pyx_GOTREF(__pyx_t_7);
13627         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 685, __pyx_L1_error)
13628         __Pyx_GOTREF(__pyx_t_11);
13629         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13630         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
13631         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
13632         __PYX_ERR(1, 685, __pyx_L1_error)
13633 
13634         /* "View.MemoryView":684
13635  *             have_slices = True
13636  *         else:
13637  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
13638  *                 raise TypeError("Cannot index with type '%s'" % type(item))
13639  *
13640  */
13641       }
13642 
13643       /* "View.MemoryView":687
13644  *                 raise TypeError("Cannot index with type '%s'" % type(item))
13645  *
13646  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
13647  *             result.append(item)
13648  *
13649  */
13650       __pyx_t_10 = (__pyx_v_have_slices != 0);
13651       if (!__pyx_t_10) {
13652       } else {
13653         __pyx_t_1 = __pyx_t_10;
13654         goto __pyx_L11_bool_binop_done;
13655       }
13656       __pyx_t_10 = PySlice_Check(__pyx_v_item);
13657       __pyx_t_2 = (__pyx_t_10 != 0);
13658       __pyx_t_1 = __pyx_t_2;
13659       __pyx_L11_bool_binop_done:;
13660       __pyx_v_have_slices = __pyx_t_1;
13661 
13662       /* "View.MemoryView":688
13663  *
13664  *             have_slices = have_slices or isinstance(item, slice)
13665  *             result.append(item)             # <<<<<<<<<<<<<<
13666  *
13667  *     nslices = ndim - len(result)
13668  */
13669       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 688, __pyx_L1_error)
13670     }
13671     __pyx_L6:;
13672 
13673     /* "View.MemoryView":675
13674  *     have_slices = False
13675  *     seen_ellipsis = False
13676  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
13677  *         if item is Ellipsis:
13678  *             if not seen_ellipsis:
13679  */
13680   }
13681   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13682   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13683 
13684   /* "View.MemoryView":690
13685  *             result.append(item)
13686  *
13687  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
13688  *     if nslices:
13689  *         result.extend([slice(None)] * nslices)
13690  */
13691   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 690, __pyx_L1_error)
13692   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
13693 
13694   /* "View.MemoryView":691
13695  *
13696  *     nslices = ndim - len(result)
13697  *     if nslices:             # <<<<<<<<<<<<<<
13698  *         result.extend([slice(None)] * nslices)
13699  *
13700  */
13701   __pyx_t_1 = (__pyx_v_nslices != 0);
13702   if (__pyx_t_1) {
13703 
13704     /* "View.MemoryView":692
13705  *     nslices = ndim - len(result)
13706  *     if nslices:
13707  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
13708  *
13709  *     return have_slices or nslices, tuple(result)
13710  */
13711     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 692, __pyx_L1_error)
13712     __Pyx_GOTREF(__pyx_t_3);
13713     { Py_ssize_t __pyx_temp;
13714       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
13715         __Pyx_INCREF(__pyx_slice__26);
13716         __Pyx_GIVEREF(__pyx_slice__26);
13717         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__26);
13718       }
13719     }
13720     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
13721     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13722 
13723     /* "View.MemoryView":691
13724  *
13725  *     nslices = ndim - len(result)
13726  *     if nslices:             # <<<<<<<<<<<<<<
13727  *         result.extend([slice(None)] * nslices)
13728  *
13729  */
13730   }
13731 
13732   /* "View.MemoryView":694
13733  *         result.extend([slice(None)] * nslices)
13734  *
13735  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
13736  *
13737  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
13738  */
13739   __Pyx_XDECREF(__pyx_r);
13740   if (!__pyx_v_have_slices) {
13741   } else {
13742     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 694, __pyx_L1_error)
13743     __Pyx_GOTREF(__pyx_t_4);
13744     __pyx_t_3 = __pyx_t_4;
13745     __pyx_t_4 = 0;
13746     goto __pyx_L14_bool_binop_done;
13747   }
13748   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 694, __pyx_L1_error)
13749   __Pyx_GOTREF(__pyx_t_4);
13750   __pyx_t_3 = __pyx_t_4;
13751   __pyx_t_4 = 0;
13752   __pyx_L14_bool_binop_done:;
13753   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 694, __pyx_L1_error)
13754   __Pyx_GOTREF(__pyx_t_4);
13755   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 694, __pyx_L1_error)
13756   __Pyx_GOTREF(__pyx_t_11);
13757   __Pyx_GIVEREF(__pyx_t_3);
13758   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
13759   __Pyx_GIVEREF(__pyx_t_4);
13760   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
13761   __pyx_t_3 = 0;
13762   __pyx_t_4 = 0;
13763   __pyx_r = ((PyObject*)__pyx_t_11);
13764   __pyx_t_11 = 0;
13765   goto __pyx_L0;
13766 
13767   /* "View.MemoryView":662
13768  *     return isinstance(o, memoryview)
13769  *
13770  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
13771  *     """
13772  *     Replace all ellipses with full slices and fill incomplete indices with
13773  */
13774 
13775   /* function exit code */
13776   __pyx_L1_error:;
13777   __Pyx_XDECREF(__pyx_t_3);
13778   __Pyx_XDECREF(__pyx_t_4);
13779   __Pyx_XDECREF(__pyx_t_7);
13780   __Pyx_XDECREF(__pyx_t_11);
13781   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
13782   __pyx_r = 0;
13783   __pyx_L0:;
13784   __Pyx_XDECREF(__pyx_v_tup);
13785   __Pyx_XDECREF(__pyx_v_result);
13786   __Pyx_XDECREF(__pyx_v_idx);
13787   __Pyx_XDECREF(__pyx_v_item);
13788   __Pyx_XGIVEREF(__pyx_r);
13789   __Pyx_RefNannyFinishContext();
13790   return __pyx_r;
13791 }
13792 
13793 /* "View.MemoryView":696
13794  *     return have_slices or nslices, tuple(result)
13795  *
13796  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
13797  *     for suboffset in suboffsets[:ndim]:
13798  *         if suboffset >= 0:
13799  */
13800 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)13801 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
13802   Py_ssize_t __pyx_v_suboffset;
13803   PyObject *__pyx_r = NULL;
13804   __Pyx_RefNannyDeclarations
13805   Py_ssize_t *__pyx_t_1;
13806   Py_ssize_t *__pyx_t_2;
13807   Py_ssize_t *__pyx_t_3;
13808   int __pyx_t_4;
13809   PyObject *__pyx_t_5 = NULL;
13810   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
13811 
13812   /* "View.MemoryView":697
13813  *
13814  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
13815  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
13816  *         if suboffset >= 0:
13817  *             raise ValueError("Indirect dimensions not supported")
13818  */
13819   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
13820   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
13821     __pyx_t_1 = __pyx_t_3;
13822     __pyx_v_suboffset = (__pyx_t_1[0]);
13823 
13824     /* "View.MemoryView":698
13825  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
13826  *     for suboffset in suboffsets[:ndim]:
13827  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
13828  *             raise ValueError("Indirect dimensions not supported")
13829  *
13830  */
13831     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
13832     if (unlikely(__pyx_t_4)) {
13833 
13834       /* "View.MemoryView":699
13835  *     for suboffset in suboffsets[:ndim]:
13836  *         if suboffset >= 0:
13837  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
13838  *
13839  *
13840  */
13841       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 699, __pyx_L1_error)
13842       __Pyx_GOTREF(__pyx_t_5);
13843       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
13844       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13845       __PYX_ERR(1, 699, __pyx_L1_error)
13846 
13847       /* "View.MemoryView":698
13848  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
13849  *     for suboffset in suboffsets[:ndim]:
13850  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
13851  *             raise ValueError("Indirect dimensions not supported")
13852  *
13853  */
13854     }
13855   }
13856 
13857   /* "View.MemoryView":696
13858  *     return have_slices or nslices, tuple(result)
13859  *
13860  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
13861  *     for suboffset in suboffsets[:ndim]:
13862  *         if suboffset >= 0:
13863  */
13864 
13865   /* function exit code */
13866   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13867   goto __pyx_L0;
13868   __pyx_L1_error:;
13869   __Pyx_XDECREF(__pyx_t_5);
13870   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
13871   __pyx_r = 0;
13872   __pyx_L0:;
13873   __Pyx_XGIVEREF(__pyx_r);
13874   __Pyx_RefNannyFinishContext();
13875   return __pyx_r;
13876 }
13877 
13878 /* "View.MemoryView":706
13879  *
13880  * @cname('__pyx_memview_slice')
13881  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
13882  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
13883  *     cdef bint negative_step
13884  */
13885 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)13886 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
13887   int __pyx_v_new_ndim;
13888   int __pyx_v_suboffset_dim;
13889   int __pyx_v_dim;
13890   __Pyx_memviewslice __pyx_v_src;
13891   __Pyx_memviewslice __pyx_v_dst;
13892   __Pyx_memviewslice *__pyx_v_p_src;
13893   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
13894   __Pyx_memviewslice *__pyx_v_p_dst;
13895   int *__pyx_v_p_suboffset_dim;
13896   Py_ssize_t __pyx_v_start;
13897   Py_ssize_t __pyx_v_stop;
13898   Py_ssize_t __pyx_v_step;
13899   int __pyx_v_have_start;
13900   int __pyx_v_have_stop;
13901   int __pyx_v_have_step;
13902   PyObject *__pyx_v_index = NULL;
13903   struct __pyx_memoryview_obj *__pyx_r = NULL;
13904   __Pyx_RefNannyDeclarations
13905   int __pyx_t_1;
13906   int __pyx_t_2;
13907   PyObject *__pyx_t_3 = NULL;
13908   struct __pyx_memoryview_obj *__pyx_t_4;
13909   char *__pyx_t_5;
13910   int __pyx_t_6;
13911   Py_ssize_t __pyx_t_7;
13912   PyObject *(*__pyx_t_8)(PyObject *);
13913   PyObject *__pyx_t_9 = NULL;
13914   Py_ssize_t __pyx_t_10;
13915   int __pyx_t_11;
13916   Py_ssize_t __pyx_t_12;
13917   __Pyx_RefNannySetupContext("memview_slice", 0);
13918 
13919   /* "View.MemoryView":707
13920  * @cname('__pyx_memview_slice')
13921  * cdef memoryview memview_slice(memoryview memview, object indices):
13922  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
13923  *     cdef bint negative_step
13924  *     cdef __Pyx_memviewslice src, dst
13925  */
13926   __pyx_v_new_ndim = 0;
13927   __pyx_v_suboffset_dim = -1;
13928 
13929   /* "View.MemoryView":714
13930  *
13931  *
13932  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
13933  *
13934  *     cdef _memoryviewslice memviewsliceobj
13935  */
13936   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
13937 
13938   /* "View.MemoryView":718
13939  *     cdef _memoryviewslice memviewsliceobj
13940  *
13941  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
13942  *
13943  *     if isinstance(memview, _memoryviewslice):
13944  */
13945   #ifndef CYTHON_WITHOUT_ASSERTIONS
13946   if (unlikely(!Py_OptimizeFlag)) {
13947     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
13948       PyErr_SetNone(PyExc_AssertionError);
13949       __PYX_ERR(1, 718, __pyx_L1_error)
13950     }
13951   }
13952   #endif
13953 
13954   /* "View.MemoryView":720
13955  *     assert memview.view.ndim > 0
13956  *
13957  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
13958  *         memviewsliceobj = memview
13959  *         p_src = &memviewsliceobj.from_slice
13960  */
13961   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
13962   __pyx_t_2 = (__pyx_t_1 != 0);
13963   if (__pyx_t_2) {
13964 
13965     /* "View.MemoryView":721
13966  *
13967  *     if isinstance(memview, _memoryviewslice):
13968  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
13969  *         p_src = &memviewsliceobj.from_slice
13970  *     else:
13971  */
13972     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 721, __pyx_L1_error)
13973     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
13974     __Pyx_INCREF(__pyx_t_3);
13975     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
13976     __pyx_t_3 = 0;
13977 
13978     /* "View.MemoryView":722
13979  *     if isinstance(memview, _memoryviewslice):
13980  *         memviewsliceobj = memview
13981  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
13982  *     else:
13983  *         slice_copy(memview, &src)
13984  */
13985     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
13986 
13987     /* "View.MemoryView":720
13988  *     assert memview.view.ndim > 0
13989  *
13990  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
13991  *         memviewsliceobj = memview
13992  *         p_src = &memviewsliceobj.from_slice
13993  */
13994     goto __pyx_L3;
13995   }
13996 
13997   /* "View.MemoryView":724
13998  *         p_src = &memviewsliceobj.from_slice
13999  *     else:
14000  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
14001  *         p_src = &src
14002  *
14003  */
14004   /*else*/ {
14005     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
14006 
14007     /* "View.MemoryView":725
14008  *     else:
14009  *         slice_copy(memview, &src)
14010  *         p_src = &src             # <<<<<<<<<<<<<<
14011  *
14012  *
14013  */
14014     __pyx_v_p_src = (&__pyx_v_src);
14015   }
14016   __pyx_L3:;
14017 
14018   /* "View.MemoryView":731
14019  *
14020  *
14021  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
14022  *     dst.data = p_src.data
14023  *
14024  */
14025   __pyx_t_4 = __pyx_v_p_src->memview;
14026   __pyx_v_dst.memview = __pyx_t_4;
14027 
14028   /* "View.MemoryView":732
14029  *
14030  *     dst.memview = p_src.memview
14031  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
14032  *
14033  *
14034  */
14035   __pyx_t_5 = __pyx_v_p_src->data;
14036   __pyx_v_dst.data = __pyx_t_5;
14037 
14038   /* "View.MemoryView":737
14039  *
14040  *
14041  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
14042  *     cdef int *p_suboffset_dim = &suboffset_dim
14043  *     cdef Py_ssize_t start, stop, step
14044  */
14045   __pyx_v_p_dst = (&__pyx_v_dst);
14046 
14047   /* "View.MemoryView":738
14048  *
14049  *     cdef __Pyx_memviewslice *p_dst = &dst
14050  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
14051  *     cdef Py_ssize_t start, stop, step
14052  *     cdef bint have_start, have_stop, have_step
14053  */
14054   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
14055 
14056   /* "View.MemoryView":742
14057  *     cdef bint have_start, have_stop, have_step
14058  *
14059  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
14060  *         if PyIndex_Check(index):
14061  *             slice_memviewslice(
14062  */
14063   __pyx_t_6 = 0;
14064   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
14065     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
14066     __pyx_t_8 = NULL;
14067   } else {
14068     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 742, __pyx_L1_error)
14069     __Pyx_GOTREF(__pyx_t_3);
14070     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 742, __pyx_L1_error)
14071   }
14072   for (;;) {
14073     if (likely(!__pyx_t_8)) {
14074       if (likely(PyList_CheckExact(__pyx_t_3))) {
14075         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
14076         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14077         __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(1, 742, __pyx_L1_error)
14078         #else
14079         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 742, __pyx_L1_error)
14080         __Pyx_GOTREF(__pyx_t_9);
14081         #endif
14082       } else {
14083         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
14084         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14085         __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(1, 742, __pyx_L1_error)
14086         #else
14087         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 742, __pyx_L1_error)
14088         __Pyx_GOTREF(__pyx_t_9);
14089         #endif
14090       }
14091     } else {
14092       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
14093       if (unlikely(!__pyx_t_9)) {
14094         PyObject* exc_type = PyErr_Occurred();
14095         if (exc_type) {
14096           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14097           else __PYX_ERR(1, 742, __pyx_L1_error)
14098         }
14099         break;
14100       }
14101       __Pyx_GOTREF(__pyx_t_9);
14102     }
14103     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
14104     __pyx_t_9 = 0;
14105     __pyx_v_dim = __pyx_t_6;
14106     __pyx_t_6 = (__pyx_t_6 + 1);
14107 
14108     /* "View.MemoryView":743
14109  *
14110  *     for dim, index in enumerate(indices):
14111  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
14112  *             slice_memviewslice(
14113  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14114  */
14115     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
14116     if (__pyx_t_2) {
14117 
14118       /* "View.MemoryView":747
14119  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14120  *                 dim, new_ndim, p_suboffset_dim,
14121  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
14122  *                 0, 0, 0, # have_{start,stop,step}
14123  *                 False)
14124  */
14125       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 747, __pyx_L1_error)
14126 
14127       /* "View.MemoryView":744
14128  *     for dim, index in enumerate(indices):
14129  *         if PyIndex_Check(index):
14130  *             slice_memviewslice(             # <<<<<<<<<<<<<<
14131  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14132  *                 dim, new_ndim, p_suboffset_dim,
14133  */
14134       __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(1, 744, __pyx_L1_error)
14135 
14136       /* "View.MemoryView":743
14137  *
14138  *     for dim, index in enumerate(indices):
14139  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
14140  *             slice_memviewslice(
14141  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14142  */
14143       goto __pyx_L6;
14144     }
14145 
14146     /* "View.MemoryView":750
14147  *                 0, 0, 0, # have_{start,stop,step}
14148  *                 False)
14149  *         elif index is None:             # <<<<<<<<<<<<<<
14150  *             p_dst.shape[new_ndim] = 1
14151  *             p_dst.strides[new_ndim] = 0
14152  */
14153     __pyx_t_2 = (__pyx_v_index == Py_None);
14154     __pyx_t_1 = (__pyx_t_2 != 0);
14155     if (__pyx_t_1) {
14156 
14157       /* "View.MemoryView":751
14158  *                 False)
14159  *         elif index is None:
14160  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
14161  *             p_dst.strides[new_ndim] = 0
14162  *             p_dst.suboffsets[new_ndim] = -1
14163  */
14164       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
14165 
14166       /* "View.MemoryView":752
14167  *         elif index is None:
14168  *             p_dst.shape[new_ndim] = 1
14169  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
14170  *             p_dst.suboffsets[new_ndim] = -1
14171  *             new_ndim += 1
14172  */
14173       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
14174 
14175       /* "View.MemoryView":753
14176  *             p_dst.shape[new_ndim] = 1
14177  *             p_dst.strides[new_ndim] = 0
14178  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
14179  *             new_ndim += 1
14180  *         else:
14181  */
14182       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
14183 
14184       /* "View.MemoryView":754
14185  *             p_dst.strides[new_ndim] = 0
14186  *             p_dst.suboffsets[new_ndim] = -1
14187  *             new_ndim += 1             # <<<<<<<<<<<<<<
14188  *         else:
14189  *             start = index.start or 0
14190  */
14191       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14192 
14193       /* "View.MemoryView":750
14194  *                 0, 0, 0, # have_{start,stop,step}
14195  *                 False)
14196  *         elif index is None:             # <<<<<<<<<<<<<<
14197  *             p_dst.shape[new_ndim] = 1
14198  *             p_dst.strides[new_ndim] = 0
14199  */
14200       goto __pyx_L6;
14201     }
14202 
14203     /* "View.MemoryView":756
14204  *             new_ndim += 1
14205  *         else:
14206  *             start = index.start or 0             # <<<<<<<<<<<<<<
14207  *             stop = index.stop or 0
14208  *             step = index.step or 0
14209  */
14210     /*else*/ {
14211       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 756, __pyx_L1_error)
14212       __Pyx_GOTREF(__pyx_t_9);
14213       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 756, __pyx_L1_error)
14214       if (!__pyx_t_1) {
14215         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14216       } else {
14217         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 756, __pyx_L1_error)
14218         __pyx_t_10 = __pyx_t_12;
14219         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14220         goto __pyx_L7_bool_binop_done;
14221       }
14222       __pyx_t_10 = 0;
14223       __pyx_L7_bool_binop_done:;
14224       __pyx_v_start = __pyx_t_10;
14225 
14226       /* "View.MemoryView":757
14227  *         else:
14228  *             start = index.start or 0
14229  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
14230  *             step = index.step or 0
14231  *
14232  */
14233       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 757, __pyx_L1_error)
14234       __Pyx_GOTREF(__pyx_t_9);
14235       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 757, __pyx_L1_error)
14236       if (!__pyx_t_1) {
14237         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14238       } else {
14239         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 757, __pyx_L1_error)
14240         __pyx_t_10 = __pyx_t_12;
14241         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14242         goto __pyx_L9_bool_binop_done;
14243       }
14244       __pyx_t_10 = 0;
14245       __pyx_L9_bool_binop_done:;
14246       __pyx_v_stop = __pyx_t_10;
14247 
14248       /* "View.MemoryView":758
14249  *             start = index.start or 0
14250  *             stop = index.stop or 0
14251  *             step = index.step or 0             # <<<<<<<<<<<<<<
14252  *
14253  *             have_start = index.start is not None
14254  */
14255       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 758, __pyx_L1_error)
14256       __Pyx_GOTREF(__pyx_t_9);
14257       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 758, __pyx_L1_error)
14258       if (!__pyx_t_1) {
14259         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14260       } else {
14261         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 758, __pyx_L1_error)
14262         __pyx_t_10 = __pyx_t_12;
14263         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14264         goto __pyx_L11_bool_binop_done;
14265       }
14266       __pyx_t_10 = 0;
14267       __pyx_L11_bool_binop_done:;
14268       __pyx_v_step = __pyx_t_10;
14269 
14270       /* "View.MemoryView":760
14271  *             step = index.step or 0
14272  *
14273  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
14274  *             have_stop = index.stop is not None
14275  *             have_step = index.step is not None
14276  */
14277       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
14278       __Pyx_GOTREF(__pyx_t_9);
14279       __pyx_t_1 = (__pyx_t_9 != Py_None);
14280       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14281       __pyx_v_have_start = __pyx_t_1;
14282 
14283       /* "View.MemoryView":761
14284  *
14285  *             have_start = index.start is not None
14286  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
14287  *             have_step = index.step is not None
14288  *
14289  */
14290       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
14291       __Pyx_GOTREF(__pyx_t_9);
14292       __pyx_t_1 = (__pyx_t_9 != Py_None);
14293       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14294       __pyx_v_have_stop = __pyx_t_1;
14295 
14296       /* "View.MemoryView":762
14297  *             have_start = index.start is not None
14298  *             have_stop = index.stop is not None
14299  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
14300  *
14301  *             slice_memviewslice(
14302  */
14303       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
14304       __Pyx_GOTREF(__pyx_t_9);
14305       __pyx_t_1 = (__pyx_t_9 != Py_None);
14306       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14307       __pyx_v_have_step = __pyx_t_1;
14308 
14309       /* "View.MemoryView":764
14310  *             have_step = index.step is not None
14311  *
14312  *             slice_memviewslice(             # <<<<<<<<<<<<<<
14313  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14314  *                 dim, new_ndim, p_suboffset_dim,
14315  */
14316       __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(1, 764, __pyx_L1_error)
14317 
14318       /* "View.MemoryView":770
14319  *                 have_start, have_stop, have_step,
14320  *                 True)
14321  *             new_ndim += 1             # <<<<<<<<<<<<<<
14322  *
14323  *     if isinstance(memview, _memoryviewslice):
14324  */
14325       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14326     }
14327     __pyx_L6:;
14328 
14329     /* "View.MemoryView":742
14330  *     cdef bint have_start, have_stop, have_step
14331  *
14332  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
14333  *         if PyIndex_Check(index):
14334  *             slice_memviewslice(
14335  */
14336   }
14337   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14338 
14339   /* "View.MemoryView":772
14340  *             new_ndim += 1
14341  *
14342  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14343  *         return memoryview_fromslice(dst, new_ndim,
14344  *                                     memviewsliceobj.to_object_func,
14345  */
14346   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14347   __pyx_t_2 = (__pyx_t_1 != 0);
14348   if (__pyx_t_2) {
14349 
14350     /* "View.MemoryView":773
14351  *
14352  *     if isinstance(memview, _memoryviewslice):
14353  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
14354  *                                     memviewsliceobj.to_object_func,
14355  *                                     memviewsliceobj.to_dtype_func,
14356  */
14357     __Pyx_XDECREF(((PyObject *)__pyx_r));
14358 
14359     /* "View.MemoryView":774
14360  *     if isinstance(memview, _memoryviewslice):
14361  *         return memoryview_fromslice(dst, new_ndim,
14362  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
14363  *                                     memviewsliceobj.to_dtype_func,
14364  *                                     memview.dtype_is_object)
14365  */
14366     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 774, __pyx_L1_error) }
14367 
14368     /* "View.MemoryView":775
14369  *         return memoryview_fromslice(dst, new_ndim,
14370  *                                     memviewsliceobj.to_object_func,
14371  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
14372  *                                     memview.dtype_is_object)
14373  *     else:
14374  */
14375     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 775, __pyx_L1_error) }
14376 
14377     /* "View.MemoryView":773
14378  *
14379  *     if isinstance(memview, _memoryviewslice):
14380  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
14381  *                                     memviewsliceobj.to_object_func,
14382  *                                     memviewsliceobj.to_dtype_func,
14383  */
14384     __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(1, 773, __pyx_L1_error)
14385     __Pyx_GOTREF(__pyx_t_3);
14386     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 773, __pyx_L1_error)
14387     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
14388     __pyx_t_3 = 0;
14389     goto __pyx_L0;
14390 
14391     /* "View.MemoryView":772
14392  *             new_ndim += 1
14393  *
14394  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14395  *         return memoryview_fromslice(dst, new_ndim,
14396  *                                     memviewsliceobj.to_object_func,
14397  */
14398   }
14399 
14400   /* "View.MemoryView":778
14401  *                                     memview.dtype_is_object)
14402  *     else:
14403  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
14404  *                                     memview.dtype_is_object)
14405  *
14406  */
14407   /*else*/ {
14408     __Pyx_XDECREF(((PyObject *)__pyx_r));
14409 
14410     /* "View.MemoryView":779
14411  *     else:
14412  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
14413  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
14414  *
14415  *
14416  */
14417     __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(1, 778, __pyx_L1_error)
14418     __Pyx_GOTREF(__pyx_t_3);
14419 
14420     /* "View.MemoryView":778
14421  *                                     memview.dtype_is_object)
14422  *     else:
14423  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
14424  *                                     memview.dtype_is_object)
14425  *
14426  */
14427     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 778, __pyx_L1_error)
14428     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
14429     __pyx_t_3 = 0;
14430     goto __pyx_L0;
14431   }
14432 
14433   /* "View.MemoryView":706
14434  *
14435  * @cname('__pyx_memview_slice')
14436  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
14437  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
14438  *     cdef bint negative_step
14439  */
14440 
14441   /* function exit code */
14442   __pyx_L1_error:;
14443   __Pyx_XDECREF(__pyx_t_3);
14444   __Pyx_XDECREF(__pyx_t_9);
14445   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14446   __pyx_r = 0;
14447   __pyx_L0:;
14448   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
14449   __Pyx_XDECREF(__pyx_v_index);
14450   __Pyx_XGIVEREF((PyObject *)__pyx_r);
14451   __Pyx_RefNannyFinishContext();
14452   return __pyx_r;
14453 }
14454 
14455 /* "View.MemoryView":803
14456  *
14457  * @cname('__pyx_memoryview_slice_memviewslice')
14458  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
14459  *         __Pyx_memviewslice *dst,
14460  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
14461  */
14462 
__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)14463 static 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) {
14464   Py_ssize_t __pyx_v_new_shape;
14465   int __pyx_v_negative_step;
14466   int __pyx_r;
14467   int __pyx_t_1;
14468   int __pyx_t_2;
14469   int __pyx_t_3;
14470 
14471   /* "View.MemoryView":823
14472  *     cdef bint negative_step
14473  *
14474  *     if not is_slice:             # <<<<<<<<<<<<<<
14475  *
14476  *         if start < 0:
14477  */
14478   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
14479   if (__pyx_t_1) {
14480 
14481     /* "View.MemoryView":825
14482  *     if not is_slice:
14483  *
14484  *         if start < 0:             # <<<<<<<<<<<<<<
14485  *             start += shape
14486  *         if not 0 <= start < shape:
14487  */
14488     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
14489     if (__pyx_t_1) {
14490 
14491       /* "View.MemoryView":826
14492  *
14493  *         if start < 0:
14494  *             start += shape             # <<<<<<<<<<<<<<
14495  *         if not 0 <= start < shape:
14496  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
14497  */
14498       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14499 
14500       /* "View.MemoryView":825
14501  *     if not is_slice:
14502  *
14503  *         if start < 0:             # <<<<<<<<<<<<<<
14504  *             start += shape
14505  *         if not 0 <= start < shape:
14506  */
14507     }
14508 
14509     /* "View.MemoryView":827
14510  *         if start < 0:
14511  *             start += shape
14512  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
14513  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
14514  *     else:
14515  */
14516     __pyx_t_1 = (0 <= __pyx_v_start);
14517     if (__pyx_t_1) {
14518       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
14519     }
14520     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14521     if (__pyx_t_2) {
14522 
14523       /* "View.MemoryView":828
14524  *             start += shape
14525  *         if not 0 <= start < shape:
14526  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
14527  *     else:
14528  *
14529  */
14530       __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(1, 828, __pyx_L1_error)
14531 
14532       /* "View.MemoryView":827
14533  *         if start < 0:
14534  *             start += shape
14535  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
14536  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
14537  *     else:
14538  */
14539     }
14540 
14541     /* "View.MemoryView":823
14542  *     cdef bint negative_step
14543  *
14544  *     if not is_slice:             # <<<<<<<<<<<<<<
14545  *
14546  *         if start < 0:
14547  */
14548     goto __pyx_L3;
14549   }
14550 
14551   /* "View.MemoryView":831
14552  *     else:
14553  *
14554  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
14555  *
14556  *         if have_step and step == 0:
14557  */
14558   /*else*/ {
14559     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
14560     if (__pyx_t_1) {
14561     } else {
14562       __pyx_t_2 = __pyx_t_1;
14563       goto __pyx_L6_bool_binop_done;
14564     }
14565     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
14566     __pyx_t_2 = __pyx_t_1;
14567     __pyx_L6_bool_binop_done:;
14568     __pyx_v_negative_step = __pyx_t_2;
14569 
14570     /* "View.MemoryView":833
14571  *         negative_step = have_step != 0 and step < 0
14572  *
14573  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
14574  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
14575  *
14576  */
14577     __pyx_t_1 = (__pyx_v_have_step != 0);
14578     if (__pyx_t_1) {
14579     } else {
14580       __pyx_t_2 = __pyx_t_1;
14581       goto __pyx_L9_bool_binop_done;
14582     }
14583     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
14584     __pyx_t_2 = __pyx_t_1;
14585     __pyx_L9_bool_binop_done:;
14586     if (__pyx_t_2) {
14587 
14588       /* "View.MemoryView":834
14589  *
14590  *         if have_step and step == 0:
14591  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
14592  *
14593  *
14594  */
14595       __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(1, 834, __pyx_L1_error)
14596 
14597       /* "View.MemoryView":833
14598  *         negative_step = have_step != 0 and step < 0
14599  *
14600  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
14601  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
14602  *
14603  */
14604     }
14605 
14606     /* "View.MemoryView":837
14607  *
14608  *
14609  *         if have_start:             # <<<<<<<<<<<<<<
14610  *             if start < 0:
14611  *                 start += shape
14612  */
14613     __pyx_t_2 = (__pyx_v_have_start != 0);
14614     if (__pyx_t_2) {
14615 
14616       /* "View.MemoryView":838
14617  *
14618  *         if have_start:
14619  *             if start < 0:             # <<<<<<<<<<<<<<
14620  *                 start += shape
14621  *                 if start < 0:
14622  */
14623       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
14624       if (__pyx_t_2) {
14625 
14626         /* "View.MemoryView":839
14627  *         if have_start:
14628  *             if start < 0:
14629  *                 start += shape             # <<<<<<<<<<<<<<
14630  *                 if start < 0:
14631  *                     start = 0
14632  */
14633         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14634 
14635         /* "View.MemoryView":840
14636  *             if start < 0:
14637  *                 start += shape
14638  *                 if start < 0:             # <<<<<<<<<<<<<<
14639  *                     start = 0
14640  *             elif start >= shape:
14641  */
14642         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
14643         if (__pyx_t_2) {
14644 
14645           /* "View.MemoryView":841
14646  *                 start += shape
14647  *                 if start < 0:
14648  *                     start = 0             # <<<<<<<<<<<<<<
14649  *             elif start >= shape:
14650  *                 if negative_step:
14651  */
14652           __pyx_v_start = 0;
14653 
14654           /* "View.MemoryView":840
14655  *             if start < 0:
14656  *                 start += shape
14657  *                 if start < 0:             # <<<<<<<<<<<<<<
14658  *                     start = 0
14659  *             elif start >= shape:
14660  */
14661         }
14662 
14663         /* "View.MemoryView":838
14664  *
14665  *         if have_start:
14666  *             if start < 0:             # <<<<<<<<<<<<<<
14667  *                 start += shape
14668  *                 if start < 0:
14669  */
14670         goto __pyx_L12;
14671       }
14672 
14673       /* "View.MemoryView":842
14674  *                 if start < 0:
14675  *                     start = 0
14676  *             elif start >= shape:             # <<<<<<<<<<<<<<
14677  *                 if negative_step:
14678  *                     start = shape - 1
14679  */
14680       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
14681       if (__pyx_t_2) {
14682 
14683         /* "View.MemoryView":843
14684  *                     start = 0
14685  *             elif start >= shape:
14686  *                 if negative_step:             # <<<<<<<<<<<<<<
14687  *                     start = shape - 1
14688  *                 else:
14689  */
14690         __pyx_t_2 = (__pyx_v_negative_step != 0);
14691         if (__pyx_t_2) {
14692 
14693           /* "View.MemoryView":844
14694  *             elif start >= shape:
14695  *                 if negative_step:
14696  *                     start = shape - 1             # <<<<<<<<<<<<<<
14697  *                 else:
14698  *                     start = shape
14699  */
14700           __pyx_v_start = (__pyx_v_shape - 1);
14701 
14702           /* "View.MemoryView":843
14703  *                     start = 0
14704  *             elif start >= shape:
14705  *                 if negative_step:             # <<<<<<<<<<<<<<
14706  *                     start = shape - 1
14707  *                 else:
14708  */
14709           goto __pyx_L14;
14710         }
14711 
14712         /* "View.MemoryView":846
14713  *                     start = shape - 1
14714  *                 else:
14715  *                     start = shape             # <<<<<<<<<<<<<<
14716  *         else:
14717  *             if negative_step:
14718  */
14719         /*else*/ {
14720           __pyx_v_start = __pyx_v_shape;
14721         }
14722         __pyx_L14:;
14723 
14724         /* "View.MemoryView":842
14725  *                 if start < 0:
14726  *                     start = 0
14727  *             elif start >= shape:             # <<<<<<<<<<<<<<
14728  *                 if negative_step:
14729  *                     start = shape - 1
14730  */
14731       }
14732       __pyx_L12:;
14733 
14734       /* "View.MemoryView":837
14735  *
14736  *
14737  *         if have_start:             # <<<<<<<<<<<<<<
14738  *             if start < 0:
14739  *                 start += shape
14740  */
14741       goto __pyx_L11;
14742     }
14743 
14744     /* "View.MemoryView":848
14745  *                     start = shape
14746  *         else:
14747  *             if negative_step:             # <<<<<<<<<<<<<<
14748  *                 start = shape - 1
14749  *             else:
14750  */
14751     /*else*/ {
14752       __pyx_t_2 = (__pyx_v_negative_step != 0);
14753       if (__pyx_t_2) {
14754 
14755         /* "View.MemoryView":849
14756  *         else:
14757  *             if negative_step:
14758  *                 start = shape - 1             # <<<<<<<<<<<<<<
14759  *             else:
14760  *                 start = 0
14761  */
14762         __pyx_v_start = (__pyx_v_shape - 1);
14763 
14764         /* "View.MemoryView":848
14765  *                     start = shape
14766  *         else:
14767  *             if negative_step:             # <<<<<<<<<<<<<<
14768  *                 start = shape - 1
14769  *             else:
14770  */
14771         goto __pyx_L15;
14772       }
14773 
14774       /* "View.MemoryView":851
14775  *                 start = shape - 1
14776  *             else:
14777  *                 start = 0             # <<<<<<<<<<<<<<
14778  *
14779  *         if have_stop:
14780  */
14781       /*else*/ {
14782         __pyx_v_start = 0;
14783       }
14784       __pyx_L15:;
14785     }
14786     __pyx_L11:;
14787 
14788     /* "View.MemoryView":853
14789  *                 start = 0
14790  *
14791  *         if have_stop:             # <<<<<<<<<<<<<<
14792  *             if stop < 0:
14793  *                 stop += shape
14794  */
14795     __pyx_t_2 = (__pyx_v_have_stop != 0);
14796     if (__pyx_t_2) {
14797 
14798       /* "View.MemoryView":854
14799  *
14800  *         if have_stop:
14801  *             if stop < 0:             # <<<<<<<<<<<<<<
14802  *                 stop += shape
14803  *                 if stop < 0:
14804  */
14805       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
14806       if (__pyx_t_2) {
14807 
14808         /* "View.MemoryView":855
14809  *         if have_stop:
14810  *             if stop < 0:
14811  *                 stop += shape             # <<<<<<<<<<<<<<
14812  *                 if stop < 0:
14813  *                     stop = 0
14814  */
14815         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
14816 
14817         /* "View.MemoryView":856
14818  *             if stop < 0:
14819  *                 stop += shape
14820  *                 if stop < 0:             # <<<<<<<<<<<<<<
14821  *                     stop = 0
14822  *             elif stop > shape:
14823  */
14824         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
14825         if (__pyx_t_2) {
14826 
14827           /* "View.MemoryView":857
14828  *                 stop += shape
14829  *                 if stop < 0:
14830  *                     stop = 0             # <<<<<<<<<<<<<<
14831  *             elif stop > shape:
14832  *                 stop = shape
14833  */
14834           __pyx_v_stop = 0;
14835 
14836           /* "View.MemoryView":856
14837  *             if stop < 0:
14838  *                 stop += shape
14839  *                 if stop < 0:             # <<<<<<<<<<<<<<
14840  *                     stop = 0
14841  *             elif stop > shape:
14842  */
14843         }
14844 
14845         /* "View.MemoryView":854
14846  *
14847  *         if have_stop:
14848  *             if stop < 0:             # <<<<<<<<<<<<<<
14849  *                 stop += shape
14850  *                 if stop < 0:
14851  */
14852         goto __pyx_L17;
14853       }
14854 
14855       /* "View.MemoryView":858
14856  *                 if stop < 0:
14857  *                     stop = 0
14858  *             elif stop > shape:             # <<<<<<<<<<<<<<
14859  *                 stop = shape
14860  *         else:
14861  */
14862       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
14863       if (__pyx_t_2) {
14864 
14865         /* "View.MemoryView":859
14866  *                     stop = 0
14867  *             elif stop > shape:
14868  *                 stop = shape             # <<<<<<<<<<<<<<
14869  *         else:
14870  *             if negative_step:
14871  */
14872         __pyx_v_stop = __pyx_v_shape;
14873 
14874         /* "View.MemoryView":858
14875  *                 if stop < 0:
14876  *                     stop = 0
14877  *             elif stop > shape:             # <<<<<<<<<<<<<<
14878  *                 stop = shape
14879  *         else:
14880  */
14881       }
14882       __pyx_L17:;
14883 
14884       /* "View.MemoryView":853
14885  *                 start = 0
14886  *
14887  *         if have_stop:             # <<<<<<<<<<<<<<
14888  *             if stop < 0:
14889  *                 stop += shape
14890  */
14891       goto __pyx_L16;
14892     }
14893 
14894     /* "View.MemoryView":861
14895  *                 stop = shape
14896  *         else:
14897  *             if negative_step:             # <<<<<<<<<<<<<<
14898  *                 stop = -1
14899  *             else:
14900  */
14901     /*else*/ {
14902       __pyx_t_2 = (__pyx_v_negative_step != 0);
14903       if (__pyx_t_2) {
14904 
14905         /* "View.MemoryView":862
14906  *         else:
14907  *             if negative_step:
14908  *                 stop = -1             # <<<<<<<<<<<<<<
14909  *             else:
14910  *                 stop = shape
14911  */
14912         __pyx_v_stop = -1L;
14913 
14914         /* "View.MemoryView":861
14915  *                 stop = shape
14916  *         else:
14917  *             if negative_step:             # <<<<<<<<<<<<<<
14918  *                 stop = -1
14919  *             else:
14920  */
14921         goto __pyx_L19;
14922       }
14923 
14924       /* "View.MemoryView":864
14925  *                 stop = -1
14926  *             else:
14927  *                 stop = shape             # <<<<<<<<<<<<<<
14928  *
14929  *         if not have_step:
14930  */
14931       /*else*/ {
14932         __pyx_v_stop = __pyx_v_shape;
14933       }
14934       __pyx_L19:;
14935     }
14936     __pyx_L16:;
14937 
14938     /* "View.MemoryView":866
14939  *                 stop = shape
14940  *
14941  *         if not have_step:             # <<<<<<<<<<<<<<
14942  *             step = 1
14943  *
14944  */
14945     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
14946     if (__pyx_t_2) {
14947 
14948       /* "View.MemoryView":867
14949  *
14950  *         if not have_step:
14951  *             step = 1             # <<<<<<<<<<<<<<
14952  *
14953  *
14954  */
14955       __pyx_v_step = 1;
14956 
14957       /* "View.MemoryView":866
14958  *                 stop = shape
14959  *
14960  *         if not have_step:             # <<<<<<<<<<<<<<
14961  *             step = 1
14962  *
14963  */
14964     }
14965 
14966     /* "View.MemoryView":871
14967  *
14968  *         with cython.cdivision(True):
14969  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
14970  *
14971  *             if (stop - start) - step * new_shape:
14972  */
14973     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
14974 
14975     /* "View.MemoryView":873
14976  *             new_shape = (stop - start) // step
14977  *
14978  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
14979  *                 new_shape += 1
14980  *
14981  */
14982     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
14983     if (__pyx_t_2) {
14984 
14985       /* "View.MemoryView":874
14986  *
14987  *             if (stop - start) - step * new_shape:
14988  *                 new_shape += 1             # <<<<<<<<<<<<<<
14989  *
14990  *         if new_shape < 0:
14991  */
14992       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
14993 
14994       /* "View.MemoryView":873
14995  *             new_shape = (stop - start) // step
14996  *
14997  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
14998  *                 new_shape += 1
14999  *
15000  */
15001     }
15002 
15003     /* "View.MemoryView":876
15004  *                 new_shape += 1
15005  *
15006  *         if new_shape < 0:             # <<<<<<<<<<<<<<
15007  *             new_shape = 0
15008  *
15009  */
15010     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
15011     if (__pyx_t_2) {
15012 
15013       /* "View.MemoryView":877
15014  *
15015  *         if new_shape < 0:
15016  *             new_shape = 0             # <<<<<<<<<<<<<<
15017  *
15018  *
15019  */
15020       __pyx_v_new_shape = 0;
15021 
15022       /* "View.MemoryView":876
15023  *                 new_shape += 1
15024  *
15025  *         if new_shape < 0:             # <<<<<<<<<<<<<<
15026  *             new_shape = 0
15027  *
15028  */
15029     }
15030 
15031     /* "View.MemoryView":880
15032  *
15033  *
15034  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
15035  *         dst.shape[new_ndim] = new_shape
15036  *         dst.suboffsets[new_ndim] = suboffset
15037  */
15038     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
15039 
15040     /* "View.MemoryView":881
15041  *
15042  *         dst.strides[new_ndim] = stride * step
15043  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
15044  *         dst.suboffsets[new_ndim] = suboffset
15045  *
15046  */
15047     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
15048 
15049     /* "View.MemoryView":882
15050  *         dst.strides[new_ndim] = stride * step
15051  *         dst.shape[new_ndim] = new_shape
15052  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
15053  *
15054  *
15055  */
15056     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
15057   }
15058   __pyx_L3:;
15059 
15060   /* "View.MemoryView":885
15061  *
15062  *
15063  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
15064  *         dst.data += start * stride
15065  *     else:
15066  */
15067   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
15068   if (__pyx_t_2) {
15069 
15070     /* "View.MemoryView":886
15071  *
15072  *     if suboffset_dim[0] < 0:
15073  *         dst.data += start * stride             # <<<<<<<<<<<<<<
15074  *     else:
15075  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15076  */
15077     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
15078 
15079     /* "View.MemoryView":885
15080  *
15081  *
15082  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
15083  *         dst.data += start * stride
15084  *     else:
15085  */
15086     goto __pyx_L23;
15087   }
15088 
15089   /* "View.MemoryView":888
15090  *         dst.data += start * stride
15091  *     else:
15092  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
15093  *
15094  *     if suboffset >= 0:
15095  */
15096   /*else*/ {
15097     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
15098     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
15099   }
15100   __pyx_L23:;
15101 
15102   /* "View.MemoryView":890
15103  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15104  *
15105  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15106  *         if not is_slice:
15107  *             if new_ndim == 0:
15108  */
15109   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15110   if (__pyx_t_2) {
15111 
15112     /* "View.MemoryView":891
15113  *
15114  *     if suboffset >= 0:
15115  *         if not is_slice:             # <<<<<<<<<<<<<<
15116  *             if new_ndim == 0:
15117  *                 dst.data = (<char **> dst.data)[0] + suboffset
15118  */
15119     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
15120     if (__pyx_t_2) {
15121 
15122       /* "View.MemoryView":892
15123  *     if suboffset >= 0:
15124  *         if not is_slice:
15125  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
15126  *                 dst.data = (<char **> dst.data)[0] + suboffset
15127  *             else:
15128  */
15129       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
15130       if (__pyx_t_2) {
15131 
15132         /* "View.MemoryView":893
15133  *         if not is_slice:
15134  *             if new_ndim == 0:
15135  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
15136  *             else:
15137  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
15138  */
15139         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
15140 
15141         /* "View.MemoryView":892
15142  *     if suboffset >= 0:
15143  *         if not is_slice:
15144  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
15145  *                 dst.data = (<char **> dst.data)[0] + suboffset
15146  *             else:
15147  */
15148         goto __pyx_L26;
15149       }
15150 
15151       /* "View.MemoryView":895
15152  *                 dst.data = (<char **> dst.data)[0] + suboffset
15153  *             else:
15154  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
15155  *                                      "must be indexed and not sliced", dim)
15156  *         else:
15157  */
15158       /*else*/ {
15159 
15160         /* "View.MemoryView":896
15161  *             else:
15162  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
15163  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
15164  *         else:
15165  *             suboffset_dim[0] = new_ndim
15166  */
15167         __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(1, 895, __pyx_L1_error)
15168       }
15169       __pyx_L26:;
15170 
15171       /* "View.MemoryView":891
15172  *
15173  *     if suboffset >= 0:
15174  *         if not is_slice:             # <<<<<<<<<<<<<<
15175  *             if new_ndim == 0:
15176  *                 dst.data = (<char **> dst.data)[0] + suboffset
15177  */
15178       goto __pyx_L25;
15179     }
15180 
15181     /* "View.MemoryView":898
15182  *                                      "must be indexed and not sliced", dim)
15183  *         else:
15184  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
15185  *
15186  *     return 0
15187  */
15188     /*else*/ {
15189       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
15190     }
15191     __pyx_L25:;
15192 
15193     /* "View.MemoryView":890
15194  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15195  *
15196  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15197  *         if not is_slice:
15198  *             if new_ndim == 0:
15199  */
15200   }
15201 
15202   /* "View.MemoryView":900
15203  *             suboffset_dim[0] = new_ndim
15204  *
15205  *     return 0             # <<<<<<<<<<<<<<
15206  *
15207  *
15208  */
15209   __pyx_r = 0;
15210   goto __pyx_L0;
15211 
15212   /* "View.MemoryView":803
15213  *
15214  * @cname('__pyx_memoryview_slice_memviewslice')
15215  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
15216  *         __Pyx_memviewslice *dst,
15217  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
15218  */
15219 
15220   /* function exit code */
15221   __pyx_L1_error:;
15222   {
15223     #ifdef WITH_THREAD
15224     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15225     #endif
15226     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15227     #ifdef WITH_THREAD
15228     __Pyx_PyGILState_Release(__pyx_gilstate_save);
15229     #endif
15230   }
15231   __pyx_r = -1;
15232   __pyx_L0:;
15233   return __pyx_r;
15234 }
15235 
15236 /* "View.MemoryView":906
15237  *
15238  * @cname('__pyx_pybuffer_index')
15239  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
15240  *                           Py_ssize_t dim) except NULL:
15241  *     cdef Py_ssize_t shape, stride, suboffset = -1
15242  */
15243 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)15244 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
15245   Py_ssize_t __pyx_v_shape;
15246   Py_ssize_t __pyx_v_stride;
15247   Py_ssize_t __pyx_v_suboffset;
15248   Py_ssize_t __pyx_v_itemsize;
15249   char *__pyx_v_resultp;
15250   char *__pyx_r;
15251   __Pyx_RefNannyDeclarations
15252   Py_ssize_t __pyx_t_1;
15253   int __pyx_t_2;
15254   PyObject *__pyx_t_3 = NULL;
15255   PyObject *__pyx_t_4 = NULL;
15256   __Pyx_RefNannySetupContext("pybuffer_index", 0);
15257 
15258   /* "View.MemoryView":908
15259  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
15260  *                           Py_ssize_t dim) except NULL:
15261  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
15262  *     cdef Py_ssize_t itemsize = view.itemsize
15263  *     cdef char *resultp
15264  */
15265   __pyx_v_suboffset = -1L;
15266 
15267   /* "View.MemoryView":909
15268  *                           Py_ssize_t dim) except NULL:
15269  *     cdef Py_ssize_t shape, stride, suboffset = -1
15270  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
15271  *     cdef char *resultp
15272  *
15273  */
15274   __pyx_t_1 = __pyx_v_view->itemsize;
15275   __pyx_v_itemsize = __pyx_t_1;
15276 
15277   /* "View.MemoryView":912
15278  *     cdef char *resultp
15279  *
15280  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
15281  *         shape = view.len / itemsize
15282  *         stride = itemsize
15283  */
15284   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
15285   if (__pyx_t_2) {
15286 
15287     /* "View.MemoryView":913
15288  *
15289  *     if view.ndim == 0:
15290  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
15291  *         stride = itemsize
15292  *     else:
15293  */
15294     if (unlikely(__pyx_v_itemsize == 0)) {
15295       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
15296       __PYX_ERR(1, 913, __pyx_L1_error)
15297     }
15298     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))) {
15299       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
15300       __PYX_ERR(1, 913, __pyx_L1_error)
15301     }
15302     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
15303 
15304     /* "View.MemoryView":914
15305  *     if view.ndim == 0:
15306  *         shape = view.len / itemsize
15307  *         stride = itemsize             # <<<<<<<<<<<<<<
15308  *     else:
15309  *         shape = view.shape[dim]
15310  */
15311     __pyx_v_stride = __pyx_v_itemsize;
15312 
15313     /* "View.MemoryView":912
15314  *     cdef char *resultp
15315  *
15316  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
15317  *         shape = view.len / itemsize
15318  *         stride = itemsize
15319  */
15320     goto __pyx_L3;
15321   }
15322 
15323   /* "View.MemoryView":916
15324  *         stride = itemsize
15325  *     else:
15326  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
15327  *         stride = view.strides[dim]
15328  *         if view.suboffsets != NULL:
15329  */
15330   /*else*/ {
15331     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
15332 
15333     /* "View.MemoryView":917
15334  *     else:
15335  *         shape = view.shape[dim]
15336  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
15337  *         if view.suboffsets != NULL:
15338  *             suboffset = view.suboffsets[dim]
15339  */
15340     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
15341 
15342     /* "View.MemoryView":918
15343  *         shape = view.shape[dim]
15344  *         stride = view.strides[dim]
15345  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
15346  *             suboffset = view.suboffsets[dim]
15347  *
15348  */
15349     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
15350     if (__pyx_t_2) {
15351 
15352       /* "View.MemoryView":919
15353  *         stride = view.strides[dim]
15354  *         if view.suboffsets != NULL:
15355  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
15356  *
15357  *     if index < 0:
15358  */
15359       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
15360 
15361       /* "View.MemoryView":918
15362  *         shape = view.shape[dim]
15363  *         stride = view.strides[dim]
15364  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
15365  *             suboffset = view.suboffsets[dim]
15366  *
15367  */
15368     }
15369   }
15370   __pyx_L3:;
15371 
15372   /* "View.MemoryView":921
15373  *             suboffset = view.suboffsets[dim]
15374  *
15375  *     if index < 0:             # <<<<<<<<<<<<<<
15376  *         index += view.shape[dim]
15377  *         if index < 0:
15378  */
15379   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15380   if (__pyx_t_2) {
15381 
15382     /* "View.MemoryView":922
15383  *
15384  *     if index < 0:
15385  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
15386  *         if index < 0:
15387  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15388  */
15389     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
15390 
15391     /* "View.MemoryView":923
15392  *     if index < 0:
15393  *         index += view.shape[dim]
15394  *         if index < 0:             # <<<<<<<<<<<<<<
15395  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15396  *
15397  */
15398     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15399     if (unlikely(__pyx_t_2)) {
15400 
15401       /* "View.MemoryView":924
15402  *         index += view.shape[dim]
15403  *         if index < 0:
15404  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
15405  *
15406  *     if index >= shape:
15407  */
15408       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 924, __pyx_L1_error)
15409       __Pyx_GOTREF(__pyx_t_3);
15410       __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(1, 924, __pyx_L1_error)
15411       __Pyx_GOTREF(__pyx_t_4);
15412       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15413       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 924, __pyx_L1_error)
15414       __Pyx_GOTREF(__pyx_t_3);
15415       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15416       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15417       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15418       __PYX_ERR(1, 924, __pyx_L1_error)
15419 
15420       /* "View.MemoryView":923
15421  *     if index < 0:
15422  *         index += view.shape[dim]
15423  *         if index < 0:             # <<<<<<<<<<<<<<
15424  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15425  *
15426  */
15427     }
15428 
15429     /* "View.MemoryView":921
15430  *             suboffset = view.suboffsets[dim]
15431  *
15432  *     if index < 0:             # <<<<<<<<<<<<<<
15433  *         index += view.shape[dim]
15434  *         if index < 0:
15435  */
15436   }
15437 
15438   /* "View.MemoryView":926
15439  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15440  *
15441  *     if index >= shape:             # <<<<<<<<<<<<<<
15442  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15443  *
15444  */
15445   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
15446   if (unlikely(__pyx_t_2)) {
15447 
15448     /* "View.MemoryView":927
15449  *
15450  *     if index >= shape:
15451  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
15452  *
15453  *     resultp = bufp + index * stride
15454  */
15455     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 927, __pyx_L1_error)
15456     __Pyx_GOTREF(__pyx_t_3);
15457     __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(1, 927, __pyx_L1_error)
15458     __Pyx_GOTREF(__pyx_t_4);
15459     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15460     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 927, __pyx_L1_error)
15461     __Pyx_GOTREF(__pyx_t_3);
15462     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15463     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15464     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15465     __PYX_ERR(1, 927, __pyx_L1_error)
15466 
15467     /* "View.MemoryView":926
15468  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15469  *
15470  *     if index >= shape:             # <<<<<<<<<<<<<<
15471  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15472  *
15473  */
15474   }
15475 
15476   /* "View.MemoryView":929
15477  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15478  *
15479  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
15480  *     if suboffset >= 0:
15481  *         resultp = (<char **> resultp)[0] + suboffset
15482  */
15483   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
15484 
15485   /* "View.MemoryView":930
15486  *
15487  *     resultp = bufp + index * stride
15488  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15489  *         resultp = (<char **> resultp)[0] + suboffset
15490  *
15491  */
15492   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15493   if (__pyx_t_2) {
15494 
15495     /* "View.MemoryView":931
15496  *     resultp = bufp + index * stride
15497  *     if suboffset >= 0:
15498  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
15499  *
15500  *     return resultp
15501  */
15502     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
15503 
15504     /* "View.MemoryView":930
15505  *
15506  *     resultp = bufp + index * stride
15507  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15508  *         resultp = (<char **> resultp)[0] + suboffset
15509  *
15510  */
15511   }
15512 
15513   /* "View.MemoryView":933
15514  *         resultp = (<char **> resultp)[0] + suboffset
15515  *
15516  *     return resultp             # <<<<<<<<<<<<<<
15517  *
15518  *
15519  */
15520   __pyx_r = __pyx_v_resultp;
15521   goto __pyx_L0;
15522 
15523   /* "View.MemoryView":906
15524  *
15525  * @cname('__pyx_pybuffer_index')
15526  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
15527  *                           Py_ssize_t dim) except NULL:
15528  *     cdef Py_ssize_t shape, stride, suboffset = -1
15529  */
15530 
15531   /* function exit code */
15532   __pyx_L1_error:;
15533   __Pyx_XDECREF(__pyx_t_3);
15534   __Pyx_XDECREF(__pyx_t_4);
15535   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
15536   __pyx_r = NULL;
15537   __pyx_L0:;
15538   __Pyx_RefNannyFinishContext();
15539   return __pyx_r;
15540 }
15541 
15542 /* "View.MemoryView":939
15543  *
15544  * @cname('__pyx_memslice_transpose')
15545  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
15546  *     cdef int ndim = memslice.memview.view.ndim
15547  *
15548  */
15549 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)15550 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
15551   int __pyx_v_ndim;
15552   Py_ssize_t *__pyx_v_shape;
15553   Py_ssize_t *__pyx_v_strides;
15554   int __pyx_v_i;
15555   int __pyx_v_j;
15556   int __pyx_r;
15557   int __pyx_t_1;
15558   Py_ssize_t *__pyx_t_2;
15559   long __pyx_t_3;
15560   long __pyx_t_4;
15561   Py_ssize_t __pyx_t_5;
15562   Py_ssize_t __pyx_t_6;
15563   int __pyx_t_7;
15564   int __pyx_t_8;
15565   int __pyx_t_9;
15566 
15567   /* "View.MemoryView":940
15568  * @cname('__pyx_memslice_transpose')
15569  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
15570  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
15571  *
15572  *     cdef Py_ssize_t *shape = memslice.shape
15573  */
15574   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
15575   __pyx_v_ndim = __pyx_t_1;
15576 
15577   /* "View.MemoryView":942
15578  *     cdef int ndim = memslice.memview.view.ndim
15579  *
15580  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
15581  *     cdef Py_ssize_t *strides = memslice.strides
15582  *
15583  */
15584   __pyx_t_2 = __pyx_v_memslice->shape;
15585   __pyx_v_shape = __pyx_t_2;
15586 
15587   /* "View.MemoryView":943
15588  *
15589  *     cdef Py_ssize_t *shape = memslice.shape
15590  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
15591  *
15592  *
15593  */
15594   __pyx_t_2 = __pyx_v_memslice->strides;
15595   __pyx_v_strides = __pyx_t_2;
15596 
15597   /* "View.MemoryView":947
15598  *
15599  *     cdef int i, j
15600  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
15601  *         j = ndim - 1 - i
15602  *         strides[i], strides[j] = strides[j], strides[i]
15603  */
15604   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
15605   __pyx_t_4 = __pyx_t_3;
15606   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
15607     __pyx_v_i = __pyx_t_1;
15608 
15609     /* "View.MemoryView":948
15610  *     cdef int i, j
15611  *     for i in range(ndim / 2):
15612  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
15613  *         strides[i], strides[j] = strides[j], strides[i]
15614  *         shape[i], shape[j] = shape[j], shape[i]
15615  */
15616     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
15617 
15618     /* "View.MemoryView":949
15619  *     for i in range(ndim / 2):
15620  *         j = ndim - 1 - i
15621  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
15622  *         shape[i], shape[j] = shape[j], shape[i]
15623  *
15624  */
15625     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
15626     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
15627     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
15628     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
15629 
15630     /* "View.MemoryView":950
15631  *         j = ndim - 1 - i
15632  *         strides[i], strides[j] = strides[j], strides[i]
15633  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
15634  *
15635  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
15636  */
15637     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
15638     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
15639     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
15640     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
15641 
15642     /* "View.MemoryView":952
15643  *         shape[i], shape[j] = shape[j], shape[i]
15644  *
15645  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
15646  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
15647  *
15648  */
15649     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
15650     if (!__pyx_t_8) {
15651     } else {
15652       __pyx_t_7 = __pyx_t_8;
15653       goto __pyx_L6_bool_binop_done;
15654     }
15655     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
15656     __pyx_t_7 = __pyx_t_8;
15657     __pyx_L6_bool_binop_done:;
15658     if (__pyx_t_7) {
15659 
15660       /* "View.MemoryView":953
15661  *
15662  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
15663  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
15664  *
15665  *     return 1
15666  */
15667       __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(1, 953, __pyx_L1_error)
15668 
15669       /* "View.MemoryView":952
15670  *         shape[i], shape[j] = shape[j], shape[i]
15671  *
15672  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
15673  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
15674  *
15675  */
15676     }
15677   }
15678 
15679   /* "View.MemoryView":955
15680  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
15681  *
15682  *     return 1             # <<<<<<<<<<<<<<
15683  *
15684  *
15685  */
15686   __pyx_r = 1;
15687   goto __pyx_L0;
15688 
15689   /* "View.MemoryView":939
15690  *
15691  * @cname('__pyx_memslice_transpose')
15692  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
15693  *     cdef int ndim = memslice.memview.view.ndim
15694  *
15695  */
15696 
15697   /* function exit code */
15698   __pyx_L1_error:;
15699   {
15700     #ifdef WITH_THREAD
15701     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15702     #endif
15703     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15704     #ifdef WITH_THREAD
15705     __Pyx_PyGILState_Release(__pyx_gilstate_save);
15706     #endif
15707   }
15708   __pyx_r = 0;
15709   __pyx_L0:;
15710   return __pyx_r;
15711 }
15712 
15713 /* "View.MemoryView":972
15714  *     cdef int (*to_dtype_func)(char *, object) except 0
15715  *
15716  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
15717  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
15718  *
15719  */
15720 
15721 /* Python wrapper */
15722 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)15723 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
15724   __Pyx_RefNannyDeclarations
15725   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
15726   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
15727 
15728   /* function exit code */
15729   __Pyx_RefNannyFinishContext();
15730 }
15731 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)15732 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
15733   __Pyx_RefNannyDeclarations
15734   __Pyx_RefNannySetupContext("__dealloc__", 0);
15735 
15736   /* "View.MemoryView":973
15737  *
15738  *     def __dealloc__(self):
15739  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
15740  *
15741  *     cdef convert_item_to_object(self, char *itemp):
15742  */
15743   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
15744 
15745   /* "View.MemoryView":972
15746  *     cdef int (*to_dtype_func)(char *, object) except 0
15747  *
15748  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
15749  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
15750  *
15751  */
15752 
15753   /* function exit code */
15754   __Pyx_RefNannyFinishContext();
15755 }
15756 
15757 /* "View.MemoryView":975
15758  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
15759  *
15760  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
15761  *         if self.to_object_func != NULL:
15762  *             return self.to_object_func(itemp)
15763  */
15764 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)15765 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
15766   PyObject *__pyx_r = NULL;
15767   __Pyx_RefNannyDeclarations
15768   int __pyx_t_1;
15769   PyObject *__pyx_t_2 = NULL;
15770   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
15771 
15772   /* "View.MemoryView":976
15773  *
15774  *     cdef convert_item_to_object(self, char *itemp):
15775  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
15776  *             return self.to_object_func(itemp)
15777  *         else:
15778  */
15779   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
15780   if (__pyx_t_1) {
15781 
15782     /* "View.MemoryView":977
15783  *     cdef convert_item_to_object(self, char *itemp):
15784  *         if self.to_object_func != NULL:
15785  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
15786  *         else:
15787  *             return memoryview.convert_item_to_object(self, itemp)
15788  */
15789     __Pyx_XDECREF(__pyx_r);
15790     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 977, __pyx_L1_error)
15791     __Pyx_GOTREF(__pyx_t_2);
15792     __pyx_r = __pyx_t_2;
15793     __pyx_t_2 = 0;
15794     goto __pyx_L0;
15795 
15796     /* "View.MemoryView":976
15797  *
15798  *     cdef convert_item_to_object(self, char *itemp):
15799  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
15800  *             return self.to_object_func(itemp)
15801  *         else:
15802  */
15803   }
15804 
15805   /* "View.MemoryView":979
15806  *             return self.to_object_func(itemp)
15807  *         else:
15808  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
15809  *
15810  *     cdef assign_item_from_object(self, char *itemp, object value):
15811  */
15812   /*else*/ {
15813     __Pyx_XDECREF(__pyx_r);
15814     __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(1, 979, __pyx_L1_error)
15815     __Pyx_GOTREF(__pyx_t_2);
15816     __pyx_r = __pyx_t_2;
15817     __pyx_t_2 = 0;
15818     goto __pyx_L0;
15819   }
15820 
15821   /* "View.MemoryView":975
15822  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
15823  *
15824  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
15825  *         if self.to_object_func != NULL:
15826  *             return self.to_object_func(itemp)
15827  */
15828 
15829   /* function exit code */
15830   __pyx_L1_error:;
15831   __Pyx_XDECREF(__pyx_t_2);
15832   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
15833   __pyx_r = 0;
15834   __pyx_L0:;
15835   __Pyx_XGIVEREF(__pyx_r);
15836   __Pyx_RefNannyFinishContext();
15837   return __pyx_r;
15838 }
15839 
15840 /* "View.MemoryView":981
15841  *             return memoryview.convert_item_to_object(self, itemp)
15842  *
15843  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
15844  *         if self.to_dtype_func != NULL:
15845  *             self.to_dtype_func(itemp, value)
15846  */
15847 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)15848 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
15849   PyObject *__pyx_r = NULL;
15850   __Pyx_RefNannyDeclarations
15851   int __pyx_t_1;
15852   int __pyx_t_2;
15853   PyObject *__pyx_t_3 = NULL;
15854   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
15855 
15856   /* "View.MemoryView":982
15857  *
15858  *     cdef assign_item_from_object(self, char *itemp, object value):
15859  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
15860  *             self.to_dtype_func(itemp, value)
15861  *         else:
15862  */
15863   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
15864   if (__pyx_t_1) {
15865 
15866     /* "View.MemoryView":983
15867  *     cdef assign_item_from_object(self, char *itemp, object value):
15868  *         if self.to_dtype_func != NULL:
15869  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
15870  *         else:
15871  *             memoryview.assign_item_from_object(self, itemp, value)
15872  */
15873     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 983, __pyx_L1_error)
15874 
15875     /* "View.MemoryView":982
15876  *
15877  *     cdef assign_item_from_object(self, char *itemp, object value):
15878  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
15879  *             self.to_dtype_func(itemp, value)
15880  *         else:
15881  */
15882     goto __pyx_L3;
15883   }
15884 
15885   /* "View.MemoryView":985
15886  *             self.to_dtype_func(itemp, value)
15887  *         else:
15888  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
15889  *
15890  *     @property
15891  */
15892   /*else*/ {
15893     __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(1, 985, __pyx_L1_error)
15894     __Pyx_GOTREF(__pyx_t_3);
15895     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15896   }
15897   __pyx_L3:;
15898 
15899   /* "View.MemoryView":981
15900  *             return memoryview.convert_item_to_object(self, itemp)
15901  *
15902  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
15903  *         if self.to_dtype_func != NULL:
15904  *             self.to_dtype_func(itemp, value)
15905  */
15906 
15907   /* function exit code */
15908   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15909   goto __pyx_L0;
15910   __pyx_L1_error:;
15911   __Pyx_XDECREF(__pyx_t_3);
15912   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
15913   __pyx_r = 0;
15914   __pyx_L0:;
15915   __Pyx_XGIVEREF(__pyx_r);
15916   __Pyx_RefNannyFinishContext();
15917   return __pyx_r;
15918 }
15919 
15920 /* "View.MemoryView":988
15921  *
15922  *     @property
15923  *     def base(self):             # <<<<<<<<<<<<<<
15924  *         return self.from_object
15925  *
15926  */
15927 
15928 /* Python wrapper */
15929 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject * __pyx_v_self)15930 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
15931   PyObject *__pyx_r = 0;
15932   __Pyx_RefNannyDeclarations
15933   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15934   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
15935 
15936   /* function exit code */
15937   __Pyx_RefNannyFinishContext();
15938   return __pyx_r;
15939 }
15940 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)15941 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
15942   PyObject *__pyx_r = NULL;
15943   __Pyx_RefNannyDeclarations
15944   __Pyx_RefNannySetupContext("__get__", 0);
15945 
15946   /* "View.MemoryView":989
15947  *     @property
15948  *     def base(self):
15949  *         return self.from_object             # <<<<<<<<<<<<<<
15950  *
15951  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
15952  */
15953   __Pyx_XDECREF(__pyx_r);
15954   __Pyx_INCREF(__pyx_v_self->from_object);
15955   __pyx_r = __pyx_v_self->from_object;
15956   goto __pyx_L0;
15957 
15958   /* "View.MemoryView":988
15959  *
15960  *     @property
15961  *     def base(self):             # <<<<<<<<<<<<<<
15962  *         return self.from_object
15963  *
15964  */
15965 
15966   /* function exit code */
15967   __pyx_L0:;
15968   __Pyx_XGIVEREF(__pyx_r);
15969   __Pyx_RefNannyFinishContext();
15970   return __pyx_r;
15971 }
15972 
15973 /* "(tree fragment)":1
15974  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15975  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15976  * def __setstate_cython__(self, __pyx_state):
15977  */
15978 
15979 /* Python wrapper */
15980 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)15981 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15982   PyObject *__pyx_r = 0;
15983   __Pyx_RefNannyDeclarations
15984   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
15985   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
15986 
15987   /* function exit code */
15988   __Pyx_RefNannyFinishContext();
15989   return __pyx_r;
15990 }
15991 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)15992 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
15993   PyObject *__pyx_r = NULL;
15994   __Pyx_RefNannyDeclarations
15995   PyObject *__pyx_t_1 = NULL;
15996   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
15997 
15998   /* "(tree fragment)":2
15999  * def __reduce_cython__(self):
16000  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16001  * def __setstate_cython__(self, __pyx_state):
16002  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16003  */
16004   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
16005   __Pyx_GOTREF(__pyx_t_1);
16006   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16007   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16008   __PYX_ERR(1, 2, __pyx_L1_error)
16009 
16010   /* "(tree fragment)":1
16011  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
16012  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16013  * def __setstate_cython__(self, __pyx_state):
16014  */
16015 
16016   /* function exit code */
16017   __pyx_L1_error:;
16018   __Pyx_XDECREF(__pyx_t_1);
16019   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16020   __pyx_r = NULL;
16021   __Pyx_XGIVEREF(__pyx_r);
16022   __Pyx_RefNannyFinishContext();
16023   return __pyx_r;
16024 }
16025 
16026 /* "(tree fragment)":3
16027  * def __reduce_cython__(self):
16028  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16029  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16030  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16031  */
16032 
16033 /* Python wrapper */
16034 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)16035 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16036   PyObject *__pyx_r = 0;
16037   __Pyx_RefNannyDeclarations
16038   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
16039   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16040 
16041   /* function exit code */
16042   __Pyx_RefNannyFinishContext();
16043   return __pyx_r;
16044 }
16045 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)16046 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
16047   PyObject *__pyx_r = NULL;
16048   __Pyx_RefNannyDeclarations
16049   PyObject *__pyx_t_1 = NULL;
16050   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
16051 
16052   /* "(tree fragment)":4
16053  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16054  * def __setstate_cython__(self, __pyx_state):
16055  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16056  */
16057   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
16058   __Pyx_GOTREF(__pyx_t_1);
16059   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16060   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16061   __PYX_ERR(1, 4, __pyx_L1_error)
16062 
16063   /* "(tree fragment)":3
16064  * def __reduce_cython__(self):
16065  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16066  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16067  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16068  */
16069 
16070   /* function exit code */
16071   __pyx_L1_error:;
16072   __Pyx_XDECREF(__pyx_t_1);
16073   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16074   __pyx_r = NULL;
16075   __Pyx_XGIVEREF(__pyx_r);
16076   __Pyx_RefNannyFinishContext();
16077   return __pyx_r;
16078 }
16079 
16080 /* "View.MemoryView":995
16081  *
16082  * @cname('__pyx_memoryview_fromslice')
16083  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
16084  *                           int ndim,
16085  *                           object (*to_object_func)(char *),
16086  */
16087 
__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)16088 static 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) {
16089   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
16090   Py_ssize_t __pyx_v_suboffset;
16091   PyObject *__pyx_v_length = NULL;
16092   PyObject *__pyx_r = NULL;
16093   __Pyx_RefNannyDeclarations
16094   int __pyx_t_1;
16095   PyObject *__pyx_t_2 = NULL;
16096   PyObject *__pyx_t_3 = NULL;
16097   __Pyx_TypeInfo *__pyx_t_4;
16098   Py_buffer __pyx_t_5;
16099   Py_ssize_t *__pyx_t_6;
16100   Py_ssize_t *__pyx_t_7;
16101   Py_ssize_t *__pyx_t_8;
16102   Py_ssize_t __pyx_t_9;
16103   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
16104 
16105   /* "View.MemoryView":1003
16106  *     cdef _memoryviewslice result
16107  *
16108  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
16109  *         return None
16110  *
16111  */
16112   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
16113   if (__pyx_t_1) {
16114 
16115     /* "View.MemoryView":1004
16116  *
16117  *     if <PyObject *> memviewslice.memview == Py_None:
16118  *         return None             # <<<<<<<<<<<<<<
16119  *
16120  *
16121  */
16122     __Pyx_XDECREF(__pyx_r);
16123     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16124     goto __pyx_L0;
16125 
16126     /* "View.MemoryView":1003
16127  *     cdef _memoryviewslice result
16128  *
16129  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
16130  *         return None
16131  *
16132  */
16133   }
16134 
16135   /* "View.MemoryView":1009
16136  *
16137  *
16138  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
16139  *
16140  *     result.from_slice = memviewslice
16141  */
16142   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1009, __pyx_L1_error)
16143   __Pyx_GOTREF(__pyx_t_2);
16144   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1009, __pyx_L1_error)
16145   __Pyx_GOTREF(__pyx_t_3);
16146   __Pyx_INCREF(Py_None);
16147   __Pyx_GIVEREF(Py_None);
16148   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
16149   __Pyx_INCREF(__pyx_int_0);
16150   __Pyx_GIVEREF(__pyx_int_0);
16151   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
16152   __Pyx_GIVEREF(__pyx_t_2);
16153   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
16154   __pyx_t_2 = 0;
16155   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1009, __pyx_L1_error)
16156   __Pyx_GOTREF(__pyx_t_2);
16157   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16158   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
16159   __pyx_t_2 = 0;
16160 
16161   /* "View.MemoryView":1011
16162  *     result = _memoryviewslice(None, 0, dtype_is_object)
16163  *
16164  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
16165  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
16166  *
16167  */
16168   __pyx_v_result->from_slice = __pyx_v_memviewslice;
16169 
16170   /* "View.MemoryView":1012
16171  *
16172  *     result.from_slice = memviewslice
16173  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
16174  *
16175  *     result.from_object = (<memoryview> memviewslice.memview).base
16176  */
16177   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
16178 
16179   /* "View.MemoryView":1014
16180  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
16181  *
16182  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
16183  *     result.typeinfo = memviewslice.memview.typeinfo
16184  *
16185  */
16186   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error)
16187   __Pyx_GOTREF(__pyx_t_2);
16188   __Pyx_GIVEREF(__pyx_t_2);
16189   __Pyx_GOTREF(__pyx_v_result->from_object);
16190   __Pyx_DECREF(__pyx_v_result->from_object);
16191   __pyx_v_result->from_object = __pyx_t_2;
16192   __pyx_t_2 = 0;
16193 
16194   /* "View.MemoryView":1015
16195  *
16196  *     result.from_object = (<memoryview> memviewslice.memview).base
16197  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
16198  *
16199  *     result.view = memviewslice.memview.view
16200  */
16201   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
16202   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
16203 
16204   /* "View.MemoryView":1017
16205  *     result.typeinfo = memviewslice.memview.typeinfo
16206  *
16207  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
16208  *     result.view.buf = <void *> memviewslice.data
16209  *     result.view.ndim = ndim
16210  */
16211   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
16212   __pyx_v_result->__pyx_base.view = __pyx_t_5;
16213 
16214   /* "View.MemoryView":1018
16215  *
16216  *     result.view = memviewslice.memview.view
16217  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
16218  *     result.view.ndim = ndim
16219  *     (<__pyx_buffer *> &result.view).obj = Py_None
16220  */
16221   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
16222 
16223   /* "View.MemoryView":1019
16224  *     result.view = memviewslice.memview.view
16225  *     result.view.buf = <void *> memviewslice.data
16226  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
16227  *     (<__pyx_buffer *> &result.view).obj = Py_None
16228  *     Py_INCREF(Py_None)
16229  */
16230   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
16231 
16232   /* "View.MemoryView":1020
16233  *     result.view.buf = <void *> memviewslice.data
16234  *     result.view.ndim = ndim
16235  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
16236  *     Py_INCREF(Py_None)
16237  *
16238  */
16239   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
16240 
16241   /* "View.MemoryView":1021
16242  *     result.view.ndim = ndim
16243  *     (<__pyx_buffer *> &result.view).obj = Py_None
16244  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
16245  *
16246  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
16247  */
16248   Py_INCREF(Py_None);
16249 
16250   /* "View.MemoryView":1023
16251  *     Py_INCREF(Py_None)
16252  *
16253  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
16254  *         result.flags = PyBUF_RECORDS
16255  *     else:
16256  */
16257   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
16258   if (__pyx_t_1) {
16259 
16260     /* "View.MemoryView":1024
16261  *
16262  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
16263  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
16264  *     else:
16265  *         result.flags = PyBUF_RECORDS_RO
16266  */
16267     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
16268 
16269     /* "View.MemoryView":1023
16270  *     Py_INCREF(Py_None)
16271  *
16272  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
16273  *         result.flags = PyBUF_RECORDS
16274  *     else:
16275  */
16276     goto __pyx_L4;
16277   }
16278 
16279   /* "View.MemoryView":1026
16280  *         result.flags = PyBUF_RECORDS
16281  *     else:
16282  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
16283  *
16284  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
16285  */
16286   /*else*/ {
16287     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
16288   }
16289   __pyx_L4:;
16290 
16291   /* "View.MemoryView":1028
16292  *         result.flags = PyBUF_RECORDS_RO
16293  *
16294  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
16295  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
16296  *
16297  */
16298   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
16299 
16300   /* "View.MemoryView":1029
16301  *
16302  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
16303  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
16304  *
16305  *
16306  */
16307   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
16308 
16309   /* "View.MemoryView":1032
16310  *
16311  *
16312  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
16313  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16314  *         if suboffset >= 0:
16315  */
16316   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
16317 
16318   /* "View.MemoryView":1033
16319  *
16320  *     result.view.suboffsets = NULL
16321  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
16322  *         if suboffset >= 0:
16323  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16324  */
16325   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
16326   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16327     __pyx_t_6 = __pyx_t_8;
16328     __pyx_v_suboffset = (__pyx_t_6[0]);
16329 
16330     /* "View.MemoryView":1034
16331  *     result.view.suboffsets = NULL
16332  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16333  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
16334  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16335  *             break
16336  */
16337     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
16338     if (__pyx_t_1) {
16339 
16340       /* "View.MemoryView":1035
16341  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16342  *         if suboffset >= 0:
16343  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
16344  *             break
16345  *
16346  */
16347       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
16348 
16349       /* "View.MemoryView":1036
16350  *         if suboffset >= 0:
16351  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16352  *             break             # <<<<<<<<<<<<<<
16353  *
16354  *     result.view.len = result.view.itemsize
16355  */
16356       goto __pyx_L6_break;
16357 
16358       /* "View.MemoryView":1034
16359  *     result.view.suboffsets = NULL
16360  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16361  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
16362  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16363  *             break
16364  */
16365     }
16366   }
16367   __pyx_L6_break:;
16368 
16369   /* "View.MemoryView":1038
16370  *             break
16371  *
16372  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
16373  *     for length in result.view.shape[:ndim]:
16374  *         result.view.len *= length
16375  */
16376   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
16377   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16378 
16379   /* "View.MemoryView":1039
16380  *
16381  *     result.view.len = result.view.itemsize
16382  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
16383  *         result.view.len *= length
16384  *
16385  */
16386   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
16387   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16388     __pyx_t_6 = __pyx_t_8;
16389     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1039, __pyx_L1_error)
16390     __Pyx_GOTREF(__pyx_t_2);
16391     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
16392     __pyx_t_2 = 0;
16393 
16394     /* "View.MemoryView":1040
16395  *     result.view.len = result.view.itemsize
16396  *     for length in result.view.shape[:ndim]:
16397  *         result.view.len *= length             # <<<<<<<<<<<<<<
16398  *
16399  *     result.to_object_func = to_object_func
16400  */
16401     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1040, __pyx_L1_error)
16402     __Pyx_GOTREF(__pyx_t_2);
16403     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1040, __pyx_L1_error)
16404     __Pyx_GOTREF(__pyx_t_3);
16405     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16406     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1040, __pyx_L1_error)
16407     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16408     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16409   }
16410 
16411   /* "View.MemoryView":1042
16412  *         result.view.len *= length
16413  *
16414  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
16415  *     result.to_dtype_func = to_dtype_func
16416  *
16417  */
16418   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
16419 
16420   /* "View.MemoryView":1043
16421  *
16422  *     result.to_object_func = to_object_func
16423  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
16424  *
16425  *     return result
16426  */
16427   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
16428 
16429   /* "View.MemoryView":1045
16430  *     result.to_dtype_func = to_dtype_func
16431  *
16432  *     return result             # <<<<<<<<<<<<<<
16433  *
16434  * @cname('__pyx_memoryview_get_slice_from_memoryview')
16435  */
16436   __Pyx_XDECREF(__pyx_r);
16437   __Pyx_INCREF(((PyObject *)__pyx_v_result));
16438   __pyx_r = ((PyObject *)__pyx_v_result);
16439   goto __pyx_L0;
16440 
16441   /* "View.MemoryView":995
16442  *
16443  * @cname('__pyx_memoryview_fromslice')
16444  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
16445  *                           int ndim,
16446  *                           object (*to_object_func)(char *),
16447  */
16448 
16449   /* function exit code */
16450   __pyx_L1_error:;
16451   __Pyx_XDECREF(__pyx_t_2);
16452   __Pyx_XDECREF(__pyx_t_3);
16453   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16454   __pyx_r = 0;
16455   __pyx_L0:;
16456   __Pyx_XDECREF((PyObject *)__pyx_v_result);
16457   __Pyx_XDECREF(__pyx_v_length);
16458   __Pyx_XGIVEREF(__pyx_r);
16459   __Pyx_RefNannyFinishContext();
16460   return __pyx_r;
16461 }
16462 
16463 /* "View.MemoryView":1048
16464  *
16465  * @cname('__pyx_memoryview_get_slice_from_memoryview')
16466  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
16467  *                                                    __Pyx_memviewslice *mslice):
16468  *     cdef _memoryviewslice obj
16469  */
16470 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)16471 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
16472   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
16473   __Pyx_memviewslice *__pyx_r;
16474   __Pyx_RefNannyDeclarations
16475   int __pyx_t_1;
16476   int __pyx_t_2;
16477   PyObject *__pyx_t_3 = NULL;
16478   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
16479 
16480   /* "View.MemoryView":1051
16481  *                                                    __Pyx_memviewslice *mslice):
16482  *     cdef _memoryviewslice obj
16483  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16484  *         obj = memview
16485  *         return &obj.from_slice
16486  */
16487   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16488   __pyx_t_2 = (__pyx_t_1 != 0);
16489   if (__pyx_t_2) {
16490 
16491     /* "View.MemoryView":1052
16492  *     cdef _memoryviewslice obj
16493  *     if isinstance(memview, _memoryviewslice):
16494  *         obj = memview             # <<<<<<<<<<<<<<
16495  *         return &obj.from_slice
16496  *     else:
16497  */
16498     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1052, __pyx_L1_error)
16499     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
16500     __Pyx_INCREF(__pyx_t_3);
16501     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
16502     __pyx_t_3 = 0;
16503 
16504     /* "View.MemoryView":1053
16505  *     if isinstance(memview, _memoryviewslice):
16506  *         obj = memview
16507  *         return &obj.from_slice             # <<<<<<<<<<<<<<
16508  *     else:
16509  *         slice_copy(memview, mslice)
16510  */
16511     __pyx_r = (&__pyx_v_obj->from_slice);
16512     goto __pyx_L0;
16513 
16514     /* "View.MemoryView":1051
16515  *                                                    __Pyx_memviewslice *mslice):
16516  *     cdef _memoryviewslice obj
16517  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16518  *         obj = memview
16519  *         return &obj.from_slice
16520  */
16521   }
16522 
16523   /* "View.MemoryView":1055
16524  *         return &obj.from_slice
16525  *     else:
16526  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
16527  *         return mslice
16528  *
16529  */
16530   /*else*/ {
16531     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
16532 
16533     /* "View.MemoryView":1056
16534  *     else:
16535  *         slice_copy(memview, mslice)
16536  *         return mslice             # <<<<<<<<<<<<<<
16537  *
16538  * @cname('__pyx_memoryview_slice_copy')
16539  */
16540     __pyx_r = __pyx_v_mslice;
16541     goto __pyx_L0;
16542   }
16543 
16544   /* "View.MemoryView":1048
16545  *
16546  * @cname('__pyx_memoryview_get_slice_from_memoryview')
16547  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
16548  *                                                    __Pyx_memviewslice *mslice):
16549  *     cdef _memoryviewslice obj
16550  */
16551 
16552   /* function exit code */
16553   __pyx_L1_error:;
16554   __Pyx_XDECREF(__pyx_t_3);
16555   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
16556   __pyx_r = 0;
16557   __pyx_L0:;
16558   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
16559   __Pyx_RefNannyFinishContext();
16560   return __pyx_r;
16561 }
16562 
16563 /* "View.MemoryView":1059
16564  *
16565  * @cname('__pyx_memoryview_slice_copy')
16566  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
16567  *     cdef int dim
16568  *     cdef (Py_ssize_t*) shape, strides, suboffsets
16569  */
16570 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)16571 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
16572   int __pyx_v_dim;
16573   Py_ssize_t *__pyx_v_shape;
16574   Py_ssize_t *__pyx_v_strides;
16575   Py_ssize_t *__pyx_v_suboffsets;
16576   __Pyx_RefNannyDeclarations
16577   Py_ssize_t *__pyx_t_1;
16578   int __pyx_t_2;
16579   int __pyx_t_3;
16580   int __pyx_t_4;
16581   Py_ssize_t __pyx_t_5;
16582   __Pyx_RefNannySetupContext("slice_copy", 0);
16583 
16584   /* "View.MemoryView":1063
16585  *     cdef (Py_ssize_t*) shape, strides, suboffsets
16586  *
16587  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
16588  *     strides = memview.view.strides
16589  *     suboffsets = memview.view.suboffsets
16590  */
16591   __pyx_t_1 = __pyx_v_memview->view.shape;
16592   __pyx_v_shape = __pyx_t_1;
16593 
16594   /* "View.MemoryView":1064
16595  *
16596  *     shape = memview.view.shape
16597  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
16598  *     suboffsets = memview.view.suboffsets
16599  *
16600  */
16601   __pyx_t_1 = __pyx_v_memview->view.strides;
16602   __pyx_v_strides = __pyx_t_1;
16603 
16604   /* "View.MemoryView":1065
16605  *     shape = memview.view.shape
16606  *     strides = memview.view.strides
16607  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
16608  *
16609  *     dst.memview = <__pyx_memoryview *> memview
16610  */
16611   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
16612   __pyx_v_suboffsets = __pyx_t_1;
16613 
16614   /* "View.MemoryView":1067
16615  *     suboffsets = memview.view.suboffsets
16616  *
16617  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
16618  *     dst.data = <char *> memview.view.buf
16619  *
16620  */
16621   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
16622 
16623   /* "View.MemoryView":1068
16624  *
16625  *     dst.memview = <__pyx_memoryview *> memview
16626  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
16627  *
16628  *     for dim in range(memview.view.ndim):
16629  */
16630   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
16631 
16632   /* "View.MemoryView":1070
16633  *     dst.data = <char *> memview.view.buf
16634  *
16635  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
16636  *         dst.shape[dim] = shape[dim]
16637  *         dst.strides[dim] = strides[dim]
16638  */
16639   __pyx_t_2 = __pyx_v_memview->view.ndim;
16640   __pyx_t_3 = __pyx_t_2;
16641   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16642     __pyx_v_dim = __pyx_t_4;
16643 
16644     /* "View.MemoryView":1071
16645  *
16646  *     for dim in range(memview.view.ndim):
16647  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
16648  *         dst.strides[dim] = strides[dim]
16649  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
16650  */
16651     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
16652 
16653     /* "View.MemoryView":1072
16654  *     for dim in range(memview.view.ndim):
16655  *         dst.shape[dim] = shape[dim]
16656  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
16657  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
16658  *
16659  */
16660     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
16661 
16662     /* "View.MemoryView":1073
16663  *         dst.shape[dim] = shape[dim]
16664  *         dst.strides[dim] = strides[dim]
16665  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
16666  *
16667  * @cname('__pyx_memoryview_copy_object')
16668  */
16669     if ((__pyx_v_suboffsets != 0)) {
16670       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
16671     } else {
16672       __pyx_t_5 = -1L;
16673     }
16674     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
16675   }
16676 
16677   /* "View.MemoryView":1059
16678  *
16679  * @cname('__pyx_memoryview_slice_copy')
16680  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
16681  *     cdef int dim
16682  *     cdef (Py_ssize_t*) shape, strides, suboffsets
16683  */
16684 
16685   /* function exit code */
16686   __Pyx_RefNannyFinishContext();
16687 }
16688 
16689 /* "View.MemoryView":1076
16690  *
16691  * @cname('__pyx_memoryview_copy_object')
16692  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
16693  *     "Create a new memoryview object"
16694  *     cdef __Pyx_memviewslice memviewslice
16695  */
16696 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)16697 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
16698   __Pyx_memviewslice __pyx_v_memviewslice;
16699   PyObject *__pyx_r = NULL;
16700   __Pyx_RefNannyDeclarations
16701   PyObject *__pyx_t_1 = NULL;
16702   __Pyx_RefNannySetupContext("memoryview_copy", 0);
16703 
16704   /* "View.MemoryView":1079
16705  *     "Create a new memoryview object"
16706  *     cdef __Pyx_memviewslice memviewslice
16707  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
16708  *     return memoryview_copy_from_slice(memview, &memviewslice)
16709  *
16710  */
16711   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
16712 
16713   /* "View.MemoryView":1080
16714  *     cdef __Pyx_memviewslice memviewslice
16715  *     slice_copy(memview, &memviewslice)
16716  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
16717  *
16718  * @cname('__pyx_memoryview_copy_object_from_slice')
16719  */
16720   __Pyx_XDECREF(__pyx_r);
16721   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1080, __pyx_L1_error)
16722   __Pyx_GOTREF(__pyx_t_1);
16723   __pyx_r = __pyx_t_1;
16724   __pyx_t_1 = 0;
16725   goto __pyx_L0;
16726 
16727   /* "View.MemoryView":1076
16728  *
16729  * @cname('__pyx_memoryview_copy_object')
16730  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
16731  *     "Create a new memoryview object"
16732  *     cdef __Pyx_memviewslice memviewslice
16733  */
16734 
16735   /* function exit code */
16736   __pyx_L1_error:;
16737   __Pyx_XDECREF(__pyx_t_1);
16738   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
16739   __pyx_r = 0;
16740   __pyx_L0:;
16741   __Pyx_XGIVEREF(__pyx_r);
16742   __Pyx_RefNannyFinishContext();
16743   return __pyx_r;
16744 }
16745 
16746 /* "View.MemoryView":1083
16747  *
16748  * @cname('__pyx_memoryview_copy_object_from_slice')
16749  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
16750  *     """
16751  *     Create a new memoryview object from a given memoryview object and slice.
16752  */
16753 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)16754 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
16755   PyObject *(*__pyx_v_to_object_func)(char *);
16756   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
16757   PyObject *__pyx_r = NULL;
16758   __Pyx_RefNannyDeclarations
16759   int __pyx_t_1;
16760   int __pyx_t_2;
16761   PyObject *(*__pyx_t_3)(char *);
16762   int (*__pyx_t_4)(char *, PyObject *);
16763   PyObject *__pyx_t_5 = NULL;
16764   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
16765 
16766   /* "View.MemoryView":1090
16767  *     cdef int (*to_dtype_func)(char *, object) except 0
16768  *
16769  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16770  *         to_object_func = (<_memoryviewslice> memview).to_object_func
16771  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
16772  */
16773   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16774   __pyx_t_2 = (__pyx_t_1 != 0);
16775   if (__pyx_t_2) {
16776 
16777     /* "View.MemoryView":1091
16778  *
16779  *     if isinstance(memview, _memoryviewslice):
16780  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
16781  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
16782  *     else:
16783  */
16784     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
16785     __pyx_v_to_object_func = __pyx_t_3;
16786 
16787     /* "View.MemoryView":1092
16788  *     if isinstance(memview, _memoryviewslice):
16789  *         to_object_func = (<_memoryviewslice> memview).to_object_func
16790  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
16791  *     else:
16792  *         to_object_func = NULL
16793  */
16794     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
16795     __pyx_v_to_dtype_func = __pyx_t_4;
16796 
16797     /* "View.MemoryView":1090
16798  *     cdef int (*to_dtype_func)(char *, object) except 0
16799  *
16800  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16801  *         to_object_func = (<_memoryviewslice> memview).to_object_func
16802  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
16803  */
16804     goto __pyx_L3;
16805   }
16806 
16807   /* "View.MemoryView":1094
16808  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
16809  *     else:
16810  *         to_object_func = NULL             # <<<<<<<<<<<<<<
16811  *         to_dtype_func = NULL
16812  *
16813  */
16814   /*else*/ {
16815     __pyx_v_to_object_func = NULL;
16816 
16817     /* "View.MemoryView":1095
16818  *     else:
16819  *         to_object_func = NULL
16820  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
16821  *
16822  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
16823  */
16824     __pyx_v_to_dtype_func = NULL;
16825   }
16826   __pyx_L3:;
16827 
16828   /* "View.MemoryView":1097
16829  *         to_dtype_func = NULL
16830  *
16831  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
16832  *                                 to_object_func, to_dtype_func,
16833  *                                 memview.dtype_is_object)
16834  */
16835   __Pyx_XDECREF(__pyx_r);
16836 
16837   /* "View.MemoryView":1099
16838  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
16839  *                                 to_object_func, to_dtype_func,
16840  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
16841  *
16842  *
16843  */
16844   __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(1, 1097, __pyx_L1_error)
16845   __Pyx_GOTREF(__pyx_t_5);
16846   __pyx_r = __pyx_t_5;
16847   __pyx_t_5 = 0;
16848   goto __pyx_L0;
16849 
16850   /* "View.MemoryView":1083
16851  *
16852  * @cname('__pyx_memoryview_copy_object_from_slice')
16853  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
16854  *     """
16855  *     Create a new memoryview object from a given memoryview object and slice.
16856  */
16857 
16858   /* function exit code */
16859   __pyx_L1_error:;
16860   __Pyx_XDECREF(__pyx_t_5);
16861   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16862   __pyx_r = 0;
16863   __pyx_L0:;
16864   __Pyx_XGIVEREF(__pyx_r);
16865   __Pyx_RefNannyFinishContext();
16866   return __pyx_r;
16867 }
16868 
16869 /* "View.MemoryView":1105
16870  *
16871  *
16872  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
16873  *     if arg < 0:
16874  *         return -arg
16875  */
16876 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)16877 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
16878   Py_ssize_t __pyx_r;
16879   int __pyx_t_1;
16880 
16881   /* "View.MemoryView":1106
16882  *
16883  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
16884  *     if arg < 0:             # <<<<<<<<<<<<<<
16885  *         return -arg
16886  *     else:
16887  */
16888   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
16889   if (__pyx_t_1) {
16890 
16891     /* "View.MemoryView":1107
16892  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
16893  *     if arg < 0:
16894  *         return -arg             # <<<<<<<<<<<<<<
16895  *     else:
16896  *         return arg
16897  */
16898     __pyx_r = (-__pyx_v_arg);
16899     goto __pyx_L0;
16900 
16901     /* "View.MemoryView":1106
16902  *
16903  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
16904  *     if arg < 0:             # <<<<<<<<<<<<<<
16905  *         return -arg
16906  *     else:
16907  */
16908   }
16909 
16910   /* "View.MemoryView":1109
16911  *         return -arg
16912  *     else:
16913  *         return arg             # <<<<<<<<<<<<<<
16914  *
16915  * @cname('__pyx_get_best_slice_order')
16916  */
16917   /*else*/ {
16918     __pyx_r = __pyx_v_arg;
16919     goto __pyx_L0;
16920   }
16921 
16922   /* "View.MemoryView":1105
16923  *
16924  *
16925  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
16926  *     if arg < 0:
16927  *         return -arg
16928  */
16929 
16930   /* function exit code */
16931   __pyx_L0:;
16932   return __pyx_r;
16933 }
16934 
16935 /* "View.MemoryView":1112
16936  *
16937  * @cname('__pyx_get_best_slice_order')
16938  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
16939  *     """
16940  *     Figure out the best memory access order for a given slice.
16941  */
16942 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)16943 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
16944   int __pyx_v_i;
16945   Py_ssize_t __pyx_v_c_stride;
16946   Py_ssize_t __pyx_v_f_stride;
16947   char __pyx_r;
16948   int __pyx_t_1;
16949   int __pyx_t_2;
16950   int __pyx_t_3;
16951   int __pyx_t_4;
16952 
16953   /* "View.MemoryView":1117
16954  *     """
16955  *     cdef int i
16956  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
16957  *     cdef Py_ssize_t f_stride = 0
16958  *
16959  */
16960   __pyx_v_c_stride = 0;
16961 
16962   /* "View.MemoryView":1118
16963  *     cdef int i
16964  *     cdef Py_ssize_t c_stride = 0
16965  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
16966  *
16967  *     for i in range(ndim - 1, -1, -1):
16968  */
16969   __pyx_v_f_stride = 0;
16970 
16971   /* "View.MemoryView":1120
16972  *     cdef Py_ssize_t f_stride = 0
16973  *
16974  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
16975  *         if mslice.shape[i] > 1:
16976  *             c_stride = mslice.strides[i]
16977  */
16978   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
16979     __pyx_v_i = __pyx_t_1;
16980 
16981     /* "View.MemoryView":1121
16982  *
16983  *     for i in range(ndim - 1, -1, -1):
16984  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
16985  *             c_stride = mslice.strides[i]
16986  *             break
16987  */
16988     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
16989     if (__pyx_t_2) {
16990 
16991       /* "View.MemoryView":1122
16992  *     for i in range(ndim - 1, -1, -1):
16993  *         if mslice.shape[i] > 1:
16994  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
16995  *             break
16996  *
16997  */
16998       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
16999 
17000       /* "View.MemoryView":1123
17001  *         if mslice.shape[i] > 1:
17002  *             c_stride = mslice.strides[i]
17003  *             break             # <<<<<<<<<<<<<<
17004  *
17005  *     for i in range(ndim):
17006  */
17007       goto __pyx_L4_break;
17008 
17009       /* "View.MemoryView":1121
17010  *
17011  *     for i in range(ndim - 1, -1, -1):
17012  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17013  *             c_stride = mslice.strides[i]
17014  *             break
17015  */
17016     }
17017   }
17018   __pyx_L4_break:;
17019 
17020   /* "View.MemoryView":1125
17021  *             break
17022  *
17023  *     for i in range(ndim):             # <<<<<<<<<<<<<<
17024  *         if mslice.shape[i] > 1:
17025  *             f_stride = mslice.strides[i]
17026  */
17027   __pyx_t_1 = __pyx_v_ndim;
17028   __pyx_t_3 = __pyx_t_1;
17029   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17030     __pyx_v_i = __pyx_t_4;
17031 
17032     /* "View.MemoryView":1126
17033  *
17034  *     for i in range(ndim):
17035  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17036  *             f_stride = mslice.strides[i]
17037  *             break
17038  */
17039     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17040     if (__pyx_t_2) {
17041 
17042       /* "View.MemoryView":1127
17043  *     for i in range(ndim):
17044  *         if mslice.shape[i] > 1:
17045  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
17046  *             break
17047  *
17048  */
17049       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17050 
17051       /* "View.MemoryView":1128
17052  *         if mslice.shape[i] > 1:
17053  *             f_stride = mslice.strides[i]
17054  *             break             # <<<<<<<<<<<<<<
17055  *
17056  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
17057  */
17058       goto __pyx_L7_break;
17059 
17060       /* "View.MemoryView":1126
17061  *
17062  *     for i in range(ndim):
17063  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17064  *             f_stride = mslice.strides[i]
17065  *             break
17066  */
17067     }
17068   }
17069   __pyx_L7_break:;
17070 
17071   /* "View.MemoryView":1130
17072  *             break
17073  *
17074  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
17075  *         return 'C'
17076  *     else:
17077  */
17078   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
17079   if (__pyx_t_2) {
17080 
17081     /* "View.MemoryView":1131
17082  *
17083  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
17084  *         return 'C'             # <<<<<<<<<<<<<<
17085  *     else:
17086  *         return 'F'
17087  */
17088     __pyx_r = 'C';
17089     goto __pyx_L0;
17090 
17091     /* "View.MemoryView":1130
17092  *             break
17093  *
17094  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
17095  *         return 'C'
17096  *     else:
17097  */
17098   }
17099 
17100   /* "View.MemoryView":1133
17101  *         return 'C'
17102  *     else:
17103  *         return 'F'             # <<<<<<<<<<<<<<
17104  *
17105  * @cython.cdivision(True)
17106  */
17107   /*else*/ {
17108     __pyx_r = 'F';
17109     goto __pyx_L0;
17110   }
17111 
17112   /* "View.MemoryView":1112
17113  *
17114  * @cname('__pyx_get_best_slice_order')
17115  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
17116  *     """
17117  *     Figure out the best memory access order for a given slice.
17118  */
17119 
17120   /* function exit code */
17121   __pyx_L0:;
17122   return __pyx_r;
17123 }
17124 
17125 /* "View.MemoryView":1136
17126  *
17127  * @cython.cdivision(True)
17128  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
17129  *                                    char *dst_data, Py_ssize_t *dst_strides,
17130  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
17131  */
17132 
_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)17133 static 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) {
17134   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17135   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
17136   Py_ssize_t __pyx_v_dst_extent;
17137   Py_ssize_t __pyx_v_src_stride;
17138   Py_ssize_t __pyx_v_dst_stride;
17139   int __pyx_t_1;
17140   int __pyx_t_2;
17141   int __pyx_t_3;
17142   Py_ssize_t __pyx_t_4;
17143   Py_ssize_t __pyx_t_5;
17144   Py_ssize_t __pyx_t_6;
17145 
17146   /* "View.MemoryView":1143
17147  *
17148  *     cdef Py_ssize_t i
17149  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
17150  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17151  *     cdef Py_ssize_t src_stride = src_strides[0]
17152  */
17153   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
17154 
17155   /* "View.MemoryView":1144
17156  *     cdef Py_ssize_t i
17157  *     cdef Py_ssize_t src_extent = src_shape[0]
17158  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
17159  *     cdef Py_ssize_t src_stride = src_strides[0]
17160  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17161  */
17162   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
17163 
17164   /* "View.MemoryView":1145
17165  *     cdef Py_ssize_t src_extent = src_shape[0]
17166  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17167  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
17168  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17169  *
17170  */
17171   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
17172 
17173   /* "View.MemoryView":1146
17174  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17175  *     cdef Py_ssize_t src_stride = src_strides[0]
17176  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
17177  *
17178  *     if ndim == 1:
17179  */
17180   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
17181 
17182   /* "View.MemoryView":1148
17183  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17184  *
17185  *     if ndim == 1:             # <<<<<<<<<<<<<<
17186  *        if (src_stride > 0 and dst_stride > 0 and
17187  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17188  */
17189   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17190   if (__pyx_t_1) {
17191 
17192     /* "View.MemoryView":1149
17193  *
17194  *     if ndim == 1:
17195  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17196  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17197  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17198  */
17199     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
17200     if (__pyx_t_2) {
17201     } else {
17202       __pyx_t_1 = __pyx_t_2;
17203       goto __pyx_L5_bool_binop_done;
17204     }
17205     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
17206     if (__pyx_t_2) {
17207     } else {
17208       __pyx_t_1 = __pyx_t_2;
17209       goto __pyx_L5_bool_binop_done;
17210     }
17211 
17212     /* "View.MemoryView":1150
17213  *     if ndim == 1:
17214  *        if (src_stride > 0 and dst_stride > 0 and
17215  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
17216  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17217  *        else:
17218  */
17219     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
17220     if (__pyx_t_2) {
17221       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
17222     }
17223     __pyx_t_3 = (__pyx_t_2 != 0);
17224     __pyx_t_1 = __pyx_t_3;
17225     __pyx_L5_bool_binop_done:;
17226 
17227     /* "View.MemoryView":1149
17228  *
17229  *     if ndim == 1:
17230  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17231  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17232  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17233  */
17234     if (__pyx_t_1) {
17235 
17236       /* "View.MemoryView":1151
17237  *        if (src_stride > 0 and dst_stride > 0 and
17238  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17239  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
17240  *        else:
17241  *            for i in range(dst_extent):
17242  */
17243       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
17244 
17245       /* "View.MemoryView":1149
17246  *
17247  *     if ndim == 1:
17248  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17249  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17250  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17251  */
17252       goto __pyx_L4;
17253     }
17254 
17255     /* "View.MemoryView":1153
17256  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17257  *        else:
17258  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
17259  *                memcpy(dst_data, src_data, itemsize)
17260  *                src_data += src_stride
17261  */
17262     /*else*/ {
17263       __pyx_t_4 = __pyx_v_dst_extent;
17264       __pyx_t_5 = __pyx_t_4;
17265       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17266         __pyx_v_i = __pyx_t_6;
17267 
17268         /* "View.MemoryView":1154
17269  *        else:
17270  *            for i in range(dst_extent):
17271  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
17272  *                src_data += src_stride
17273  *                dst_data += dst_stride
17274  */
17275         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
17276 
17277         /* "View.MemoryView":1155
17278  *            for i in range(dst_extent):
17279  *                memcpy(dst_data, src_data, itemsize)
17280  *                src_data += src_stride             # <<<<<<<<<<<<<<
17281  *                dst_data += dst_stride
17282  *     else:
17283  */
17284         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17285 
17286         /* "View.MemoryView":1156
17287  *                memcpy(dst_data, src_data, itemsize)
17288  *                src_data += src_stride
17289  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
17290  *     else:
17291  *         for i in range(dst_extent):
17292  */
17293         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17294       }
17295     }
17296     __pyx_L4:;
17297 
17298     /* "View.MemoryView":1148
17299  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17300  *
17301  *     if ndim == 1:             # <<<<<<<<<<<<<<
17302  *        if (src_stride > 0 and dst_stride > 0 and
17303  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17304  */
17305     goto __pyx_L3;
17306   }
17307 
17308   /* "View.MemoryView":1158
17309  *                dst_data += dst_stride
17310  *     else:
17311  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
17312  *             _copy_strided_to_strided(src_data, src_strides + 1,
17313  *                                      dst_data, dst_strides + 1,
17314  */
17315   /*else*/ {
17316     __pyx_t_4 = __pyx_v_dst_extent;
17317     __pyx_t_5 = __pyx_t_4;
17318     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17319       __pyx_v_i = __pyx_t_6;
17320 
17321       /* "View.MemoryView":1159
17322  *     else:
17323  *         for i in range(dst_extent):
17324  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
17325  *                                      dst_data, dst_strides + 1,
17326  *                                      src_shape + 1, dst_shape + 1,
17327  */
17328       _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);
17329 
17330       /* "View.MemoryView":1163
17331  *                                      src_shape + 1, dst_shape + 1,
17332  *                                      ndim - 1, itemsize)
17333  *             src_data += src_stride             # <<<<<<<<<<<<<<
17334  *             dst_data += dst_stride
17335  *
17336  */
17337       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17338 
17339       /* "View.MemoryView":1164
17340  *                                      ndim - 1, itemsize)
17341  *             src_data += src_stride
17342  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
17343  *
17344  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
17345  */
17346       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17347     }
17348   }
17349   __pyx_L3:;
17350 
17351   /* "View.MemoryView":1136
17352  *
17353  * @cython.cdivision(True)
17354  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
17355  *                                    char *dst_data, Py_ssize_t *dst_strides,
17356  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
17357  */
17358 
17359   /* function exit code */
17360 }
17361 
17362 /* "View.MemoryView":1166
17363  *             dst_data += dst_stride
17364  *
17365  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17366  *                                   __Pyx_memviewslice *dst,
17367  *                                   int ndim, size_t itemsize) nogil:
17368  */
17369 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)17370 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
17371 
17372   /* "View.MemoryView":1169
17373  *                                   __Pyx_memviewslice *dst,
17374  *                                   int ndim, size_t itemsize) nogil:
17375  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
17376  *                              src.shape, dst.shape, ndim, itemsize)
17377  *
17378  */
17379   _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);
17380 
17381   /* "View.MemoryView":1166
17382  *             dst_data += dst_stride
17383  *
17384  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17385  *                                   __Pyx_memviewslice *dst,
17386  *                                   int ndim, size_t itemsize) nogil:
17387  */
17388 
17389   /* function exit code */
17390 }
17391 
17392 /* "View.MemoryView":1173
17393  *
17394  * @cname('__pyx_memoryview_slice_get_size')
17395  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
17396  *     "Return the size of the memory occupied by the slice in number of bytes"
17397  *     cdef int i
17398  */
17399 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)17400 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
17401   int __pyx_v_i;
17402   Py_ssize_t __pyx_v_size;
17403   Py_ssize_t __pyx_r;
17404   Py_ssize_t __pyx_t_1;
17405   int __pyx_t_2;
17406   int __pyx_t_3;
17407   int __pyx_t_4;
17408 
17409   /* "View.MemoryView":1176
17410  *     "Return the size of the memory occupied by the slice in number of bytes"
17411  *     cdef int i
17412  *     cdef Py_ssize_t size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
17413  *
17414  *     for i in range(ndim):
17415  */
17416   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17417   __pyx_v_size = __pyx_t_1;
17418 
17419   /* "View.MemoryView":1178
17420  *     cdef Py_ssize_t size = src.memview.view.itemsize
17421  *
17422  *     for i in range(ndim):             # <<<<<<<<<<<<<<
17423  *         size *= src.shape[i]
17424  *
17425  */
17426   __pyx_t_2 = __pyx_v_ndim;
17427   __pyx_t_3 = __pyx_t_2;
17428   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17429     __pyx_v_i = __pyx_t_4;
17430 
17431     /* "View.MemoryView":1179
17432  *
17433  *     for i in range(ndim):
17434  *         size *= src.shape[i]             # <<<<<<<<<<<<<<
17435  *
17436  *     return size
17437  */
17438     __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i]));
17439   }
17440 
17441   /* "View.MemoryView":1181
17442  *         size *= src.shape[i]
17443  *
17444  *     return size             # <<<<<<<<<<<<<<
17445  *
17446  * @cname('__pyx_fill_contig_strides_array')
17447  */
17448   __pyx_r = __pyx_v_size;
17449   goto __pyx_L0;
17450 
17451   /* "View.MemoryView":1173
17452  *
17453  * @cname('__pyx_memoryview_slice_get_size')
17454  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
17455  *     "Return the size of the memory occupied by the slice in number of bytes"
17456  *     cdef int i
17457  */
17458 
17459   /* function exit code */
17460   __pyx_L0:;
17461   return __pyx_r;
17462 }
17463 
17464 /* "View.MemoryView":1184
17465  *
17466  * @cname('__pyx_fill_contig_strides_array')
17467  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
17468  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
17469  *                 int ndim, char order) nogil:
17470  */
17471 
__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)17472 static 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) {
17473   int __pyx_v_idx;
17474   Py_ssize_t __pyx_r;
17475   int __pyx_t_1;
17476   int __pyx_t_2;
17477   int __pyx_t_3;
17478   int __pyx_t_4;
17479 
17480   /* "View.MemoryView":1193
17481  *     cdef int idx
17482  *
17483  *     if order == 'F':             # <<<<<<<<<<<<<<
17484  *         for idx in range(ndim):
17485  *             strides[idx] = stride
17486  */
17487   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
17488   if (__pyx_t_1) {
17489 
17490     /* "View.MemoryView":1194
17491  *
17492  *     if order == 'F':
17493  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
17494  *             strides[idx] = stride
17495  *             stride = stride * shape[idx]
17496  */
17497     __pyx_t_2 = __pyx_v_ndim;
17498     __pyx_t_3 = __pyx_t_2;
17499     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17500       __pyx_v_idx = __pyx_t_4;
17501 
17502       /* "View.MemoryView":1195
17503  *     if order == 'F':
17504  *         for idx in range(ndim):
17505  *             strides[idx] = stride             # <<<<<<<<<<<<<<
17506  *             stride = stride * shape[idx]
17507  *     else:
17508  */
17509       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
17510 
17511       /* "View.MemoryView":1196
17512  *         for idx in range(ndim):
17513  *             strides[idx] = stride
17514  *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
17515  *     else:
17516  *         for idx in range(ndim - 1, -1, -1):
17517  */
17518       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
17519     }
17520 
17521     /* "View.MemoryView":1193
17522  *     cdef int idx
17523  *
17524  *     if order == 'F':             # <<<<<<<<<<<<<<
17525  *         for idx in range(ndim):
17526  *             strides[idx] = stride
17527  */
17528     goto __pyx_L3;
17529   }
17530 
17531   /* "View.MemoryView":1198
17532  *             stride = stride * shape[idx]
17533  *     else:
17534  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
17535  *             strides[idx] = stride
17536  *             stride = stride * shape[idx]
17537  */
17538   /*else*/ {
17539     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
17540       __pyx_v_idx = __pyx_t_2;
17541 
17542       /* "View.MemoryView":1199
17543  *     else:
17544  *         for idx in range(ndim - 1, -1, -1):
17545  *             strides[idx] = stride             # <<<<<<<<<<<<<<
17546  *             stride = stride * shape[idx]
17547  *
17548  */
17549       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
17550 
17551       /* "View.MemoryView":1200
17552  *         for idx in range(ndim - 1, -1, -1):
17553  *             strides[idx] = stride
17554  *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
17555  *
17556  *     return stride
17557  */
17558       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
17559     }
17560   }
17561   __pyx_L3:;
17562 
17563   /* "View.MemoryView":1202
17564  *             stride = stride * shape[idx]
17565  *
17566  *     return stride             # <<<<<<<<<<<<<<
17567  *
17568  * @cname('__pyx_memoryview_copy_data_to_temp')
17569  */
17570   __pyx_r = __pyx_v_stride;
17571   goto __pyx_L0;
17572 
17573   /* "View.MemoryView":1184
17574  *
17575  * @cname('__pyx_fill_contig_strides_array')
17576  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
17577  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
17578  *                 int ndim, char order) nogil:
17579  */
17580 
17581   /* function exit code */
17582   __pyx_L0:;
17583   return __pyx_r;
17584 }
17585 
17586 /* "View.MemoryView":1205
17587  *
17588  * @cname('__pyx_memoryview_copy_data_to_temp')
17589  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17590  *                              __Pyx_memviewslice *tmpslice,
17591  *                              char order,
17592  */
17593 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)17594 static 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) {
17595   int __pyx_v_i;
17596   void *__pyx_v_result;
17597   size_t __pyx_v_itemsize;
17598   size_t __pyx_v_size;
17599   void *__pyx_r;
17600   Py_ssize_t __pyx_t_1;
17601   int __pyx_t_2;
17602   int __pyx_t_3;
17603   struct __pyx_memoryview_obj *__pyx_t_4;
17604   int __pyx_t_5;
17605   int __pyx_t_6;
17606 
17607   /* "View.MemoryView":1216
17608  *     cdef void *result
17609  *
17610  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
17611  *     cdef size_t size = slice_get_size(src, ndim)
17612  *
17613  */
17614   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17615   __pyx_v_itemsize = __pyx_t_1;
17616 
17617   /* "View.MemoryView":1217
17618  *
17619  *     cdef size_t itemsize = src.memview.view.itemsize
17620  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
17621  *
17622  *     result = malloc(size)
17623  */
17624   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
17625 
17626   /* "View.MemoryView":1219
17627  *     cdef size_t size = slice_get_size(src, ndim)
17628  *
17629  *     result = malloc(size)             # <<<<<<<<<<<<<<
17630  *     if not result:
17631  *         _err(MemoryError, NULL)
17632  */
17633   __pyx_v_result = malloc(__pyx_v_size);
17634 
17635   /* "View.MemoryView":1220
17636  *
17637  *     result = malloc(size)
17638  *     if not result:             # <<<<<<<<<<<<<<
17639  *         _err(MemoryError, NULL)
17640  *
17641  */
17642   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
17643   if (__pyx_t_2) {
17644 
17645     /* "View.MemoryView":1221
17646  *     result = malloc(size)
17647  *     if not result:
17648  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
17649  *
17650  *
17651  */
17652     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error)
17653 
17654     /* "View.MemoryView":1220
17655  *
17656  *     result = malloc(size)
17657  *     if not result:             # <<<<<<<<<<<<<<
17658  *         _err(MemoryError, NULL)
17659  *
17660  */
17661   }
17662 
17663   /* "View.MemoryView":1224
17664  *
17665  *
17666  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
17667  *     tmpslice.memview = src.memview
17668  *     for i in range(ndim):
17669  */
17670   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
17671 
17672   /* "View.MemoryView":1225
17673  *
17674  *     tmpslice.data = <char *> result
17675  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
17676  *     for i in range(ndim):
17677  *         tmpslice.shape[i] = src.shape[i]
17678  */
17679   __pyx_t_4 = __pyx_v_src->memview;
17680   __pyx_v_tmpslice->memview = __pyx_t_4;
17681 
17682   /* "View.MemoryView":1226
17683  *     tmpslice.data = <char *> result
17684  *     tmpslice.memview = src.memview
17685  *     for i in range(ndim):             # <<<<<<<<<<<<<<
17686  *         tmpslice.shape[i] = src.shape[i]
17687  *         tmpslice.suboffsets[i] = -1
17688  */
17689   __pyx_t_3 = __pyx_v_ndim;
17690   __pyx_t_5 = __pyx_t_3;
17691   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17692     __pyx_v_i = __pyx_t_6;
17693 
17694     /* "View.MemoryView":1227
17695  *     tmpslice.memview = src.memview
17696  *     for i in range(ndim):
17697  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
17698  *         tmpslice.suboffsets[i] = -1
17699  *
17700  */
17701     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
17702 
17703     /* "View.MemoryView":1228
17704  *     for i in range(ndim):
17705  *         tmpslice.shape[i] = src.shape[i]
17706  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
17707  *
17708  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
17709  */
17710     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
17711   }
17712 
17713   /* "View.MemoryView":1230
17714  *         tmpslice.suboffsets[i] = -1
17715  *
17716  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
17717  *                               ndim, order)
17718  *
17719  */
17720   (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));
17721 
17722   /* "View.MemoryView":1234
17723  *
17724  *
17725  *     for i in range(ndim):             # <<<<<<<<<<<<<<
17726  *         if tmpslice.shape[i] == 1:
17727  *             tmpslice.strides[i] = 0
17728  */
17729   __pyx_t_3 = __pyx_v_ndim;
17730   __pyx_t_5 = __pyx_t_3;
17731   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17732     __pyx_v_i = __pyx_t_6;
17733 
17734     /* "View.MemoryView":1235
17735  *
17736  *     for i in range(ndim):
17737  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
17738  *             tmpslice.strides[i] = 0
17739  *
17740  */
17741     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
17742     if (__pyx_t_2) {
17743 
17744       /* "View.MemoryView":1236
17745  *     for i in range(ndim):
17746  *         if tmpslice.shape[i] == 1:
17747  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
17748  *
17749  *     if slice_is_contig(src[0], order, ndim):
17750  */
17751       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
17752 
17753       /* "View.MemoryView":1235
17754  *
17755  *     for i in range(ndim):
17756  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
17757  *             tmpslice.strides[i] = 0
17758  *
17759  */
17760     }
17761   }
17762 
17763   /* "View.MemoryView":1238
17764  *             tmpslice.strides[i] = 0
17765  *
17766  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
17767  *         memcpy(result, src.data, size)
17768  *     else:
17769  */
17770   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
17771   if (__pyx_t_2) {
17772 
17773     /* "View.MemoryView":1239
17774  *
17775  *     if slice_is_contig(src[0], order, ndim):
17776  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
17777  *     else:
17778  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
17779  */
17780     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
17781 
17782     /* "View.MemoryView":1238
17783  *             tmpslice.strides[i] = 0
17784  *
17785  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
17786  *         memcpy(result, src.data, size)
17787  *     else:
17788  */
17789     goto __pyx_L9;
17790   }
17791 
17792   /* "View.MemoryView":1241
17793  *         memcpy(result, src.data, size)
17794  *     else:
17795  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
17796  *
17797  *     return result
17798  */
17799   /*else*/ {
17800     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
17801   }
17802   __pyx_L9:;
17803 
17804   /* "View.MemoryView":1243
17805  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
17806  *
17807  *     return result             # <<<<<<<<<<<<<<
17808  *
17809  *
17810  */
17811   __pyx_r = __pyx_v_result;
17812   goto __pyx_L0;
17813 
17814   /* "View.MemoryView":1205
17815  *
17816  * @cname('__pyx_memoryview_copy_data_to_temp')
17817  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17818  *                              __Pyx_memviewslice *tmpslice,
17819  *                              char order,
17820  */
17821 
17822   /* function exit code */
17823   __pyx_L1_error:;
17824   {
17825     #ifdef WITH_THREAD
17826     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17827     #endif
17828     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
17829     #ifdef WITH_THREAD
17830     __Pyx_PyGILState_Release(__pyx_gilstate_save);
17831     #endif
17832   }
17833   __pyx_r = NULL;
17834   __pyx_L0:;
17835   return __pyx_r;
17836 }
17837 
17838 /* "View.MemoryView":1248
17839  *
17840  * @cname('__pyx_memoryview_err_extents')
17841  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
17842  *                              Py_ssize_t extent2) except -1 with gil:
17843  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
17844  */
17845 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)17846 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
17847   int __pyx_r;
17848   __Pyx_RefNannyDeclarations
17849   PyObject *__pyx_t_1 = NULL;
17850   PyObject *__pyx_t_2 = NULL;
17851   PyObject *__pyx_t_3 = NULL;
17852   PyObject *__pyx_t_4 = NULL;
17853   #ifdef WITH_THREAD
17854   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17855   #endif
17856   __Pyx_RefNannySetupContext("_err_extents", 0);
17857 
17858   /* "View.MemoryView":1251
17859  *                              Py_ssize_t extent2) except -1 with gil:
17860  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
17861  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
17862  *
17863  * @cname('__pyx_memoryview_err_dim')
17864  */
17865   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1251, __pyx_L1_error)
17866   __Pyx_GOTREF(__pyx_t_1);
17867   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1251, __pyx_L1_error)
17868   __Pyx_GOTREF(__pyx_t_2);
17869   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1251, __pyx_L1_error)
17870   __Pyx_GOTREF(__pyx_t_3);
17871   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1251, __pyx_L1_error)
17872   __Pyx_GOTREF(__pyx_t_4);
17873   __Pyx_GIVEREF(__pyx_t_1);
17874   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
17875   __Pyx_GIVEREF(__pyx_t_2);
17876   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
17877   __Pyx_GIVEREF(__pyx_t_3);
17878   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
17879   __pyx_t_1 = 0;
17880   __pyx_t_2 = 0;
17881   __pyx_t_3 = 0;
17882 
17883   /* "View.MemoryView":1250
17884  * cdef int _err_extents(int i, Py_ssize_t extent1,
17885  *                              Py_ssize_t extent2) except -1 with gil:
17886  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
17887  *                                                         (i, extent1, extent2))
17888  *
17889  */
17890   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error)
17891   __Pyx_GOTREF(__pyx_t_3);
17892   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17893   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1250, __pyx_L1_error)
17894   __Pyx_GOTREF(__pyx_t_4);
17895   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17896   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
17897   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17898   __PYX_ERR(1, 1250, __pyx_L1_error)
17899 
17900   /* "View.MemoryView":1248
17901  *
17902  * @cname('__pyx_memoryview_err_extents')
17903  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
17904  *                              Py_ssize_t extent2) except -1 with gil:
17905  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
17906  */
17907 
17908   /* function exit code */
17909   __pyx_L1_error:;
17910   __Pyx_XDECREF(__pyx_t_1);
17911   __Pyx_XDECREF(__pyx_t_2);
17912   __Pyx_XDECREF(__pyx_t_3);
17913   __Pyx_XDECREF(__pyx_t_4);
17914   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
17915   __pyx_r = -1;
17916   __Pyx_RefNannyFinishContext();
17917   #ifdef WITH_THREAD
17918   __Pyx_PyGILState_Release(__pyx_gilstate_save);
17919   #endif
17920   return __pyx_r;
17921 }
17922 
17923 /* "View.MemoryView":1254
17924  *
17925  * @cname('__pyx_memoryview_err_dim')
17926  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
17927  *     raise error(msg.decode('ascii') % dim)
17928  *
17929  */
17930 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)17931 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
17932   int __pyx_r;
17933   __Pyx_RefNannyDeclarations
17934   PyObject *__pyx_t_1 = NULL;
17935   PyObject *__pyx_t_2 = NULL;
17936   PyObject *__pyx_t_3 = NULL;
17937   PyObject *__pyx_t_4 = NULL;
17938   #ifdef WITH_THREAD
17939   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17940   #endif
17941   __Pyx_RefNannySetupContext("_err_dim", 0);
17942   __Pyx_INCREF(__pyx_v_error);
17943 
17944   /* "View.MemoryView":1255
17945  * @cname('__pyx_memoryview_err_dim')
17946  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
17947  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
17948  *
17949  * @cname('__pyx_memoryview_err')
17950  */
17951   __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(1, 1255, __pyx_L1_error)
17952   __Pyx_GOTREF(__pyx_t_2);
17953   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1255, __pyx_L1_error)
17954   __Pyx_GOTREF(__pyx_t_3);
17955   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1255, __pyx_L1_error)
17956   __Pyx_GOTREF(__pyx_t_4);
17957   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17958   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17959   __Pyx_INCREF(__pyx_v_error);
17960   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
17961   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
17962     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
17963     if (likely(__pyx_t_2)) {
17964       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
17965       __Pyx_INCREF(__pyx_t_2);
17966       __Pyx_INCREF(function);
17967       __Pyx_DECREF_SET(__pyx_t_3, function);
17968     }
17969   }
17970   __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);
17971   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
17972   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17973   if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1255, __pyx_L1_error)
17974   __Pyx_GOTREF(__pyx_t_1);
17975   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17976   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17977   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17978   __PYX_ERR(1, 1255, __pyx_L1_error)
17979 
17980   /* "View.MemoryView":1254
17981  *
17982  * @cname('__pyx_memoryview_err_dim')
17983  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
17984  *     raise error(msg.decode('ascii') % dim)
17985  *
17986  */
17987 
17988   /* function exit code */
17989   __pyx_L1_error:;
17990   __Pyx_XDECREF(__pyx_t_1);
17991   __Pyx_XDECREF(__pyx_t_2);
17992   __Pyx_XDECREF(__pyx_t_3);
17993   __Pyx_XDECREF(__pyx_t_4);
17994   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
17995   __pyx_r = -1;
17996   __Pyx_XDECREF(__pyx_v_error);
17997   __Pyx_RefNannyFinishContext();
17998   #ifdef WITH_THREAD
17999   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18000   #endif
18001   return __pyx_r;
18002 }
18003 
18004 /* "View.MemoryView":1258
18005  *
18006  * @cname('__pyx_memoryview_err')
18007  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
18008  *     if msg != NULL:
18009  *         raise error(msg.decode('ascii'))
18010  */
18011 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)18012 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
18013   int __pyx_r;
18014   __Pyx_RefNannyDeclarations
18015   int __pyx_t_1;
18016   PyObject *__pyx_t_2 = NULL;
18017   PyObject *__pyx_t_3 = NULL;
18018   PyObject *__pyx_t_4 = NULL;
18019   PyObject *__pyx_t_5 = NULL;
18020   #ifdef WITH_THREAD
18021   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18022   #endif
18023   __Pyx_RefNannySetupContext("_err", 0);
18024   __Pyx_INCREF(__pyx_v_error);
18025 
18026   /* "View.MemoryView":1259
18027  * @cname('__pyx_memoryview_err')
18028  * cdef int _err(object error, char *msg) except -1 with gil:
18029  *     if msg != NULL:             # <<<<<<<<<<<<<<
18030  *         raise error(msg.decode('ascii'))
18031  *     else:
18032  */
18033   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
18034   if (unlikely(__pyx_t_1)) {
18035 
18036     /* "View.MemoryView":1260
18037  * cdef int _err(object error, char *msg) except -1 with gil:
18038  *     if msg != NULL:
18039  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
18040  *     else:
18041  *         raise error
18042  */
18043     __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(1, 1260, __pyx_L1_error)
18044     __Pyx_GOTREF(__pyx_t_3);
18045     __Pyx_INCREF(__pyx_v_error);
18046     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
18047     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
18048       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
18049       if (likely(__pyx_t_5)) {
18050         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
18051         __Pyx_INCREF(__pyx_t_5);
18052         __Pyx_INCREF(function);
18053         __Pyx_DECREF_SET(__pyx_t_4, function);
18054       }
18055     }
18056     __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);
18057     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18058     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18059     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1260, __pyx_L1_error)
18060     __Pyx_GOTREF(__pyx_t_2);
18061     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18062     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18063     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18064     __PYX_ERR(1, 1260, __pyx_L1_error)
18065 
18066     /* "View.MemoryView":1259
18067  * @cname('__pyx_memoryview_err')
18068  * cdef int _err(object error, char *msg) except -1 with gil:
18069  *     if msg != NULL:             # <<<<<<<<<<<<<<
18070  *         raise error(msg.decode('ascii'))
18071  *     else:
18072  */
18073   }
18074 
18075   /* "View.MemoryView":1262
18076  *         raise error(msg.decode('ascii'))
18077  *     else:
18078  *         raise error             # <<<<<<<<<<<<<<
18079  *
18080  * @cname('__pyx_memoryview_copy_contents')
18081  */
18082   /*else*/ {
18083     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
18084     __PYX_ERR(1, 1262, __pyx_L1_error)
18085   }
18086 
18087   /* "View.MemoryView":1258
18088  *
18089  * @cname('__pyx_memoryview_err')
18090  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
18091  *     if msg != NULL:
18092  *         raise error(msg.decode('ascii'))
18093  */
18094 
18095   /* function exit code */
18096   __pyx_L1_error:;
18097   __Pyx_XDECREF(__pyx_t_2);
18098   __Pyx_XDECREF(__pyx_t_3);
18099   __Pyx_XDECREF(__pyx_t_4);
18100   __Pyx_XDECREF(__pyx_t_5);
18101   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
18102   __pyx_r = -1;
18103   __Pyx_XDECREF(__pyx_v_error);
18104   __Pyx_RefNannyFinishContext();
18105   #ifdef WITH_THREAD
18106   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18107   #endif
18108   return __pyx_r;
18109 }
18110 
18111 /* "View.MemoryView":1265
18112  *
18113  * @cname('__pyx_memoryview_copy_contents')
18114  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
18115  *                                   __Pyx_memviewslice dst,
18116  *                                   int src_ndim, int dst_ndim,
18117  */
18118 
__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)18119 static 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) {
18120   void *__pyx_v_tmpdata;
18121   size_t __pyx_v_itemsize;
18122   int __pyx_v_i;
18123   char __pyx_v_order;
18124   int __pyx_v_broadcasting;
18125   int __pyx_v_direct_copy;
18126   __Pyx_memviewslice __pyx_v_tmp;
18127   int __pyx_v_ndim;
18128   int __pyx_r;
18129   Py_ssize_t __pyx_t_1;
18130   int __pyx_t_2;
18131   int __pyx_t_3;
18132   int __pyx_t_4;
18133   int __pyx_t_5;
18134   int __pyx_t_6;
18135   void *__pyx_t_7;
18136   int __pyx_t_8;
18137 
18138   /* "View.MemoryView":1273
18139  *     Check for overlapping memory and verify the shapes.
18140  *     """
18141  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
18142  *     cdef size_t itemsize = src.memview.view.itemsize
18143  *     cdef int i
18144  */
18145   __pyx_v_tmpdata = NULL;
18146 
18147   /* "View.MemoryView":1274
18148  *     """
18149  *     cdef void *tmpdata = NULL
18150  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
18151  *     cdef int i
18152  *     cdef char order = get_best_order(&src, src_ndim)
18153  */
18154   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
18155   __pyx_v_itemsize = __pyx_t_1;
18156 
18157   /* "View.MemoryView":1276
18158  *     cdef size_t itemsize = src.memview.view.itemsize
18159  *     cdef int i
18160  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
18161  *     cdef bint broadcasting = False
18162  *     cdef bint direct_copy = False
18163  */
18164   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
18165 
18166   /* "View.MemoryView":1277
18167  *     cdef int i
18168  *     cdef char order = get_best_order(&src, src_ndim)
18169  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
18170  *     cdef bint direct_copy = False
18171  *     cdef __Pyx_memviewslice tmp
18172  */
18173   __pyx_v_broadcasting = 0;
18174 
18175   /* "View.MemoryView":1278
18176  *     cdef char order = get_best_order(&src, src_ndim)
18177  *     cdef bint broadcasting = False
18178  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
18179  *     cdef __Pyx_memviewslice tmp
18180  *
18181  */
18182   __pyx_v_direct_copy = 0;
18183 
18184   /* "View.MemoryView":1281
18185  *     cdef __Pyx_memviewslice tmp
18186  *
18187  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
18188  *         broadcast_leading(&src, src_ndim, dst_ndim)
18189  *     elif dst_ndim < src_ndim:
18190  */
18191   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
18192   if (__pyx_t_2) {
18193 
18194     /* "View.MemoryView":1282
18195  *
18196  *     if src_ndim < dst_ndim:
18197  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
18198  *     elif dst_ndim < src_ndim:
18199  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18200  */
18201     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
18202 
18203     /* "View.MemoryView":1281
18204  *     cdef __Pyx_memviewslice tmp
18205  *
18206  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
18207  *         broadcast_leading(&src, src_ndim, dst_ndim)
18208  *     elif dst_ndim < src_ndim:
18209  */
18210     goto __pyx_L3;
18211   }
18212 
18213   /* "View.MemoryView":1283
18214  *     if src_ndim < dst_ndim:
18215  *         broadcast_leading(&src, src_ndim, dst_ndim)
18216  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
18217  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18218  *
18219  */
18220   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
18221   if (__pyx_t_2) {
18222 
18223     /* "View.MemoryView":1284
18224  *         broadcast_leading(&src, src_ndim, dst_ndim)
18225  *     elif dst_ndim < src_ndim:
18226  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
18227  *
18228  *     cdef int ndim = max(src_ndim, dst_ndim)
18229  */
18230     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
18231 
18232     /* "View.MemoryView":1283
18233  *     if src_ndim < dst_ndim:
18234  *         broadcast_leading(&src, src_ndim, dst_ndim)
18235  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
18236  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18237  *
18238  */
18239   }
18240   __pyx_L3:;
18241 
18242   /* "View.MemoryView":1286
18243  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18244  *
18245  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
18246  *
18247  *     for i in range(ndim):
18248  */
18249   __pyx_t_3 = __pyx_v_dst_ndim;
18250   __pyx_t_4 = __pyx_v_src_ndim;
18251   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
18252     __pyx_t_5 = __pyx_t_3;
18253   } else {
18254     __pyx_t_5 = __pyx_t_4;
18255   }
18256   __pyx_v_ndim = __pyx_t_5;
18257 
18258   /* "View.MemoryView":1288
18259  *     cdef int ndim = max(src_ndim, dst_ndim)
18260  *
18261  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18262  *         if src.shape[i] != dst.shape[i]:
18263  *             if src.shape[i] == 1:
18264  */
18265   __pyx_t_5 = __pyx_v_ndim;
18266   __pyx_t_3 = __pyx_t_5;
18267   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18268     __pyx_v_i = __pyx_t_4;
18269 
18270     /* "View.MemoryView":1289
18271  *
18272  *     for i in range(ndim):
18273  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
18274  *             if src.shape[i] == 1:
18275  *                 broadcasting = True
18276  */
18277     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
18278     if (__pyx_t_2) {
18279 
18280       /* "View.MemoryView":1290
18281  *     for i in range(ndim):
18282  *         if src.shape[i] != dst.shape[i]:
18283  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
18284  *                 broadcasting = True
18285  *                 src.strides[i] = 0
18286  */
18287       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
18288       if (__pyx_t_2) {
18289 
18290         /* "View.MemoryView":1291
18291  *         if src.shape[i] != dst.shape[i]:
18292  *             if src.shape[i] == 1:
18293  *                 broadcasting = True             # <<<<<<<<<<<<<<
18294  *                 src.strides[i] = 0
18295  *             else:
18296  */
18297         __pyx_v_broadcasting = 1;
18298 
18299         /* "View.MemoryView":1292
18300  *             if src.shape[i] == 1:
18301  *                 broadcasting = True
18302  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
18303  *             else:
18304  *                 _err_extents(i, dst.shape[i], src.shape[i])
18305  */
18306         (__pyx_v_src.strides[__pyx_v_i]) = 0;
18307 
18308         /* "View.MemoryView":1290
18309  *     for i in range(ndim):
18310  *         if src.shape[i] != dst.shape[i]:
18311  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
18312  *                 broadcasting = True
18313  *                 src.strides[i] = 0
18314  */
18315         goto __pyx_L7;
18316       }
18317 
18318       /* "View.MemoryView":1294
18319  *                 src.strides[i] = 0
18320  *             else:
18321  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
18322  *
18323  *         if src.suboffsets[i] >= 0:
18324  */
18325       /*else*/ {
18326         __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(1, 1294, __pyx_L1_error)
18327       }
18328       __pyx_L7:;
18329 
18330       /* "View.MemoryView":1289
18331  *
18332  *     for i in range(ndim):
18333  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
18334  *             if src.shape[i] == 1:
18335  *                 broadcasting = True
18336  */
18337     }
18338 
18339     /* "View.MemoryView":1296
18340  *                 _err_extents(i, dst.shape[i], src.shape[i])
18341  *
18342  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
18343  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18344  *
18345  */
18346     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
18347     if (__pyx_t_2) {
18348 
18349       /* "View.MemoryView":1297
18350  *
18351  *         if src.suboffsets[i] >= 0:
18352  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
18353  *
18354  *     if slices_overlap(&src, &dst, ndim, itemsize):
18355  */
18356       __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(1, 1297, __pyx_L1_error)
18357 
18358       /* "View.MemoryView":1296
18359  *                 _err_extents(i, dst.shape[i], src.shape[i])
18360  *
18361  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
18362  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18363  *
18364  */
18365     }
18366   }
18367 
18368   /* "View.MemoryView":1299
18369  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18370  *
18371  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
18372  *
18373  *         if not slice_is_contig(src, order, ndim):
18374  */
18375   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
18376   if (__pyx_t_2) {
18377 
18378     /* "View.MemoryView":1301
18379  *     if slices_overlap(&src, &dst, ndim, itemsize):
18380  *
18381  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
18382  *             order = get_best_order(&dst, ndim)
18383  *
18384  */
18385     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
18386     if (__pyx_t_2) {
18387 
18388       /* "View.MemoryView":1302
18389  *
18390  *         if not slice_is_contig(src, order, ndim):
18391  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
18392  *
18393  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
18394  */
18395       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
18396 
18397       /* "View.MemoryView":1301
18398  *     if slices_overlap(&src, &dst, ndim, itemsize):
18399  *
18400  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
18401  *             order = get_best_order(&dst, ndim)
18402  *
18403  */
18404     }
18405 
18406     /* "View.MemoryView":1304
18407  *             order = get_best_order(&dst, ndim)
18408  *
18409  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
18410  *         src = tmp
18411  *
18412  */
18413     __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(1, 1304, __pyx_L1_error)
18414     __pyx_v_tmpdata = __pyx_t_7;
18415 
18416     /* "View.MemoryView":1305
18417  *
18418  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
18419  *         src = tmp             # <<<<<<<<<<<<<<
18420  *
18421  *     if not broadcasting:
18422  */
18423     __pyx_v_src = __pyx_v_tmp;
18424 
18425     /* "View.MemoryView":1299
18426  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18427  *
18428  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
18429  *
18430  *         if not slice_is_contig(src, order, ndim):
18431  */
18432   }
18433 
18434   /* "View.MemoryView":1307
18435  *         src = tmp
18436  *
18437  *     if not broadcasting:             # <<<<<<<<<<<<<<
18438  *
18439  *
18440  */
18441   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
18442   if (__pyx_t_2) {
18443 
18444     /* "View.MemoryView":1310
18445  *
18446  *
18447  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
18448  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18449  *         elif slice_is_contig(src, 'F', ndim):
18450  */
18451     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
18452     if (__pyx_t_2) {
18453 
18454       /* "View.MemoryView":1311
18455  *
18456  *         if slice_is_contig(src, 'C', ndim):
18457  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
18458  *         elif slice_is_contig(src, 'F', ndim):
18459  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18460  */
18461       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
18462 
18463       /* "View.MemoryView":1310
18464  *
18465  *
18466  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
18467  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18468  *         elif slice_is_contig(src, 'F', ndim):
18469  */
18470       goto __pyx_L12;
18471     }
18472 
18473     /* "View.MemoryView":1312
18474  *         if slice_is_contig(src, 'C', ndim):
18475  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18476  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
18477  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18478  *
18479  */
18480     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
18481     if (__pyx_t_2) {
18482 
18483       /* "View.MemoryView":1313
18484  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18485  *         elif slice_is_contig(src, 'F', ndim):
18486  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
18487  *
18488  *         if direct_copy:
18489  */
18490       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
18491 
18492       /* "View.MemoryView":1312
18493  *         if slice_is_contig(src, 'C', ndim):
18494  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18495  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
18496  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18497  *
18498  */
18499     }
18500     __pyx_L12:;
18501 
18502     /* "View.MemoryView":1315
18503  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18504  *
18505  *         if direct_copy:             # <<<<<<<<<<<<<<
18506  *
18507  *             refcount_copying(&dst, dtype_is_object, ndim, False)
18508  */
18509     __pyx_t_2 = (__pyx_v_direct_copy != 0);
18510     if (__pyx_t_2) {
18511 
18512       /* "View.MemoryView":1317
18513  *         if direct_copy:
18514  *
18515  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
18516  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
18517  *             refcount_copying(&dst, dtype_is_object, ndim, True)
18518  */
18519       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
18520 
18521       /* "View.MemoryView":1318
18522  *
18523  *             refcount_copying(&dst, dtype_is_object, ndim, False)
18524  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
18525  *             refcount_copying(&dst, dtype_is_object, ndim, True)
18526  *             free(tmpdata)
18527  */
18528       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
18529 
18530       /* "View.MemoryView":1319
18531  *             refcount_copying(&dst, dtype_is_object, ndim, False)
18532  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
18533  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
18534  *             free(tmpdata)
18535  *             return 0
18536  */
18537       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
18538 
18539       /* "View.MemoryView":1320
18540  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
18541  *             refcount_copying(&dst, dtype_is_object, ndim, True)
18542  *             free(tmpdata)             # <<<<<<<<<<<<<<
18543  *             return 0
18544  *
18545  */
18546       free(__pyx_v_tmpdata);
18547 
18548       /* "View.MemoryView":1321
18549  *             refcount_copying(&dst, dtype_is_object, ndim, True)
18550  *             free(tmpdata)
18551  *             return 0             # <<<<<<<<<<<<<<
18552  *
18553  *     if order == 'F' == get_best_order(&dst, ndim):
18554  */
18555       __pyx_r = 0;
18556       goto __pyx_L0;
18557 
18558       /* "View.MemoryView":1315
18559  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18560  *
18561  *         if direct_copy:             # <<<<<<<<<<<<<<
18562  *
18563  *             refcount_copying(&dst, dtype_is_object, ndim, False)
18564  */
18565     }
18566 
18567     /* "View.MemoryView":1307
18568  *         src = tmp
18569  *
18570  *     if not broadcasting:             # <<<<<<<<<<<<<<
18571  *
18572  *
18573  */
18574   }
18575 
18576   /* "View.MemoryView":1323
18577  *             return 0
18578  *
18579  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
18580  *
18581  *
18582  */
18583   __pyx_t_2 = (__pyx_v_order == 'F');
18584   if (__pyx_t_2) {
18585     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
18586   }
18587   __pyx_t_8 = (__pyx_t_2 != 0);
18588   if (__pyx_t_8) {
18589 
18590     /* "View.MemoryView":1326
18591  *
18592  *
18593  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
18594  *         transpose_memslice(&dst)
18595  *
18596  */
18597     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1326, __pyx_L1_error)
18598 
18599     /* "View.MemoryView":1327
18600  *
18601  *         transpose_memslice(&src)
18602  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
18603  *
18604  *     refcount_copying(&dst, dtype_is_object, ndim, False)
18605  */
18606     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1327, __pyx_L1_error)
18607 
18608     /* "View.MemoryView":1323
18609  *             return 0
18610  *
18611  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
18612  *
18613  *
18614  */
18615   }
18616 
18617   /* "View.MemoryView":1329
18618  *         transpose_memslice(&dst)
18619  *
18620  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
18621  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
18622  *     refcount_copying(&dst, dtype_is_object, ndim, True)
18623  */
18624   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
18625 
18626   /* "View.MemoryView":1330
18627  *
18628  *     refcount_copying(&dst, dtype_is_object, ndim, False)
18629  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
18630  *     refcount_copying(&dst, dtype_is_object, ndim, True)
18631  *
18632  */
18633   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
18634 
18635   /* "View.MemoryView":1331
18636  *     refcount_copying(&dst, dtype_is_object, ndim, False)
18637  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
18638  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
18639  *
18640  *     free(tmpdata)
18641  */
18642   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
18643 
18644   /* "View.MemoryView":1333
18645  *     refcount_copying(&dst, dtype_is_object, ndim, True)
18646  *
18647  *     free(tmpdata)             # <<<<<<<<<<<<<<
18648  *     return 0
18649  *
18650  */
18651   free(__pyx_v_tmpdata);
18652 
18653   /* "View.MemoryView":1334
18654  *
18655  *     free(tmpdata)
18656  *     return 0             # <<<<<<<<<<<<<<
18657  *
18658  * @cname('__pyx_memoryview_broadcast_leading')
18659  */
18660   __pyx_r = 0;
18661   goto __pyx_L0;
18662 
18663   /* "View.MemoryView":1265
18664  *
18665  * @cname('__pyx_memoryview_copy_contents')
18666  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
18667  *                                   __Pyx_memviewslice dst,
18668  *                                   int src_ndim, int dst_ndim,
18669  */
18670 
18671   /* function exit code */
18672   __pyx_L1_error:;
18673   {
18674     #ifdef WITH_THREAD
18675     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18676     #endif
18677     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
18678     #ifdef WITH_THREAD
18679     __Pyx_PyGILState_Release(__pyx_gilstate_save);
18680     #endif
18681   }
18682   __pyx_r = -1;
18683   __pyx_L0:;
18684   return __pyx_r;
18685 }
18686 
18687 /* "View.MemoryView":1337
18688  *
18689  * @cname('__pyx_memoryview_broadcast_leading')
18690  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
18691  *                             int ndim,
18692  *                             int ndim_other) nogil:
18693  */
18694 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)18695 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
18696   int __pyx_v_i;
18697   int __pyx_v_offset;
18698   int __pyx_t_1;
18699   int __pyx_t_2;
18700   int __pyx_t_3;
18701 
18702   /* "View.MemoryView":1341
18703  *                             int ndim_other) nogil:
18704  *     cdef int i
18705  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
18706  *
18707  *     for i in range(ndim - 1, -1, -1):
18708  */
18709   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
18710 
18711   /* "View.MemoryView":1343
18712  *     cdef int offset = ndim_other - ndim
18713  *
18714  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
18715  *         mslice.shape[i + offset] = mslice.shape[i]
18716  *         mslice.strides[i + offset] = mslice.strides[i]
18717  */
18718   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
18719     __pyx_v_i = __pyx_t_1;
18720 
18721     /* "View.MemoryView":1344
18722  *
18723  *     for i in range(ndim - 1, -1, -1):
18724  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
18725  *         mslice.strides[i + offset] = mslice.strides[i]
18726  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
18727  */
18728     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
18729 
18730     /* "View.MemoryView":1345
18731  *     for i in range(ndim - 1, -1, -1):
18732  *         mslice.shape[i + offset] = mslice.shape[i]
18733  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
18734  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
18735  *
18736  */
18737     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
18738 
18739     /* "View.MemoryView":1346
18740  *         mslice.shape[i + offset] = mslice.shape[i]
18741  *         mslice.strides[i + offset] = mslice.strides[i]
18742  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
18743  *
18744  *     for i in range(offset):
18745  */
18746     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
18747   }
18748 
18749   /* "View.MemoryView":1348
18750  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
18751  *
18752  *     for i in range(offset):             # <<<<<<<<<<<<<<
18753  *         mslice.shape[i] = 1
18754  *         mslice.strides[i] = mslice.strides[0]
18755  */
18756   __pyx_t_1 = __pyx_v_offset;
18757   __pyx_t_2 = __pyx_t_1;
18758   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18759     __pyx_v_i = __pyx_t_3;
18760 
18761     /* "View.MemoryView":1349
18762  *
18763  *     for i in range(offset):
18764  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
18765  *         mslice.strides[i] = mslice.strides[0]
18766  *         mslice.suboffsets[i] = -1
18767  */
18768     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
18769 
18770     /* "View.MemoryView":1350
18771  *     for i in range(offset):
18772  *         mslice.shape[i] = 1
18773  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
18774  *         mslice.suboffsets[i] = -1
18775  *
18776  */
18777     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
18778 
18779     /* "View.MemoryView":1351
18780  *         mslice.shape[i] = 1
18781  *         mslice.strides[i] = mslice.strides[0]
18782  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
18783  *
18784  *
18785  */
18786     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
18787   }
18788 
18789   /* "View.MemoryView":1337
18790  *
18791  * @cname('__pyx_memoryview_broadcast_leading')
18792  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
18793  *                             int ndim,
18794  *                             int ndim_other) nogil:
18795  */
18796 
18797   /* function exit code */
18798 }
18799 
18800 /* "View.MemoryView":1359
18801  *
18802  * @cname('__pyx_memoryview_refcount_copying')
18803  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
18804  *                            int ndim, bint inc) nogil:
18805  *
18806  */
18807 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)18808 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
18809   int __pyx_t_1;
18810 
18811   /* "View.MemoryView":1363
18812  *
18813  *
18814  *     if dtype_is_object:             # <<<<<<<<<<<<<<
18815  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
18816  *                                            dst.strides, ndim, inc)
18817  */
18818   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
18819   if (__pyx_t_1) {
18820 
18821     /* "View.MemoryView":1364
18822  *
18823  *     if dtype_is_object:
18824  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
18825  *                                            dst.strides, ndim, inc)
18826  *
18827  */
18828     __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);
18829 
18830     /* "View.MemoryView":1363
18831  *
18832  *
18833  *     if dtype_is_object:             # <<<<<<<<<<<<<<
18834  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
18835  *                                            dst.strides, ndim, inc)
18836  */
18837   }
18838 
18839   /* "View.MemoryView":1359
18840  *
18841  * @cname('__pyx_memoryview_refcount_copying')
18842  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
18843  *                            int ndim, bint inc) nogil:
18844  *
18845  */
18846 
18847   /* function exit code */
18848 }
18849 
18850 /* "View.MemoryView":1368
18851  *
18852  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
18853  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
18854  *                                              Py_ssize_t *strides, int ndim,
18855  *                                              bint inc) with gil:
18856  */
18857 
__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)18858 static 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) {
18859   __Pyx_RefNannyDeclarations
18860   #ifdef WITH_THREAD
18861   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18862   #endif
18863   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
18864 
18865   /* "View.MemoryView":1371
18866  *                                              Py_ssize_t *strides, int ndim,
18867  *                                              bint inc) with gil:
18868  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
18869  *
18870  * @cname('__pyx_memoryview_refcount_objects_in_slice')
18871  */
18872   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
18873 
18874   /* "View.MemoryView":1368
18875  *
18876  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
18877  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
18878  *                                              Py_ssize_t *strides, int ndim,
18879  *                                              bint inc) with gil:
18880  */
18881 
18882   /* function exit code */
18883   __Pyx_RefNannyFinishContext();
18884   #ifdef WITH_THREAD
18885   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18886   #endif
18887 }
18888 
18889 /* "View.MemoryView":1374
18890  *
18891  * @cname('__pyx_memoryview_refcount_objects_in_slice')
18892  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
18893  *                                     Py_ssize_t *strides, int ndim, bint inc):
18894  *     cdef Py_ssize_t i
18895  */
18896 
__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)18897 static 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) {
18898   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
18899   __Pyx_RefNannyDeclarations
18900   Py_ssize_t __pyx_t_1;
18901   Py_ssize_t __pyx_t_2;
18902   Py_ssize_t __pyx_t_3;
18903   int __pyx_t_4;
18904   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
18905 
18906   /* "View.MemoryView":1378
18907  *     cdef Py_ssize_t i
18908  *
18909  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
18910  *         if ndim == 1:
18911  *             if inc:
18912  */
18913   __pyx_t_1 = (__pyx_v_shape[0]);
18914   __pyx_t_2 = __pyx_t_1;
18915   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
18916     __pyx_v_i = __pyx_t_3;
18917 
18918     /* "View.MemoryView":1379
18919  *
18920  *     for i in range(shape[0]):
18921  *         if ndim == 1:             # <<<<<<<<<<<<<<
18922  *             if inc:
18923  *                 Py_INCREF((<PyObject **> data)[0])
18924  */
18925     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
18926     if (__pyx_t_4) {
18927 
18928       /* "View.MemoryView":1380
18929  *     for i in range(shape[0]):
18930  *         if ndim == 1:
18931  *             if inc:             # <<<<<<<<<<<<<<
18932  *                 Py_INCREF((<PyObject **> data)[0])
18933  *             else:
18934  */
18935       __pyx_t_4 = (__pyx_v_inc != 0);
18936       if (__pyx_t_4) {
18937 
18938         /* "View.MemoryView":1381
18939  *         if ndim == 1:
18940  *             if inc:
18941  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
18942  *             else:
18943  *                 Py_DECREF((<PyObject **> data)[0])
18944  */
18945         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
18946 
18947         /* "View.MemoryView":1380
18948  *     for i in range(shape[0]):
18949  *         if ndim == 1:
18950  *             if inc:             # <<<<<<<<<<<<<<
18951  *                 Py_INCREF((<PyObject **> data)[0])
18952  *             else:
18953  */
18954         goto __pyx_L6;
18955       }
18956 
18957       /* "View.MemoryView":1383
18958  *                 Py_INCREF((<PyObject **> data)[0])
18959  *             else:
18960  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
18961  *         else:
18962  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
18963  */
18964       /*else*/ {
18965         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
18966       }
18967       __pyx_L6:;
18968 
18969       /* "View.MemoryView":1379
18970  *
18971  *     for i in range(shape[0]):
18972  *         if ndim == 1:             # <<<<<<<<<<<<<<
18973  *             if inc:
18974  *                 Py_INCREF((<PyObject **> data)[0])
18975  */
18976       goto __pyx_L5;
18977     }
18978 
18979     /* "View.MemoryView":1385
18980  *                 Py_DECREF((<PyObject **> data)[0])
18981  *         else:
18982  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
18983  *                                       ndim - 1, inc)
18984  *
18985  */
18986     /*else*/ {
18987 
18988       /* "View.MemoryView":1386
18989  *         else:
18990  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
18991  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
18992  *
18993  *         data += strides[0]
18994  */
18995       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
18996     }
18997     __pyx_L5:;
18998 
18999     /* "View.MemoryView":1388
19000  *                                       ndim - 1, inc)
19001  *
19002  *         data += strides[0]             # <<<<<<<<<<<<<<
19003  *
19004  *
19005  */
19006     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
19007   }
19008 
19009   /* "View.MemoryView":1374
19010  *
19011  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19012  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19013  *                                     Py_ssize_t *strides, int ndim, bint inc):
19014  *     cdef Py_ssize_t i
19015  */
19016 
19017   /* function exit code */
19018   __Pyx_RefNannyFinishContext();
19019 }
19020 
19021 /* "View.MemoryView":1394
19022  *
19023  * @cname('__pyx_memoryview_slice_assign_scalar')
19024  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
19025  *                               size_t itemsize, void *item,
19026  *                               bint dtype_is_object) nogil:
19027  */
19028 
__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)19029 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
19030 
19031   /* "View.MemoryView":1397
19032  *                               size_t itemsize, void *item,
19033  *                               bint dtype_is_object) nogil:
19034  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
19035  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
19036  *                          itemsize, item)
19037  */
19038   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19039 
19040   /* "View.MemoryView":1398
19041  *                               bint dtype_is_object) nogil:
19042  *     refcount_copying(dst, dtype_is_object, ndim, False)
19043  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
19044  *                          itemsize, item)
19045  *     refcount_copying(dst, dtype_is_object, ndim, True)
19046  */
19047   __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);
19048 
19049   /* "View.MemoryView":1400
19050  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
19051  *                          itemsize, item)
19052  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
19053  *
19054  *
19055  */
19056   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19057 
19058   /* "View.MemoryView":1394
19059  *
19060  * @cname('__pyx_memoryview_slice_assign_scalar')
19061  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
19062  *                               size_t itemsize, void *item,
19063  *                               bint dtype_is_object) nogil:
19064  */
19065 
19066   /* function exit code */
19067 }
19068 
19069 /* "View.MemoryView":1404
19070  *
19071  * @cname('__pyx_memoryview__slice_assign_scalar')
19072  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19073  *                               Py_ssize_t *strides, int ndim,
19074  *                               size_t itemsize, void *item) nogil:
19075  */
19076 
__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)19077 static 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) {
19078   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19079   Py_ssize_t __pyx_v_stride;
19080   Py_ssize_t __pyx_v_extent;
19081   int __pyx_t_1;
19082   Py_ssize_t __pyx_t_2;
19083   Py_ssize_t __pyx_t_3;
19084   Py_ssize_t __pyx_t_4;
19085 
19086   /* "View.MemoryView":1408
19087  *                               size_t itemsize, void *item) nogil:
19088  *     cdef Py_ssize_t i
19089  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
19090  *     cdef Py_ssize_t extent = shape[0]
19091  *
19092  */
19093   __pyx_v_stride = (__pyx_v_strides[0]);
19094 
19095   /* "View.MemoryView":1409
19096  *     cdef Py_ssize_t i
19097  *     cdef Py_ssize_t stride = strides[0]
19098  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
19099  *
19100  *     if ndim == 1:
19101  */
19102   __pyx_v_extent = (__pyx_v_shape[0]);
19103 
19104   /* "View.MemoryView":1411
19105  *     cdef Py_ssize_t extent = shape[0]
19106  *
19107  *     if ndim == 1:             # <<<<<<<<<<<<<<
19108  *         for i in range(extent):
19109  *             memcpy(data, item, itemsize)
19110  */
19111   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
19112   if (__pyx_t_1) {
19113 
19114     /* "View.MemoryView":1412
19115  *
19116  *     if ndim == 1:
19117  *         for i in range(extent):             # <<<<<<<<<<<<<<
19118  *             memcpy(data, item, itemsize)
19119  *             data += stride
19120  */
19121     __pyx_t_2 = __pyx_v_extent;
19122     __pyx_t_3 = __pyx_t_2;
19123     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19124       __pyx_v_i = __pyx_t_4;
19125 
19126       /* "View.MemoryView":1413
19127  *     if ndim == 1:
19128  *         for i in range(extent):
19129  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
19130  *             data += stride
19131  *     else:
19132  */
19133       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
19134 
19135       /* "View.MemoryView":1414
19136  *         for i in range(extent):
19137  *             memcpy(data, item, itemsize)
19138  *             data += stride             # <<<<<<<<<<<<<<
19139  *     else:
19140  *         for i in range(extent):
19141  */
19142       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19143     }
19144 
19145     /* "View.MemoryView":1411
19146  *     cdef Py_ssize_t extent = shape[0]
19147  *
19148  *     if ndim == 1:             # <<<<<<<<<<<<<<
19149  *         for i in range(extent):
19150  *             memcpy(data, item, itemsize)
19151  */
19152     goto __pyx_L3;
19153   }
19154 
19155   /* "View.MemoryView":1416
19156  *             data += stride
19157  *     else:
19158  *         for i in range(extent):             # <<<<<<<<<<<<<<
19159  *             _slice_assign_scalar(data, shape + 1, strides + 1,
19160  *                                 ndim - 1, itemsize, item)
19161  */
19162   /*else*/ {
19163     __pyx_t_2 = __pyx_v_extent;
19164     __pyx_t_3 = __pyx_t_2;
19165     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19166       __pyx_v_i = __pyx_t_4;
19167 
19168       /* "View.MemoryView":1417
19169  *     else:
19170  *         for i in range(extent):
19171  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
19172  *                                 ndim - 1, itemsize, item)
19173  *             data += stride
19174  */
19175       __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);
19176 
19177       /* "View.MemoryView":1419
19178  *             _slice_assign_scalar(data, shape + 1, strides + 1,
19179  *                                 ndim - 1, itemsize, item)
19180  *             data += stride             # <<<<<<<<<<<<<<
19181  *
19182  *
19183  */
19184       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19185     }
19186   }
19187   __pyx_L3:;
19188 
19189   /* "View.MemoryView":1404
19190  *
19191  * @cname('__pyx_memoryview__slice_assign_scalar')
19192  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19193  *                               Py_ssize_t *strides, int ndim,
19194  *                               size_t itemsize, void *item) nogil:
19195  */
19196 
19197   /* function exit code */
19198 }
19199 
19200 /* "(tree fragment)":1
19201  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
19202  *     cdef object __pyx_PickleError
19203  *     cdef object __pyx_result
19204  */
19205 
19206 /* Python wrapper */
19207 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19208 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)19209 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19210   PyObject *__pyx_v___pyx_type = 0;
19211   long __pyx_v___pyx_checksum;
19212   PyObject *__pyx_v___pyx_state = 0;
19213   PyObject *__pyx_r = 0;
19214   __Pyx_RefNannyDeclarations
19215   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
19216   {
19217     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
19218     PyObject* values[3] = {0,0,0};
19219     if (unlikely(__pyx_kwds)) {
19220       Py_ssize_t kw_args;
19221       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19222       switch (pos_args) {
19223         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19224         CYTHON_FALLTHROUGH;
19225         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19226         CYTHON_FALLTHROUGH;
19227         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19228         CYTHON_FALLTHROUGH;
19229         case  0: break;
19230         default: goto __pyx_L5_argtuple_error;
19231       }
19232       kw_args = PyDict_Size(__pyx_kwds);
19233       switch (pos_args) {
19234         case  0:
19235         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
19236         else goto __pyx_L5_argtuple_error;
19237         CYTHON_FALLTHROUGH;
19238         case  1:
19239         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
19240         else {
19241           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
19242         }
19243         CYTHON_FALLTHROUGH;
19244         case  2:
19245         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
19246         else {
19247           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
19248         }
19249       }
19250       if (unlikely(kw_args > 0)) {
19251         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
19252       }
19253     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
19254       goto __pyx_L5_argtuple_error;
19255     } else {
19256       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19257       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19258       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19259     }
19260     __pyx_v___pyx_type = values[0];
19261     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
19262     __pyx_v___pyx_state = values[2];
19263   }
19264   goto __pyx_L4_argument_unpacking_done;
19265   __pyx_L5_argtuple_error:;
19266   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
19267   __pyx_L3_error:;
19268   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19269   __Pyx_RefNannyFinishContext();
19270   return NULL;
19271   __pyx_L4_argument_unpacking_done:;
19272   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
19273 
19274   /* function exit code */
19275   __Pyx_RefNannyFinishContext();
19276   return __pyx_r;
19277 }
19278 
__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)19279 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
19280   PyObject *__pyx_v___pyx_PickleError = 0;
19281   PyObject *__pyx_v___pyx_result = 0;
19282   PyObject *__pyx_r = NULL;
19283   __Pyx_RefNannyDeclarations
19284   int __pyx_t_1;
19285   PyObject *__pyx_t_2 = NULL;
19286   PyObject *__pyx_t_3 = NULL;
19287   PyObject *__pyx_t_4 = NULL;
19288   PyObject *__pyx_t_5 = NULL;
19289   int __pyx_t_6;
19290   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
19291 
19292   /* "(tree fragment)":4
19293  *     cdef object __pyx_PickleError
19294  *     cdef object __pyx_result
19295  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
19296  *         from pickle import PickleError as __pyx_PickleError
19297  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19298  */
19299   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
19300   if (__pyx_t_1) {
19301 
19302     /* "(tree fragment)":5
19303  *     cdef object __pyx_result
19304  *     if __pyx_checksum != 0xb068931:
19305  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
19306  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19307  *     __pyx_result = Enum.__new__(__pyx_type)
19308  */
19309     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
19310     __Pyx_GOTREF(__pyx_t_2);
19311     __Pyx_INCREF(__pyx_n_s_PickleError);
19312     __Pyx_GIVEREF(__pyx_n_s_PickleError);
19313     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
19314     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
19315     __Pyx_GOTREF(__pyx_t_3);
19316     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19317     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
19318     __Pyx_GOTREF(__pyx_t_2);
19319     __Pyx_INCREF(__pyx_t_2);
19320     __pyx_v___pyx_PickleError = __pyx_t_2;
19321     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19322     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19323 
19324     /* "(tree fragment)":6
19325  *     if __pyx_checksum != 0xb068931:
19326  *         from pickle import PickleError as __pyx_PickleError
19327  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
19328  *     __pyx_result = Enum.__new__(__pyx_type)
19329  *     if __pyx_state is not None:
19330  */
19331     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
19332     __Pyx_GOTREF(__pyx_t_2);
19333     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
19334     __Pyx_GOTREF(__pyx_t_4);
19335     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19336     __Pyx_INCREF(__pyx_v___pyx_PickleError);
19337     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
19338     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
19339       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
19340       if (likely(__pyx_t_5)) {
19341         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
19342         __Pyx_INCREF(__pyx_t_5);
19343         __Pyx_INCREF(function);
19344         __Pyx_DECREF_SET(__pyx_t_2, function);
19345       }
19346     }
19347     __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);
19348     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19349     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19350     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
19351     __Pyx_GOTREF(__pyx_t_3);
19352     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19353     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19354     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19355     __PYX_ERR(1, 6, __pyx_L1_error)
19356 
19357     /* "(tree fragment)":4
19358  *     cdef object __pyx_PickleError
19359  *     cdef object __pyx_result
19360  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
19361  *         from pickle import PickleError as __pyx_PickleError
19362  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19363  */
19364   }
19365 
19366   /* "(tree fragment)":7
19367  *         from pickle import PickleError as __pyx_PickleError
19368  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19369  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
19370  *     if __pyx_state is not None:
19371  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19372  */
19373   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
19374   __Pyx_GOTREF(__pyx_t_2);
19375   __pyx_t_4 = NULL;
19376   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
19377     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
19378     if (likely(__pyx_t_4)) {
19379       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
19380       __Pyx_INCREF(__pyx_t_4);
19381       __Pyx_INCREF(function);
19382       __Pyx_DECREF_SET(__pyx_t_2, function);
19383     }
19384   }
19385   __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);
19386   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
19387   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
19388   __Pyx_GOTREF(__pyx_t_3);
19389   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19390   __pyx_v___pyx_result = __pyx_t_3;
19391   __pyx_t_3 = 0;
19392 
19393   /* "(tree fragment)":8
19394  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19395  *     __pyx_result = Enum.__new__(__pyx_type)
19396  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
19397  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19398  *     return __pyx_result
19399  */
19400   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
19401   __pyx_t_6 = (__pyx_t_1 != 0);
19402   if (__pyx_t_6) {
19403 
19404     /* "(tree fragment)":9
19405  *     __pyx_result = Enum.__new__(__pyx_type)
19406  *     if __pyx_state is not None:
19407  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
19408  *     return __pyx_result
19409  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19410  */
19411     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(1, 9, __pyx_L1_error)
19412     __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(1, 9, __pyx_L1_error)
19413     __Pyx_GOTREF(__pyx_t_3);
19414     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19415 
19416     /* "(tree fragment)":8
19417  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19418  *     __pyx_result = Enum.__new__(__pyx_type)
19419  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
19420  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19421  *     return __pyx_result
19422  */
19423   }
19424 
19425   /* "(tree fragment)":10
19426  *     if __pyx_state is not None:
19427  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19428  *     return __pyx_result             # <<<<<<<<<<<<<<
19429  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19430  *     __pyx_result.name = __pyx_state[0]
19431  */
19432   __Pyx_XDECREF(__pyx_r);
19433   __Pyx_INCREF(__pyx_v___pyx_result);
19434   __pyx_r = __pyx_v___pyx_result;
19435   goto __pyx_L0;
19436 
19437   /* "(tree fragment)":1
19438  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
19439  *     cdef object __pyx_PickleError
19440  *     cdef object __pyx_result
19441  */
19442 
19443   /* function exit code */
19444   __pyx_L1_error:;
19445   __Pyx_XDECREF(__pyx_t_2);
19446   __Pyx_XDECREF(__pyx_t_3);
19447   __Pyx_XDECREF(__pyx_t_4);
19448   __Pyx_XDECREF(__pyx_t_5);
19449   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19450   __pyx_r = NULL;
19451   __pyx_L0:;
19452   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
19453   __Pyx_XDECREF(__pyx_v___pyx_result);
19454   __Pyx_XGIVEREF(__pyx_r);
19455   __Pyx_RefNannyFinishContext();
19456   return __pyx_r;
19457 }
19458 
19459 /* "(tree fragment)":11
19460  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19461  *     return __pyx_result
19462  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
19463  *     __pyx_result.name = __pyx_state[0]
19464  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19465  */
19466 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)19467 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
19468   PyObject *__pyx_r = NULL;
19469   __Pyx_RefNannyDeclarations
19470   PyObject *__pyx_t_1 = NULL;
19471   int __pyx_t_2;
19472   Py_ssize_t __pyx_t_3;
19473   int __pyx_t_4;
19474   int __pyx_t_5;
19475   PyObject *__pyx_t_6 = NULL;
19476   PyObject *__pyx_t_7 = NULL;
19477   PyObject *__pyx_t_8 = NULL;
19478   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
19479 
19480   /* "(tree fragment)":12
19481  *     return __pyx_result
19482  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19483  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
19484  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19485  *         __pyx_result.__dict__.update(__pyx_state[1])
19486  */
19487   if (unlikely(__pyx_v___pyx_state == Py_None)) {
19488     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
19489     __PYX_ERR(1, 12, __pyx_L1_error)
19490   }
19491   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
19492   __Pyx_GOTREF(__pyx_t_1);
19493   __Pyx_GIVEREF(__pyx_t_1);
19494   __Pyx_GOTREF(__pyx_v___pyx_result->name);
19495   __Pyx_DECREF(__pyx_v___pyx_result->name);
19496   __pyx_v___pyx_result->name = __pyx_t_1;
19497   __pyx_t_1 = 0;
19498 
19499   /* "(tree fragment)":13
19500  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19501  *     __pyx_result.name = __pyx_state[0]
19502  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
19503  *         __pyx_result.__dict__.update(__pyx_state[1])
19504  */
19505   if (unlikely(__pyx_v___pyx_state == Py_None)) {
19506     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
19507     __PYX_ERR(1, 13, __pyx_L1_error)
19508   }
19509   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
19510   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
19511   if (__pyx_t_4) {
19512   } else {
19513     __pyx_t_2 = __pyx_t_4;
19514     goto __pyx_L4_bool_binop_done;
19515   }
19516   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
19517   __pyx_t_5 = (__pyx_t_4 != 0);
19518   __pyx_t_2 = __pyx_t_5;
19519   __pyx_L4_bool_binop_done:;
19520   if (__pyx_t_2) {
19521 
19522     /* "(tree fragment)":14
19523  *     __pyx_result.name = __pyx_state[0]
19524  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19525  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
19526  */
19527     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
19528     __Pyx_GOTREF(__pyx_t_6);
19529     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
19530     __Pyx_GOTREF(__pyx_t_7);
19531     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19532     if (unlikely(__pyx_v___pyx_state == Py_None)) {
19533       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
19534       __PYX_ERR(1, 14, __pyx_L1_error)
19535     }
19536     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
19537     __Pyx_GOTREF(__pyx_t_6);
19538     __pyx_t_8 = NULL;
19539     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
19540       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
19541       if (likely(__pyx_t_8)) {
19542         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
19543         __Pyx_INCREF(__pyx_t_8);
19544         __Pyx_INCREF(function);
19545         __Pyx_DECREF_SET(__pyx_t_7, function);
19546       }
19547     }
19548     __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);
19549     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
19550     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19551     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
19552     __Pyx_GOTREF(__pyx_t_1);
19553     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
19554     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19555 
19556     /* "(tree fragment)":13
19557  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19558  *     __pyx_result.name = __pyx_state[0]
19559  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
19560  *         __pyx_result.__dict__.update(__pyx_state[1])
19561  */
19562   }
19563 
19564   /* "(tree fragment)":11
19565  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19566  *     return __pyx_result
19567  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
19568  *     __pyx_result.name = __pyx_state[0]
19569  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19570  */
19571 
19572   /* function exit code */
19573   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19574   goto __pyx_L0;
19575   __pyx_L1_error:;
19576   __Pyx_XDECREF(__pyx_t_1);
19577   __Pyx_XDECREF(__pyx_t_6);
19578   __Pyx_XDECREF(__pyx_t_7);
19579   __Pyx_XDECREF(__pyx_t_8);
19580   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
19581   __pyx_r = 0;
19582   __pyx_L0:;
19583   __Pyx_XGIVEREF(__pyx_r);
19584   __Pyx_RefNannyFinishContext();
19585   return __pyx_r;
19586 }
19587 static struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_PriorityQueue __pyx_vtable_2yt_9utilities_3lib_14distance_queue_PriorityQueue;
19588 
__pyx_tp_new_2yt_9utilities_3lib_14distance_queue_PriorityQueue(PyTypeObject * t,PyObject * a,PyObject * k)19589 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14distance_queue_PriorityQueue(PyTypeObject *t, PyObject *a, PyObject *k) {
19590   struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *p;
19591   PyObject *o;
19592   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
19593     o = (*t->tp_alloc)(t, 0);
19594   } else {
19595     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
19596   }
19597   if (unlikely(!o)) return 0;
19598   p = ((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *)o);
19599   p->__pyx_vtab = __pyx_vtabptr_2yt_9utilities_3lib_14distance_queue_PriorityQueue;
19600   if (unlikely(__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_1__cinit__(o, a, k) < 0)) goto bad;
19601   return o;
19602   bad:
19603   Py_DECREF(o); o = 0;
19604   return NULL;
19605 }
19606 
__pyx_tp_dealloc_2yt_9utilities_3lib_14distance_queue_PriorityQueue(PyObject * o)19607 static void __pyx_tp_dealloc_2yt_9utilities_3lib_14distance_queue_PriorityQueue(PyObject *o) {
19608   #if CYTHON_USE_TP_FINALIZE
19609   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))) {
19610     if (PyObject_CallFinalizerFromDealloc(o)) return;
19611   }
19612   #endif
19613   (*Py_TYPE(o)->tp_free)(o);
19614 }
19615 
19616 static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14distance_queue_PriorityQueue[] = {
19617   {"__reduce_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_3__reduce_cython__, METH_NOARGS, 0},
19618   {"__setstate_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_5__setstate_cython__, METH_O, 0},
19619   {0, 0, 0, 0}
19620 };
19621 
19622 static PyTypeObject __pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue = {
19623   PyVarObject_HEAD_INIT(0, 0)
19624   "yt.utilities.lib.distance_queue.PriorityQueue", /*tp_name*/
19625   sizeof(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue), /*tp_basicsize*/
19626   0, /*tp_itemsize*/
19627   __pyx_tp_dealloc_2yt_9utilities_3lib_14distance_queue_PriorityQueue, /*tp_dealloc*/
19628   0, /*tp_print*/
19629   0, /*tp_getattr*/
19630   0, /*tp_setattr*/
19631   #if PY_MAJOR_VERSION < 3
19632   0, /*tp_compare*/
19633   #endif
19634   #if PY_MAJOR_VERSION >= 3
19635   0, /*tp_as_async*/
19636   #endif
19637   0, /*tp_repr*/
19638   0, /*tp_as_number*/
19639   0, /*tp_as_sequence*/
19640   0, /*tp_as_mapping*/
19641   0, /*tp_hash*/
19642   0, /*tp_call*/
19643   0, /*tp_str*/
19644   0, /*tp_getattro*/
19645   0, /*tp_setattro*/
19646   0, /*tp_as_buffer*/
19647   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
19648   "This class acts as a \"priority-queue.\"  It was extracted from the\n    DistanceQueue object so that it could serve as a general-purpose method for\n    storing the N-most \"valuable\" objects.  It's relatively simple, in that it\n    provides storage for a single int64 (which is usually an 'index' into an\n    external array or list) and a single float64 \"value\" associated with them.\n    You can insert new objects, and then if it's already at maxn objects in it,\n    it'll bump the least valuable one off the end.  Of particular note is that\n    *lower* values are considered to be *more valuable* than higher ones; this\n    is because our typical use case is to store radii.\n    ", /*tp_doc*/
19649   0, /*tp_traverse*/
19650   0, /*tp_clear*/
19651   0, /*tp_richcompare*/
19652   0, /*tp_weaklistoffset*/
19653   0, /*tp_iter*/
19654   0, /*tp_iternext*/
19655   __pyx_methods_2yt_9utilities_3lib_14distance_queue_PriorityQueue, /*tp_methods*/
19656   0, /*tp_members*/
19657   0, /*tp_getset*/
19658   0, /*tp_base*/
19659   0, /*tp_dict*/
19660   0, /*tp_descr_get*/
19661   0, /*tp_descr_set*/
19662   0, /*tp_dictoffset*/
19663   0, /*tp_init*/
19664   0, /*tp_alloc*/
19665   __pyx_tp_new_2yt_9utilities_3lib_14distance_queue_PriorityQueue, /*tp_new*/
19666   0, /*tp_free*/
19667   0, /*tp_is_gc*/
19668   0, /*tp_bases*/
19669   0, /*tp_mro*/
19670   0, /*tp_cache*/
19671   0, /*tp_subclasses*/
19672   0, /*tp_weaklist*/
19673   0, /*tp_del*/
19674   0, /*tp_version_tag*/
19675   #if PY_VERSION_HEX >= 0x030400a1
19676   0, /*tp_finalize*/
19677   #endif
19678   #if PY_VERSION_HEX >= 0x030800b1
19679   0, /*tp_vectorcall*/
19680   #endif
19681 };
19682 static struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_DistanceQueue __pyx_vtable_2yt_9utilities_3lib_14distance_queue_DistanceQueue;
19683 
__pyx_tp_new_2yt_9utilities_3lib_14distance_queue_DistanceQueue(PyTypeObject * t,PyObject * a,PyObject * k)19684 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_14distance_queue_DistanceQueue(PyTypeObject *t, PyObject *a, PyObject *k) {
19685   struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *p;
19686   PyObject *o = __pyx_tp_new_2yt_9utilities_3lib_14distance_queue_PriorityQueue(t, a, k);
19687   if (unlikely(!o)) return 0;
19688   p = ((struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *)o);
19689   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2yt_9utilities_3lib_14distance_queue_PriorityQueue*)__pyx_vtabptr_2yt_9utilities_3lib_14distance_queue_DistanceQueue;
19690   if (unlikely(__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_1__cinit__(o, a, k) < 0)) goto bad;
19691   return o;
19692   bad:
19693   Py_DECREF(o); o = 0;
19694   return NULL;
19695 }
19696 
__pyx_tp_dealloc_2yt_9utilities_3lib_14distance_queue_DistanceQueue(PyObject * o)19697 static void __pyx_tp_dealloc_2yt_9utilities_3lib_14distance_queue_DistanceQueue(PyObject *o) {
19698   #if CYTHON_USE_TP_FINALIZE
19699   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))) {
19700     if (PyObject_CallFinalizerFromDealloc(o)) return;
19701   }
19702   #endif
19703   {
19704     PyObject *etype, *eval, *etb;
19705     PyErr_Fetch(&etype, &eval, &etb);
19706     ++Py_REFCNT(o);
19707     __pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_5__dealloc__(o);
19708     --Py_REFCNT(o);
19709     PyErr_Restore(etype, eval, etb);
19710   }
19711   __pyx_tp_dealloc_2yt_9utilities_3lib_14distance_queue_PriorityQueue(o);
19712 }
19713 
19714 static PyMethodDef __pyx_methods_2yt_9utilities_3lib_14distance_queue_DistanceQueue[] = {
19715   {"setup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_3setup, METH_VARARGS|METH_KEYWORDS, 0},
19716   {"find_nearest", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_7find_nearest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_6find_nearest},
19717   {"__reduce_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_9__reduce_cython__, METH_NOARGS, 0},
19718   {"__setstate_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_11__setstate_cython__, METH_O, 0},
19719   {0, 0, 0, 0}
19720 };
19721 
19722 static PyTypeObject __pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue = {
19723   PyVarObject_HEAD_INIT(0, 0)
19724   "yt.utilities.lib.distance_queue.DistanceQueue", /*tp_name*/
19725   sizeof(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue), /*tp_basicsize*/
19726   0, /*tp_itemsize*/
19727   __pyx_tp_dealloc_2yt_9utilities_3lib_14distance_queue_DistanceQueue, /*tp_dealloc*/
19728   0, /*tp_print*/
19729   0, /*tp_getattr*/
19730   0, /*tp_setattr*/
19731   #if PY_MAJOR_VERSION < 3
19732   0, /*tp_compare*/
19733   #endif
19734   #if PY_MAJOR_VERSION >= 3
19735   0, /*tp_as_async*/
19736   #endif
19737   0, /*tp_repr*/
19738   0, /*tp_as_number*/
19739   0, /*tp_as_sequence*/
19740   0, /*tp_as_mapping*/
19741   0, /*tp_hash*/
19742   0, /*tp_call*/
19743   0, /*tp_str*/
19744   0, /*tp_getattro*/
19745   0, /*tp_setattro*/
19746   0, /*tp_as_buffer*/
19747   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
19748   "This is a distance queue object, designed to incrementally evaluate N\n    positions against a reference point.  It is initialized with the maximum\n    number that are to be retained (i.e., maxn-nearest neighbors).", /*tp_doc*/
19749   0, /*tp_traverse*/
19750   0, /*tp_clear*/
19751   0, /*tp_richcompare*/
19752   0, /*tp_weaklistoffset*/
19753   0, /*tp_iter*/
19754   0, /*tp_iternext*/
19755   __pyx_methods_2yt_9utilities_3lib_14distance_queue_DistanceQueue, /*tp_methods*/
19756   0, /*tp_members*/
19757   0, /*tp_getset*/
19758   0, /*tp_base*/
19759   0, /*tp_dict*/
19760   0, /*tp_descr_get*/
19761   0, /*tp_descr_set*/
19762   0, /*tp_dictoffset*/
19763   0, /*tp_init*/
19764   0, /*tp_alloc*/
19765   __pyx_tp_new_2yt_9utilities_3lib_14distance_queue_DistanceQueue, /*tp_new*/
19766   0, /*tp_free*/
19767   0, /*tp_is_gc*/
19768   0, /*tp_bases*/
19769   0, /*tp_mro*/
19770   0, /*tp_cache*/
19771   0, /*tp_subclasses*/
19772   0, /*tp_weaklist*/
19773   0, /*tp_del*/
19774   0, /*tp_version_tag*/
19775   #if PY_VERSION_HEX >= 0x030400a1
19776   0, /*tp_finalize*/
19777   #endif
19778   #if PY_VERSION_HEX >= 0x030800b1
19779   0, /*tp_vectorcall*/
19780   #endif
19781 };
19782 static struct __pyx_vtabstruct_array __pyx_vtable_array;
19783 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)19784 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
19785   struct __pyx_array_obj *p;
19786   PyObject *o;
19787   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
19788     o = (*t->tp_alloc)(t, 0);
19789   } else {
19790     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
19791   }
19792   if (unlikely(!o)) return 0;
19793   p = ((struct __pyx_array_obj *)o);
19794   p->__pyx_vtab = __pyx_vtabptr_array;
19795   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
19796   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
19797   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
19798   return o;
19799   bad:
19800   Py_DECREF(o); o = 0;
19801   return NULL;
19802 }
19803 
__pyx_tp_dealloc_array(PyObject * o)19804 static void __pyx_tp_dealloc_array(PyObject *o) {
19805   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
19806   #if CYTHON_USE_TP_FINALIZE
19807   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))) {
19808     if (PyObject_CallFinalizerFromDealloc(o)) return;
19809   }
19810   #endif
19811   {
19812     PyObject *etype, *eval, *etb;
19813     PyErr_Fetch(&etype, &eval, &etb);
19814     ++Py_REFCNT(o);
19815     __pyx_array___dealloc__(o);
19816     --Py_REFCNT(o);
19817     PyErr_Restore(etype, eval, etb);
19818   }
19819   Py_CLEAR(p->mode);
19820   Py_CLEAR(p->_format);
19821   (*Py_TYPE(o)->tp_free)(o);
19822 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)19823 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
19824   PyObject *r;
19825   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
19826   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
19827   Py_DECREF(x);
19828   return r;
19829 }
19830 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)19831 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
19832   if (v) {
19833     return __pyx_array___setitem__(o, i, v);
19834   }
19835   else {
19836     PyErr_Format(PyExc_NotImplementedError,
19837       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
19838     return -1;
19839   }
19840 }
19841 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)19842 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
19843   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
19844   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
19845     PyErr_Clear();
19846     v = __pyx_array___getattr__(o, n);
19847   }
19848   return v;
19849 }
19850 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)19851 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
19852   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
19853 }
19854 
19855 static PyMethodDef __pyx_methods_array[] = {
19856   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
19857   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
19858   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
19859   {0, 0, 0, 0}
19860 };
19861 
19862 static struct PyGetSetDef __pyx_getsets_array[] = {
19863   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
19864   {0, 0, 0, 0, 0}
19865 };
19866 
19867 static PySequenceMethods __pyx_tp_as_sequence_array = {
19868   __pyx_array___len__, /*sq_length*/
19869   0, /*sq_concat*/
19870   0, /*sq_repeat*/
19871   __pyx_sq_item_array, /*sq_item*/
19872   0, /*sq_slice*/
19873   0, /*sq_ass_item*/
19874   0, /*sq_ass_slice*/
19875   0, /*sq_contains*/
19876   0, /*sq_inplace_concat*/
19877   0, /*sq_inplace_repeat*/
19878 };
19879 
19880 static PyMappingMethods __pyx_tp_as_mapping_array = {
19881   __pyx_array___len__, /*mp_length*/
19882   __pyx_array___getitem__, /*mp_subscript*/
19883   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
19884 };
19885 
19886 static PyBufferProcs __pyx_tp_as_buffer_array = {
19887   #if PY_MAJOR_VERSION < 3
19888   0, /*bf_getreadbuffer*/
19889   #endif
19890   #if PY_MAJOR_VERSION < 3
19891   0, /*bf_getwritebuffer*/
19892   #endif
19893   #if PY_MAJOR_VERSION < 3
19894   0, /*bf_getsegcount*/
19895   #endif
19896   #if PY_MAJOR_VERSION < 3
19897   0, /*bf_getcharbuffer*/
19898   #endif
19899   __pyx_array_getbuffer, /*bf_getbuffer*/
19900   0, /*bf_releasebuffer*/
19901 };
19902 
19903 static PyTypeObject __pyx_type___pyx_array = {
19904   PyVarObject_HEAD_INIT(0, 0)
19905   "yt.utilities.lib.distance_queue.array", /*tp_name*/
19906   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
19907   0, /*tp_itemsize*/
19908   __pyx_tp_dealloc_array, /*tp_dealloc*/
19909   0, /*tp_print*/
19910   0, /*tp_getattr*/
19911   0, /*tp_setattr*/
19912   #if PY_MAJOR_VERSION < 3
19913   0, /*tp_compare*/
19914   #endif
19915   #if PY_MAJOR_VERSION >= 3
19916   0, /*tp_as_async*/
19917   #endif
19918   0, /*tp_repr*/
19919   0, /*tp_as_number*/
19920   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
19921   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
19922   0, /*tp_hash*/
19923   0, /*tp_call*/
19924   0, /*tp_str*/
19925   __pyx_tp_getattro_array, /*tp_getattro*/
19926   0, /*tp_setattro*/
19927   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
19928   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
19929   0, /*tp_doc*/
19930   0, /*tp_traverse*/
19931   0, /*tp_clear*/
19932   0, /*tp_richcompare*/
19933   0, /*tp_weaklistoffset*/
19934   0, /*tp_iter*/
19935   0, /*tp_iternext*/
19936   __pyx_methods_array, /*tp_methods*/
19937   0, /*tp_members*/
19938   __pyx_getsets_array, /*tp_getset*/
19939   0, /*tp_base*/
19940   0, /*tp_dict*/
19941   0, /*tp_descr_get*/
19942   0, /*tp_descr_set*/
19943   0, /*tp_dictoffset*/
19944   0, /*tp_init*/
19945   0, /*tp_alloc*/
19946   __pyx_tp_new_array, /*tp_new*/
19947   0, /*tp_free*/
19948   0, /*tp_is_gc*/
19949   0, /*tp_bases*/
19950   0, /*tp_mro*/
19951   0, /*tp_cache*/
19952   0, /*tp_subclasses*/
19953   0, /*tp_weaklist*/
19954   0, /*tp_del*/
19955   0, /*tp_version_tag*/
19956   #if PY_VERSION_HEX >= 0x030400a1
19957   0, /*tp_finalize*/
19958   #endif
19959   #if PY_VERSION_HEX >= 0x030800b1
19960   0, /*tp_vectorcall*/
19961   #endif
19962 };
19963 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)19964 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
19965   struct __pyx_MemviewEnum_obj *p;
19966   PyObject *o;
19967   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
19968     o = (*t->tp_alloc)(t, 0);
19969   } else {
19970     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
19971   }
19972   if (unlikely(!o)) return 0;
19973   p = ((struct __pyx_MemviewEnum_obj *)o);
19974   p->name = Py_None; Py_INCREF(Py_None);
19975   return o;
19976 }
19977 
__pyx_tp_dealloc_Enum(PyObject * o)19978 static void __pyx_tp_dealloc_Enum(PyObject *o) {
19979   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
19980   #if CYTHON_USE_TP_FINALIZE
19981   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
19982     if (PyObject_CallFinalizerFromDealloc(o)) return;
19983   }
19984   #endif
19985   PyObject_GC_UnTrack(o);
19986   Py_CLEAR(p->name);
19987   (*Py_TYPE(o)->tp_free)(o);
19988 }
19989 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)19990 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
19991   int e;
19992   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
19993   if (p->name) {
19994     e = (*v)(p->name, a); if (e) return e;
19995   }
19996   return 0;
19997 }
19998 
__pyx_tp_clear_Enum(PyObject * o)19999 static int __pyx_tp_clear_Enum(PyObject *o) {
20000   PyObject* tmp;
20001   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20002   tmp = ((PyObject*)p->name);
20003   p->name = Py_None; Py_INCREF(Py_None);
20004   Py_XDECREF(tmp);
20005   return 0;
20006 }
20007 
20008 static PyMethodDef __pyx_methods_Enum[] = {
20009   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
20010   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
20011   {0, 0, 0, 0}
20012 };
20013 
20014 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
20015   PyVarObject_HEAD_INIT(0, 0)
20016   "yt.utilities.lib.distance_queue.Enum", /*tp_name*/
20017   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
20018   0, /*tp_itemsize*/
20019   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
20020   0, /*tp_print*/
20021   0, /*tp_getattr*/
20022   0, /*tp_setattr*/
20023   #if PY_MAJOR_VERSION < 3
20024   0, /*tp_compare*/
20025   #endif
20026   #if PY_MAJOR_VERSION >= 3
20027   0, /*tp_as_async*/
20028   #endif
20029   __pyx_MemviewEnum___repr__, /*tp_repr*/
20030   0, /*tp_as_number*/
20031   0, /*tp_as_sequence*/
20032   0, /*tp_as_mapping*/
20033   0, /*tp_hash*/
20034   0, /*tp_call*/
20035   0, /*tp_str*/
20036   0, /*tp_getattro*/
20037   0, /*tp_setattro*/
20038   0, /*tp_as_buffer*/
20039   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20040   0, /*tp_doc*/
20041   __pyx_tp_traverse_Enum, /*tp_traverse*/
20042   __pyx_tp_clear_Enum, /*tp_clear*/
20043   0, /*tp_richcompare*/
20044   0, /*tp_weaklistoffset*/
20045   0, /*tp_iter*/
20046   0, /*tp_iternext*/
20047   __pyx_methods_Enum, /*tp_methods*/
20048   0, /*tp_members*/
20049   0, /*tp_getset*/
20050   0, /*tp_base*/
20051   0, /*tp_dict*/
20052   0, /*tp_descr_get*/
20053   0, /*tp_descr_set*/
20054   0, /*tp_dictoffset*/
20055   __pyx_MemviewEnum___init__, /*tp_init*/
20056   0, /*tp_alloc*/
20057   __pyx_tp_new_Enum, /*tp_new*/
20058   0, /*tp_free*/
20059   0, /*tp_is_gc*/
20060   0, /*tp_bases*/
20061   0, /*tp_mro*/
20062   0, /*tp_cache*/
20063   0, /*tp_subclasses*/
20064   0, /*tp_weaklist*/
20065   0, /*tp_del*/
20066   0, /*tp_version_tag*/
20067   #if PY_VERSION_HEX >= 0x030400a1
20068   0, /*tp_finalize*/
20069   #endif
20070   #if PY_VERSION_HEX >= 0x030800b1
20071   0, /*tp_vectorcall*/
20072   #endif
20073 };
20074 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
20075 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)20076 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
20077   struct __pyx_memoryview_obj *p;
20078   PyObject *o;
20079   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20080     o = (*t->tp_alloc)(t, 0);
20081   } else {
20082     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20083   }
20084   if (unlikely(!o)) return 0;
20085   p = ((struct __pyx_memoryview_obj *)o);
20086   p->__pyx_vtab = __pyx_vtabptr_memoryview;
20087   p->obj = Py_None; Py_INCREF(Py_None);
20088   p->_size = Py_None; Py_INCREF(Py_None);
20089   p->_array_interface = Py_None; Py_INCREF(Py_None);
20090   p->view.obj = NULL;
20091   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
20092   return o;
20093   bad:
20094   Py_DECREF(o); o = 0;
20095   return NULL;
20096 }
20097 
__pyx_tp_dealloc_memoryview(PyObject * o)20098 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
20099   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20100   #if CYTHON_USE_TP_FINALIZE
20101   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20102     if (PyObject_CallFinalizerFromDealloc(o)) return;
20103   }
20104   #endif
20105   PyObject_GC_UnTrack(o);
20106   {
20107     PyObject *etype, *eval, *etb;
20108     PyErr_Fetch(&etype, &eval, &etb);
20109     ++Py_REFCNT(o);
20110     __pyx_memoryview___dealloc__(o);
20111     --Py_REFCNT(o);
20112     PyErr_Restore(etype, eval, etb);
20113   }
20114   Py_CLEAR(p->obj);
20115   Py_CLEAR(p->_size);
20116   Py_CLEAR(p->_array_interface);
20117   (*Py_TYPE(o)->tp_free)(o);
20118 }
20119 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)20120 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
20121   int e;
20122   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20123   if (p->obj) {
20124     e = (*v)(p->obj, a); if (e) return e;
20125   }
20126   if (p->_size) {
20127     e = (*v)(p->_size, a); if (e) return e;
20128   }
20129   if (p->_array_interface) {
20130     e = (*v)(p->_array_interface, a); if (e) return e;
20131   }
20132   if (p->view.obj) {
20133     e = (*v)(p->view.obj, a); if (e) return e;
20134   }
20135   return 0;
20136 }
20137 
__pyx_tp_clear_memoryview(PyObject * o)20138 static int __pyx_tp_clear_memoryview(PyObject *o) {
20139   PyObject* tmp;
20140   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20141   tmp = ((PyObject*)p->obj);
20142   p->obj = Py_None; Py_INCREF(Py_None);
20143   Py_XDECREF(tmp);
20144   tmp = ((PyObject*)p->_size);
20145   p->_size = Py_None; Py_INCREF(Py_None);
20146   Py_XDECREF(tmp);
20147   tmp = ((PyObject*)p->_array_interface);
20148   p->_array_interface = Py_None; Py_INCREF(Py_None);
20149   Py_XDECREF(tmp);
20150   Py_CLEAR(p->view.obj);
20151   return 0;
20152 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)20153 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
20154   PyObject *r;
20155   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
20156   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20157   Py_DECREF(x);
20158   return r;
20159 }
20160 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)20161 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
20162   if (v) {
20163     return __pyx_memoryview___setitem__(o, i, v);
20164   }
20165   else {
20166     PyErr_Format(PyExc_NotImplementedError,
20167       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20168     return -1;
20169   }
20170 }
20171 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)20172 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
20173   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
20174 }
20175 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)20176 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
20177   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
20178 }
20179 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)20180 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
20181   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
20182 }
20183 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)20184 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
20185   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
20186 }
20187 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)20188 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
20189   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
20190 }
20191 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)20192 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
20193   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
20194 }
20195 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)20196 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
20197   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
20198 }
20199 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)20200 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
20201   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
20202 }
20203 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)20204 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
20205   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
20206 }
20207 
20208 static PyMethodDef __pyx_methods_memoryview[] = {
20209   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
20210   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
20211   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
20212   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
20213   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
20214   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
20215   {0, 0, 0, 0}
20216 };
20217 
20218 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
20219   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
20220   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
20221   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
20222   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
20223   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
20224   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
20225   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
20226   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
20227   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
20228   {0, 0, 0, 0, 0}
20229 };
20230 
20231 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
20232   __pyx_memoryview___len__, /*sq_length*/
20233   0, /*sq_concat*/
20234   0, /*sq_repeat*/
20235   __pyx_sq_item_memoryview, /*sq_item*/
20236   0, /*sq_slice*/
20237   0, /*sq_ass_item*/
20238   0, /*sq_ass_slice*/
20239   0, /*sq_contains*/
20240   0, /*sq_inplace_concat*/
20241   0, /*sq_inplace_repeat*/
20242 };
20243 
20244 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
20245   __pyx_memoryview___len__, /*mp_length*/
20246   __pyx_memoryview___getitem__, /*mp_subscript*/
20247   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
20248 };
20249 
20250 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
20251   #if PY_MAJOR_VERSION < 3
20252   0, /*bf_getreadbuffer*/
20253   #endif
20254   #if PY_MAJOR_VERSION < 3
20255   0, /*bf_getwritebuffer*/
20256   #endif
20257   #if PY_MAJOR_VERSION < 3
20258   0, /*bf_getsegcount*/
20259   #endif
20260   #if PY_MAJOR_VERSION < 3
20261   0, /*bf_getcharbuffer*/
20262   #endif
20263   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
20264   0, /*bf_releasebuffer*/
20265 };
20266 
20267 static PyTypeObject __pyx_type___pyx_memoryview = {
20268   PyVarObject_HEAD_INIT(0, 0)
20269   "yt.utilities.lib.distance_queue.memoryview", /*tp_name*/
20270   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
20271   0, /*tp_itemsize*/
20272   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
20273   0, /*tp_print*/
20274   0, /*tp_getattr*/
20275   0, /*tp_setattr*/
20276   #if PY_MAJOR_VERSION < 3
20277   0, /*tp_compare*/
20278   #endif
20279   #if PY_MAJOR_VERSION >= 3
20280   0, /*tp_as_async*/
20281   #endif
20282   __pyx_memoryview___repr__, /*tp_repr*/
20283   0, /*tp_as_number*/
20284   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
20285   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
20286   0, /*tp_hash*/
20287   0, /*tp_call*/
20288   __pyx_memoryview___str__, /*tp_str*/
20289   0, /*tp_getattro*/
20290   0, /*tp_setattro*/
20291   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
20292   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20293   0, /*tp_doc*/
20294   __pyx_tp_traverse_memoryview, /*tp_traverse*/
20295   __pyx_tp_clear_memoryview, /*tp_clear*/
20296   0, /*tp_richcompare*/
20297   0, /*tp_weaklistoffset*/
20298   0, /*tp_iter*/
20299   0, /*tp_iternext*/
20300   __pyx_methods_memoryview, /*tp_methods*/
20301   0, /*tp_members*/
20302   __pyx_getsets_memoryview, /*tp_getset*/
20303   0, /*tp_base*/
20304   0, /*tp_dict*/
20305   0, /*tp_descr_get*/
20306   0, /*tp_descr_set*/
20307   0, /*tp_dictoffset*/
20308   0, /*tp_init*/
20309   0, /*tp_alloc*/
20310   __pyx_tp_new_memoryview, /*tp_new*/
20311   0, /*tp_free*/
20312   0, /*tp_is_gc*/
20313   0, /*tp_bases*/
20314   0, /*tp_mro*/
20315   0, /*tp_cache*/
20316   0, /*tp_subclasses*/
20317   0, /*tp_weaklist*/
20318   0, /*tp_del*/
20319   0, /*tp_version_tag*/
20320   #if PY_VERSION_HEX >= 0x030400a1
20321   0, /*tp_finalize*/
20322   #endif
20323   #if PY_VERSION_HEX >= 0x030800b1
20324   0, /*tp_vectorcall*/
20325   #endif
20326 };
20327 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
20328 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)20329 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
20330   struct __pyx_memoryviewslice_obj *p;
20331   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
20332   if (unlikely(!o)) return 0;
20333   p = ((struct __pyx_memoryviewslice_obj *)o);
20334   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
20335   p->from_object = Py_None; Py_INCREF(Py_None);
20336   p->from_slice.memview = NULL;
20337   return o;
20338 }
20339 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)20340 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
20341   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
20342   #if CYTHON_USE_TP_FINALIZE
20343   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20344     if (PyObject_CallFinalizerFromDealloc(o)) return;
20345   }
20346   #endif
20347   PyObject_GC_UnTrack(o);
20348   {
20349     PyObject *etype, *eval, *etb;
20350     PyErr_Fetch(&etype, &eval, &etb);
20351     ++Py_REFCNT(o);
20352     __pyx_memoryviewslice___dealloc__(o);
20353     --Py_REFCNT(o);
20354     PyErr_Restore(etype, eval, etb);
20355   }
20356   Py_CLEAR(p->from_object);
20357   PyObject_GC_Track(o);
20358   __pyx_tp_dealloc_memoryview(o);
20359 }
20360 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)20361 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
20362   int e;
20363   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
20364   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
20365   if (p->from_object) {
20366     e = (*v)(p->from_object, a); if (e) return e;
20367   }
20368   return 0;
20369 }
20370 
__pyx_tp_clear__memoryviewslice(PyObject * o)20371 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
20372   PyObject* tmp;
20373   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
20374   __pyx_tp_clear_memoryview(o);
20375   tmp = ((PyObject*)p->from_object);
20376   p->from_object = Py_None; Py_INCREF(Py_None);
20377   Py_XDECREF(tmp);
20378   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
20379   return 0;
20380 }
20381 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)20382 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
20383   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
20384 }
20385 
20386 static PyMethodDef __pyx_methods__memoryviewslice[] = {
20387   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
20388   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
20389   {0, 0, 0, 0}
20390 };
20391 
20392 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
20393   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
20394   {0, 0, 0, 0, 0}
20395 };
20396 
20397 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
20398   PyVarObject_HEAD_INIT(0, 0)
20399   "yt.utilities.lib.distance_queue._memoryviewslice", /*tp_name*/
20400   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
20401   0, /*tp_itemsize*/
20402   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
20403   0, /*tp_print*/
20404   0, /*tp_getattr*/
20405   0, /*tp_setattr*/
20406   #if PY_MAJOR_VERSION < 3
20407   0, /*tp_compare*/
20408   #endif
20409   #if PY_MAJOR_VERSION >= 3
20410   0, /*tp_as_async*/
20411   #endif
20412   #if CYTHON_COMPILING_IN_PYPY
20413   __pyx_memoryview___repr__, /*tp_repr*/
20414   #else
20415   0, /*tp_repr*/
20416   #endif
20417   0, /*tp_as_number*/
20418   0, /*tp_as_sequence*/
20419   0, /*tp_as_mapping*/
20420   0, /*tp_hash*/
20421   0, /*tp_call*/
20422   #if CYTHON_COMPILING_IN_PYPY
20423   __pyx_memoryview___str__, /*tp_str*/
20424   #else
20425   0, /*tp_str*/
20426   #endif
20427   0, /*tp_getattro*/
20428   0, /*tp_setattro*/
20429   0, /*tp_as_buffer*/
20430   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20431   "Internal class for passing memoryview slices to Python", /*tp_doc*/
20432   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
20433   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
20434   0, /*tp_richcompare*/
20435   0, /*tp_weaklistoffset*/
20436   0, /*tp_iter*/
20437   0, /*tp_iternext*/
20438   __pyx_methods__memoryviewslice, /*tp_methods*/
20439   0, /*tp_members*/
20440   __pyx_getsets__memoryviewslice, /*tp_getset*/
20441   0, /*tp_base*/
20442   0, /*tp_dict*/
20443   0, /*tp_descr_get*/
20444   0, /*tp_descr_set*/
20445   0, /*tp_dictoffset*/
20446   0, /*tp_init*/
20447   0, /*tp_alloc*/
20448   __pyx_tp_new__memoryviewslice, /*tp_new*/
20449   0, /*tp_free*/
20450   0, /*tp_is_gc*/
20451   0, /*tp_bases*/
20452   0, /*tp_mro*/
20453   0, /*tp_cache*/
20454   0, /*tp_subclasses*/
20455   0, /*tp_weaklist*/
20456   0, /*tp_del*/
20457   0, /*tp_version_tag*/
20458   #if PY_VERSION_HEX >= 0x030400a1
20459   0, /*tp_finalize*/
20460   #endif
20461   #if PY_VERSION_HEX >= 0x030800b1
20462   0, /*tp_vectorcall*/
20463   #endif
20464 };
20465 
20466 static PyMethodDef __pyx_methods[] = {
20467   {0, 0, 0, 0}
20468 };
20469 
20470 #if PY_MAJOR_VERSION >= 3
20471 #if CYTHON_PEP489_MULTI_PHASE_INIT
20472 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
20473 static int __pyx_pymod_exec_distance_queue(PyObject* module); /*proto*/
20474 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
20475   {Py_mod_create, (void*)__pyx_pymod_create},
20476   {Py_mod_exec, (void*)__pyx_pymod_exec_distance_queue},
20477   {0, NULL}
20478 };
20479 #endif
20480 
20481 static struct PyModuleDef __pyx_moduledef = {
20482     PyModuleDef_HEAD_INIT,
20483     "distance_queue",
20484     __pyx_k_Distance_queue_implementation, /* m_doc */
20485   #if CYTHON_PEP489_MULTI_PHASE_INIT
20486     0, /* m_size */
20487   #else
20488     -1, /* m_size */
20489   #endif
20490     __pyx_methods /* m_methods */,
20491   #if CYTHON_PEP489_MULTI_PHASE_INIT
20492     __pyx_moduledef_slots, /* m_slots */
20493   #else
20494     NULL, /* m_reload */
20495   #endif
20496     NULL, /* m_traverse */
20497     NULL, /* m_clear */
20498     NULL /* m_free */
20499 };
20500 #endif
20501 #ifndef CYTHON_SMALL_CODE
20502 #if defined(__clang__)
20503     #define CYTHON_SMALL_CODE
20504 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
20505     #define CYTHON_SMALL_CODE __attribute__((cold))
20506 #else
20507     #define CYTHON_SMALL_CODE
20508 #endif
20509 #endif
20510 
20511 static __Pyx_StringTabEntry __pyx_string_tab[] = {
20512   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
20513   {&__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},
20514   {&__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},
20515   {&__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},
20516   {&__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},
20517   {&__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},
20518   {&__pyx_n_s_DW, __pyx_k_DW, sizeof(__pyx_k_DW), 0, 0, 1, 1},
20519   {&__pyx_n_s_DistanceQueue, __pyx_k_DistanceQueue, sizeof(__pyx_k_DistanceQueue), 0, 0, 1, 1},
20520   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
20521   {&__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},
20522   {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
20523   {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
20524   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
20525   {&__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},
20526   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
20527   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
20528   {&__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},
20529   {&__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},
20530   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
20531   {&__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},
20532   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
20533   {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
20534   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
20535   {&__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},
20536   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
20537   {&__pyx_n_s_PriorityQueue, __pyx_k_PriorityQueue, sizeof(__pyx_k_PriorityQueue), 0, 0, 1, 1},
20538   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
20539   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
20540   {&__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},
20541   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
20542   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
20543   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
20544   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
20545   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
20546   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
20547   {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1},
20548   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
20549   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
20550   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
20551   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
20552   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
20553   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
20554   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
20555   {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
20556   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
20557   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
20558   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
20559   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
20560   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
20561   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
20562   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
20563   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
20564   {&__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},
20565   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
20566   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
20567   {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1},
20568   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
20569   {&__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},
20570   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
20571   {&__pyx_n_s_maxn, __pyx_k_maxn, sizeof(__pyx_k_maxn), 0, 0, 1, 1},
20572   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
20573   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
20574   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
20575   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
20576   {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
20577   {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
20578   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
20579   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
20580   {&__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},
20581   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
20582   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
20583   {&__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},
20584   {&__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},
20585   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
20586   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
20587   {&__pyx_n_s_periodicity, __pyx_k_periodicity, sizeof(__pyx_k_periodicity), 0, 0, 1, 1},
20588   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
20589   {&__pyx_n_s_points, __pyx_k_points, sizeof(__pyx_k_points), 0, 0, 1, 1},
20590   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
20591   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
20592   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
20593   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
20594   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
20595   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
20596   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
20597   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
20598   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
20599   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
20600   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
20601   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
20602   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
20603   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
20604   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
20605   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
20606   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
20607   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
20608   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
20609   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
20610   {&__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},
20611   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
20612   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
20613   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
20614   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
20615   {&__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},
20616   {&__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},
20617   {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
20618   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
20619   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
20620   {0, 0, 0, 0, 0, 0, 0}
20621 };
__Pyx_InitCachedBuiltins(void)20622 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
20623   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 44, __pyx_L1_error)
20624   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
20625   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 117, __pyx_L1_error)
20626   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 272, __pyx_L1_error)
20627   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 1038, __pyx_L1_error)
20628   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
20629   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
20630   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 400, __pyx_L1_error)
20631   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 609, __pyx_L1_error)
20632   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 828, __pyx_L1_error)
20633   return 0;
20634   __pyx_L1_error:;
20635   return -1;
20636 }
20637 
__Pyx_InitCachedConstants(void)20638 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
20639   __Pyx_RefNannyDeclarations
20640   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
20641 
20642   /* "(tree fragment)":2
20643  * def __reduce_cython__(self):
20644  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20645  * def __setstate_cython__(self, __pyx_state):
20646  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20647  */
20648   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error)
20649   __Pyx_GOTREF(__pyx_tuple_);
20650   __Pyx_GIVEREF(__pyx_tuple_);
20651 
20652   /* "(tree fragment)":4
20653  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20654  * def __setstate_cython__(self, __pyx_state):
20655  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20656  */
20657   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error)
20658   __Pyx_GOTREF(__pyx_tuple__2);
20659   __Pyx_GIVEREF(__pyx_tuple__2);
20660 
20661   /* "(tree fragment)":2
20662  * def __reduce_cython__(self):
20663  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20664  * def __setstate_cython__(self, __pyx_state):
20665  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20666  */
20667   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 2, __pyx_L1_error)
20668   __Pyx_GOTREF(__pyx_tuple__3);
20669   __Pyx_GIVEREF(__pyx_tuple__3);
20670 
20671   /* "(tree fragment)":4
20672  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20673  * def __setstate_cython__(self, __pyx_state):
20674  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20675  */
20676   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 4, __pyx_L1_error)
20677   __Pyx_GOTREF(__pyx_tuple__4);
20678   __Pyx_GIVEREF(__pyx_tuple__4);
20679 
20680   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
20681  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
20682  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
20683  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
20684  *
20685  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
20686  */
20687   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 272, __pyx_L1_error)
20688   __Pyx_GOTREF(__pyx_tuple__5);
20689   __Pyx_GIVEREF(__pyx_tuple__5);
20690 
20691   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
20692  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
20693  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
20694  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
20695  *
20696  *             info.buf = PyArray_DATA(self)
20697  */
20698   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 276, __pyx_L1_error)
20699   __Pyx_GOTREF(__pyx_tuple__6);
20700   __Pyx_GIVEREF(__pyx_tuple__6);
20701 
20702   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
20703  *                 if ((descr.byteorder == c'>' and little_endian) or
20704  *                     (descr.byteorder == c'<' and not little_endian)):
20705  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
20706  *                 if   t == NPY_BYTE:        f = "b"
20707  *                 elif t == NPY_UBYTE:       f = "B"
20708  */
20709   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 306, __pyx_L1_error)
20710   __Pyx_GOTREF(__pyx_tuple__7);
20711   __Pyx_GIVEREF(__pyx_tuple__7);
20712 
20713   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
20714  *
20715  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
20716  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
20717  *
20718  *         if ((child.byteorder == c'>' and little_endian) or
20719  */
20720   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 856, __pyx_L1_error)
20721   __Pyx_GOTREF(__pyx_tuple__8);
20722   __Pyx_GIVEREF(__pyx_tuple__8);
20723 
20724   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
20725  *             t = child.type_num
20726  *             if end - f < 5:
20727  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
20728  *
20729  *             # Until ticket #99 is fixed, use integers to avoid warnings
20730  */
20731   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 880, __pyx_L1_error)
20732   __Pyx_GOTREF(__pyx_tuple__9);
20733   __Pyx_GIVEREF(__pyx_tuple__9);
20734 
20735   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
20736  *         _import_array()
20737  *     except Exception:
20738  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
20739  *
20740  * cdef inline int import_umath() except -1:
20741  */
20742   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 1038, __pyx_L1_error)
20743   __Pyx_GOTREF(__pyx_tuple__10);
20744   __Pyx_GIVEREF(__pyx_tuple__10);
20745 
20746   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
20747  *         _import_umath()
20748  *     except Exception:
20749  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
20750  *
20751  * cdef inline int import_ufunc() except -1:
20752  */
20753   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 1044, __pyx_L1_error)
20754   __Pyx_GOTREF(__pyx_tuple__11);
20755   __Pyx_GIVEREF(__pyx_tuple__11);
20756 
20757   /* "View.MemoryView":133
20758  *
20759  *         if not self.ndim:
20760  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
20761  *
20762  *         if itemsize <= 0:
20763  */
20764   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 133, __pyx_L1_error)
20765   __Pyx_GOTREF(__pyx_tuple__12);
20766   __Pyx_GIVEREF(__pyx_tuple__12);
20767 
20768   /* "View.MemoryView":136
20769  *
20770  *         if itemsize <= 0:
20771  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
20772  *
20773  *         if not isinstance(format, bytes):
20774  */
20775   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 136, __pyx_L1_error)
20776   __Pyx_GOTREF(__pyx_tuple__13);
20777   __Pyx_GIVEREF(__pyx_tuple__13);
20778 
20779   /* "View.MemoryView":148
20780  *
20781  *         if not self._shape:
20782  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
20783  *
20784  *
20785  */
20786   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 148, __pyx_L1_error)
20787   __Pyx_GOTREF(__pyx_tuple__14);
20788   __Pyx_GIVEREF(__pyx_tuple__14);
20789 
20790   /* "View.MemoryView":176
20791  *             self.data = <char *>malloc(self.len)
20792  *             if not self.data:
20793  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
20794  *
20795  *             if self.dtype_is_object:
20796  */
20797   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 176, __pyx_L1_error)
20798   __Pyx_GOTREF(__pyx_tuple__15);
20799   __Pyx_GIVEREF(__pyx_tuple__15);
20800 
20801   /* "View.MemoryView":192
20802  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
20803  *         if not (flags & bufmode):
20804  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
20805  *         info.buf = self.data
20806  *         info.len = self.len
20807  */
20808   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 192, __pyx_L1_error)
20809   __Pyx_GOTREF(__pyx_tuple__16);
20810   __Pyx_GIVEREF(__pyx_tuple__16);
20811 
20812   /* "(tree fragment)":2
20813  * def __reduce_cython__(self):
20814  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20815  * def __setstate_cython__(self, __pyx_state):
20816  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20817  */
20818   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 2, __pyx_L1_error)
20819   __Pyx_GOTREF(__pyx_tuple__17);
20820   __Pyx_GIVEREF(__pyx_tuple__17);
20821 
20822   /* "(tree fragment)":4
20823  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20824  * def __setstate_cython__(self, __pyx_state):
20825  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20826  */
20827   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 4, __pyx_L1_error)
20828   __Pyx_GOTREF(__pyx_tuple__18);
20829   __Pyx_GIVEREF(__pyx_tuple__18);
20830 
20831   /* "View.MemoryView":414
20832  *     def __setitem__(memoryview self, object index, object value):
20833  *         if self.view.readonly:
20834  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
20835  *
20836  *         have_slices, index = _unellipsify(index, self.view.ndim)
20837  */
20838   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 414, __pyx_L1_error)
20839   __Pyx_GOTREF(__pyx_tuple__19);
20840   __Pyx_GIVEREF(__pyx_tuple__19);
20841 
20842   /* "View.MemoryView":491
20843  *             result = struct.unpack(self.view.format, bytesitem)
20844  *         except struct.error:
20845  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
20846  *         else:
20847  *             if len(self.view.format) == 1:
20848  */
20849   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 491, __pyx_L1_error)
20850   __Pyx_GOTREF(__pyx_tuple__20);
20851   __Pyx_GIVEREF(__pyx_tuple__20);
20852 
20853   /* "View.MemoryView":516
20854  *     def __getbuffer__(self, Py_buffer *info, int flags):
20855  *         if flags & PyBUF_WRITABLE and self.view.readonly:
20856  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
20857  *
20858  *         if flags & PyBUF_ND:
20859  */
20860   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 516, __pyx_L1_error)
20861   __Pyx_GOTREF(__pyx_tuple__21);
20862   __Pyx_GIVEREF(__pyx_tuple__21);
20863 
20864   /* "View.MemoryView":566
20865  *         if self.view.strides == NULL:
20866  *
20867  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
20868  *
20869  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
20870  */
20871   __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 566, __pyx_L1_error)
20872   __Pyx_GOTREF(__pyx_tuple__22);
20873   __Pyx_GIVEREF(__pyx_tuple__22);
20874 
20875   /* "View.MemoryView":573
20876  *     def suboffsets(self):
20877  *         if self.view.suboffsets == NULL:
20878  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
20879  *
20880  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
20881  */
20882   __pyx_tuple__23 = PyTuple_New(1); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 573, __pyx_L1_error)
20883   __Pyx_GOTREF(__pyx_tuple__23);
20884   __Pyx_INCREF(__pyx_int_neg_1);
20885   __Pyx_GIVEREF(__pyx_int_neg_1);
20886   PyTuple_SET_ITEM(__pyx_tuple__23, 0, __pyx_int_neg_1);
20887   __Pyx_GIVEREF(__pyx_tuple__23);
20888 
20889   /* "(tree fragment)":2
20890  * def __reduce_cython__(self):
20891  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20892  * def __setstate_cython__(self, __pyx_state):
20893  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20894  */
20895   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 2, __pyx_L1_error)
20896   __Pyx_GOTREF(__pyx_tuple__24);
20897   __Pyx_GIVEREF(__pyx_tuple__24);
20898 
20899   /* "(tree fragment)":4
20900  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20901  * def __setstate_cython__(self, __pyx_state):
20902  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20903  */
20904   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 4, __pyx_L1_error)
20905   __Pyx_GOTREF(__pyx_tuple__25);
20906   __Pyx_GIVEREF(__pyx_tuple__25);
20907 
20908   /* "View.MemoryView":678
20909  *         if item is Ellipsis:
20910  *             if not seen_ellipsis:
20911  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
20912  *                 seen_ellipsis = True
20913  *             else:
20914  */
20915   __pyx_slice__26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(1, 678, __pyx_L1_error)
20916   __Pyx_GOTREF(__pyx_slice__26);
20917   __Pyx_GIVEREF(__pyx_slice__26);
20918 
20919   /* "View.MemoryView":699
20920  *     for suboffset in suboffsets[:ndim]:
20921  *         if suboffset >= 0:
20922  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
20923  *
20924  *
20925  */
20926   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 699, __pyx_L1_error)
20927   __Pyx_GOTREF(__pyx_tuple__27);
20928   __Pyx_GIVEREF(__pyx_tuple__27);
20929 
20930   /* "(tree fragment)":2
20931  * def __reduce_cython__(self):
20932  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20933  * def __setstate_cython__(self, __pyx_state):
20934  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20935  */
20936   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 2, __pyx_L1_error)
20937   __Pyx_GOTREF(__pyx_tuple__28);
20938   __Pyx_GIVEREF(__pyx_tuple__28);
20939 
20940   /* "(tree fragment)":4
20941  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20942  * def __setstate_cython__(self, __pyx_state):
20943  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20944  */
20945   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 4, __pyx_L1_error)
20946   __Pyx_GOTREF(__pyx_tuple__29);
20947   __Pyx_GIVEREF(__pyx_tuple__29);
20948 
20949   /* "View.MemoryView":286
20950  *         return self.name
20951  *
20952  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
20953  * cdef strided = Enum("<strided and direct>") # default
20954  * cdef indirect = Enum("<strided and indirect>")
20955  */
20956   __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 286, __pyx_L1_error)
20957   __Pyx_GOTREF(__pyx_tuple__30);
20958   __Pyx_GIVEREF(__pyx_tuple__30);
20959 
20960   /* "View.MemoryView":287
20961  *
20962  * cdef generic = Enum("<strided and direct or indirect>")
20963  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
20964  * cdef indirect = Enum("<strided and indirect>")
20965  *
20966  */
20967   __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 287, __pyx_L1_error)
20968   __Pyx_GOTREF(__pyx_tuple__31);
20969   __Pyx_GIVEREF(__pyx_tuple__31);
20970 
20971   /* "View.MemoryView":288
20972  * cdef generic = Enum("<strided and direct or indirect>")
20973  * cdef strided = Enum("<strided and direct>") # default
20974  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
20975  *
20976  *
20977  */
20978   __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 288, __pyx_L1_error)
20979   __Pyx_GOTREF(__pyx_tuple__32);
20980   __Pyx_GIVEREF(__pyx_tuple__32);
20981 
20982   /* "View.MemoryView":291
20983  *
20984  *
20985  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
20986  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
20987  *
20988  */
20989   __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 291, __pyx_L1_error)
20990   __Pyx_GOTREF(__pyx_tuple__33);
20991   __Pyx_GIVEREF(__pyx_tuple__33);
20992 
20993   /* "View.MemoryView":292
20994  *
20995  * cdef contiguous = Enum("<contiguous and direct>")
20996  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
20997  *
20998  *
20999  */
21000   __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 292, __pyx_L1_error)
21001   __Pyx_GOTREF(__pyx_tuple__34);
21002   __Pyx_GIVEREF(__pyx_tuple__34);
21003 
21004   /* "(tree fragment)":1
21005  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21006  *     cdef object __pyx_PickleError
21007  *     cdef object __pyx_result
21008  */
21009   __pyx_tuple__35 = 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__35)) __PYX_ERR(1, 1, __pyx_L1_error)
21010   __Pyx_GOTREF(__pyx_tuple__35);
21011   __Pyx_GIVEREF(__pyx_tuple__35);
21012   __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(1, 1, __pyx_L1_error)
21013   __Pyx_RefNannyFinishContext();
21014   return 0;
21015   __pyx_L1_error:;
21016   __Pyx_RefNannyFinishContext();
21017   return -1;
21018 }
21019 
__Pyx_InitGlobals(void)21020 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
21021   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
21022   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 2, __pyx_L1_error)
21023   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 2, __pyx_L1_error)
21024   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 2, __pyx_L1_error)
21025   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 2, __pyx_L1_error)
21026   return 0;
21027   __pyx_L1_error:;
21028   return -1;
21029 }
21030 
21031 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
21032 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
21033 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
21034 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
21035 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
21036 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
21037 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
21038 
__Pyx_modinit_global_init_code(void)21039 static int __Pyx_modinit_global_init_code(void) {
21040   __Pyx_RefNannyDeclarations
21041   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
21042   /*--- Global init code ---*/
21043   generic = Py_None; Py_INCREF(Py_None);
21044   strided = Py_None; Py_INCREF(Py_None);
21045   indirect = Py_None; Py_INCREF(Py_None);
21046   contiguous = Py_None; Py_INCREF(Py_None);
21047   indirect_contiguous = Py_None; Py_INCREF(Py_None);
21048   __Pyx_RefNannyFinishContext();
21049   return 0;
21050 }
21051 
__Pyx_modinit_variable_export_code(void)21052 static int __Pyx_modinit_variable_export_code(void) {
21053   __Pyx_RefNannyDeclarations
21054   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
21055   /*--- Variable export code ---*/
21056   __Pyx_RefNannyFinishContext();
21057   return 0;
21058 }
21059 
__Pyx_modinit_function_export_code(void)21060 static int __Pyx_modinit_function_export_code(void) {
21061   __Pyx_RefNannyDeclarations
21062   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
21063   /*--- Function export code ---*/
21064   if (__Pyx_ExportFunction("Neighbor_compare", (void (*)(void))__pyx_f_2yt_9utilities_3lib_14distance_queue_Neighbor_compare, "int (void *, void *)") < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21065   if (__Pyx_ExportFunction("r2dist", (void (*)(void))__pyx_f_2yt_9utilities_3lib_14distance_queue_r2dist, "__pyx_t_5numpy_float64_t (__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int *, __pyx_t_5numpy_float64_t)") < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21066   __Pyx_RefNannyFinishContext();
21067   return 0;
21068   __pyx_L1_error:;
21069   __Pyx_RefNannyFinishContext();
21070   return -1;
21071 }
21072 
__Pyx_modinit_type_init_code(void)21073 static int __Pyx_modinit_type_init_code(void) {
21074   __Pyx_RefNannyDeclarations
21075   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
21076   /*--- Type init code ---*/
21077   __pyx_vtabptr_2yt_9utilities_3lib_14distance_queue_PriorityQueue = &__pyx_vtable_2yt_9utilities_3lib_14distance_queue_PriorityQueue;
21078   __pyx_vtable_2yt_9utilities_3lib_14distance_queue_PriorityQueue.item_reset = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *))__pyx_f_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_item_reset;
21079   __pyx_vtable_2yt_9utilities_3lib_14distance_queue_PriorityQueue.item_insert = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_PriorityQueue *, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_float64_t))__pyx_f_2yt_9utilities_3lib_14distance_queue_13PriorityQueue_item_insert;
21080   if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
21081   #if PY_VERSION_HEX < 0x030800B1
21082   __pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue.tp_print = 0;
21083   #endif
21084   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue.tp_getattro == PyObject_GenericGetAttr)) {
21085     __pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21086   }
21087   if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14distance_queue_PriorityQueue) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
21088   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_PriorityQueue, (PyObject *)&__pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
21089   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
21090   __pyx_ptype_2yt_9utilities_3lib_14distance_queue_PriorityQueue = &__pyx_type_2yt_9utilities_3lib_14distance_queue_PriorityQueue;
21091   __pyx_vtabptr_2yt_9utilities_3lib_14distance_queue_DistanceQueue = &__pyx_vtable_2yt_9utilities_3lib_14distance_queue_DistanceQueue;
21092   __pyx_vtable_2yt_9utilities_3lib_14distance_queue_DistanceQueue.__pyx_base = *__pyx_vtabptr_2yt_9utilities_3lib_14distance_queue_PriorityQueue;
21093   __pyx_vtable_2yt_9utilities_3lib_14distance_queue_DistanceQueue._setup = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *, __pyx_t_5numpy_float64_t *, int *))__pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue__setup;
21094   __pyx_vtable_2yt_9utilities_3lib_14distance_queue_DistanceQueue.neighbor_eval = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_neighbor_eval;
21095   __pyx_vtable_2yt_9utilities_3lib_14distance_queue_DistanceQueue.neighbor_reset = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_14distance_queue_DistanceQueue *))__pyx_f_2yt_9utilities_3lib_14distance_queue_13DistanceQueue_neighbor_reset;
21096   __pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue.tp_base = __pyx_ptype_2yt_9utilities_3lib_14distance_queue_PriorityQueue;
21097   if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
21098   #if PY_VERSION_HEX < 0x030800B1
21099   __pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue.tp_print = 0;
21100   #endif
21101   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue.tp_getattro == PyObject_GenericGetAttr)) {
21102     __pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21103   }
21104   if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_14distance_queue_DistanceQueue) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
21105   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DistanceQueue, (PyObject *)&__pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
21106   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
21107   __pyx_ptype_2yt_9utilities_3lib_14distance_queue_DistanceQueue = &__pyx_type_2yt_9utilities_3lib_14distance_queue_DistanceQueue;
21108   __pyx_vtabptr_array = &__pyx_vtable_array;
21109   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
21110   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
21111   #if PY_VERSION_HEX < 0x030800B1
21112   __pyx_type___pyx_array.tp_print = 0;
21113   #endif
21114   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
21115   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
21116   __pyx_array_type = &__pyx_type___pyx_array;
21117   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
21118   #if PY_VERSION_HEX < 0x030800B1
21119   __pyx_type___pyx_MemviewEnum.tp_print = 0;
21120   #endif
21121   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
21122     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21123   }
21124   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
21125   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
21126   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
21127   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
21128   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
21129   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
21130   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
21131   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
21132   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
21133   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
21134   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
21135   #if PY_VERSION_HEX < 0x030800B1
21136   __pyx_type___pyx_memoryview.tp_print = 0;
21137   #endif
21138   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
21139     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21140   }
21141   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
21142   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
21143   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
21144   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
21145   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
21146   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
21147   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
21148   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
21149   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 961, __pyx_L1_error)
21150   #if PY_VERSION_HEX < 0x030800B1
21151   __pyx_type___pyx_memoryviewslice.tp_print = 0;
21152   #endif
21153   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
21154     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21155   }
21156   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 961, __pyx_L1_error)
21157   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 961, __pyx_L1_error)
21158   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
21159   __Pyx_RefNannyFinishContext();
21160   return 0;
21161   __pyx_L1_error:;
21162   __Pyx_RefNannyFinishContext();
21163   return -1;
21164 }
21165 
__Pyx_modinit_type_import_code(void)21166 static int __Pyx_modinit_type_import_code(void) {
21167   __Pyx_RefNannyDeclarations
21168   PyObject *__pyx_t_1 = NULL;
21169   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
21170   /*--- Type import code ---*/
21171   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
21172   __Pyx_GOTREF(__pyx_t_1);
21173   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
21174   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
21175   sizeof(PyTypeObject),
21176   #else
21177   sizeof(PyHeapTypeObject),
21178   #endif
21179   __Pyx_ImportType_CheckSize_Warn);
21180    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
21181   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21182   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 206, __pyx_L1_error)
21183   __Pyx_GOTREF(__pyx_t_1);
21184   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
21185    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 206, __pyx_L1_error)
21186   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
21187    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 229, __pyx_L1_error)
21188   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
21189    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 233, __pyx_L1_error)
21190   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
21191    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 242, __pyx_L1_error)
21192   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
21193    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 918, __pyx_L1_error)
21194   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21195   __Pyx_RefNannyFinishContext();
21196   return 0;
21197   __pyx_L1_error:;
21198   __Pyx_XDECREF(__pyx_t_1);
21199   __Pyx_RefNannyFinishContext();
21200   return -1;
21201 }
21202 
__Pyx_modinit_variable_import_code(void)21203 static int __Pyx_modinit_variable_import_code(void) {
21204   __Pyx_RefNannyDeclarations
21205   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
21206   /*--- Variable import code ---*/
21207   __Pyx_RefNannyFinishContext();
21208   return 0;
21209 }
21210 
__Pyx_modinit_function_import_code(void)21211 static int __Pyx_modinit_function_import_code(void) {
21212   __Pyx_RefNannyDeclarations
21213   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
21214   /*--- Function import code ---*/
21215   __Pyx_RefNannyFinishContext();
21216   return 0;
21217 }
21218 
21219 
21220 #if PY_MAJOR_VERSION < 3
21221 #ifdef CYTHON_NO_PYINIT_EXPORT
21222 #define __Pyx_PyMODINIT_FUNC void
21223 #else
21224 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
21225 #endif
21226 #else
21227 #ifdef CYTHON_NO_PYINIT_EXPORT
21228 #define __Pyx_PyMODINIT_FUNC PyObject *
21229 #else
21230 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
21231 #endif
21232 #endif
21233 
21234 
21235 #if PY_MAJOR_VERSION < 3
21236 __Pyx_PyMODINIT_FUNC initdistance_queue(void) CYTHON_SMALL_CODE; /*proto*/
initdistance_queue(void)21237 __Pyx_PyMODINIT_FUNC initdistance_queue(void)
21238 #else
21239 __Pyx_PyMODINIT_FUNC PyInit_distance_queue(void) CYTHON_SMALL_CODE; /*proto*/
21240 __Pyx_PyMODINIT_FUNC PyInit_distance_queue(void)
21241 #if CYTHON_PEP489_MULTI_PHASE_INIT
21242 {
21243   return PyModuleDef_Init(&__pyx_moduledef);
21244 }
21245 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
21246     #if PY_VERSION_HEX >= 0x030700A1
21247     static PY_INT64_T main_interpreter_id = -1;
21248     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
21249     if (main_interpreter_id == -1) {
21250         main_interpreter_id = current_id;
21251         return (unlikely(current_id == -1)) ? -1 : 0;
21252     } else if (unlikely(main_interpreter_id != current_id))
21253     #else
21254     static PyInterpreterState *main_interpreter = NULL;
21255     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
21256     if (!main_interpreter) {
21257         main_interpreter = current_interpreter;
21258     } else if (unlikely(main_interpreter != current_interpreter))
21259     #endif
21260     {
21261         PyErr_SetString(
21262             PyExc_ImportError,
21263             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
21264         return -1;
21265     }
21266     return 0;
21267 }
21268 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
21269     PyObject *value = PyObject_GetAttrString(spec, from_name);
21270     int result = 0;
21271     if (likely(value)) {
21272         if (allow_none || value != Py_None) {
21273             result = PyDict_SetItemString(moddict, to_name, value);
21274         }
21275         Py_DECREF(value);
21276     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
21277         PyErr_Clear();
21278     } else {
21279         result = -1;
21280     }
21281     return result;
21282 }
21283 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
21284     PyObject *module = NULL, *moddict, *modname;
21285     if (__Pyx_check_single_interpreter())
21286         return NULL;
21287     if (__pyx_m)
21288         return __Pyx_NewRef(__pyx_m);
21289     modname = PyObject_GetAttrString(spec, "name");
21290     if (unlikely(!modname)) goto bad;
21291     module = PyModule_NewObject(modname);
21292     Py_DECREF(modname);
21293     if (unlikely(!module)) goto bad;
21294     moddict = PyModule_GetDict(module);
21295     if (unlikely(!moddict)) goto bad;
21296     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
21297     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
21298     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
21299     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
21300     return module;
21301 bad:
21302     Py_XDECREF(module);
21303     return NULL;
21304 }
21305 
21306 
21307 static CYTHON_SMALL_CODE int __pyx_pymod_exec_distance_queue(PyObject *__pyx_pyinit_module)
21308 #endif
21309 #endif
21310 {
21311   PyObject *__pyx_t_1 = NULL;
21312   static PyThread_type_lock __pyx_t_2[8];
21313   __Pyx_RefNannyDeclarations
21314   #if CYTHON_PEP489_MULTI_PHASE_INIT
21315   if (__pyx_m) {
21316     if (__pyx_m == __pyx_pyinit_module) return 0;
21317     PyErr_SetString(PyExc_RuntimeError, "Module 'distance_queue' has already been imported. Re-initialisation is not supported.");
21318     return -1;
21319   }
21320   #elif PY_MAJOR_VERSION >= 3
21321   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
21322   #endif
21323   #if CYTHON_REFNANNY
21324 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
21325 if (!__Pyx_RefNanny) {
21326   PyErr_Clear();
21327   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
21328   if (!__Pyx_RefNanny)
21329       Py_FatalError("failed to import 'refnanny' module");
21330 }
21331 #endif
21332   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_distance_queue(void)", 0);
21333   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21334   #ifdef __Pxy_PyFrame_Initialize_Offsets
21335   __Pxy_PyFrame_Initialize_Offsets();
21336   #endif
21337   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 2, __pyx_L1_error)
21338   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 2, __pyx_L1_error)
21339   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 2, __pyx_L1_error)
21340   #ifdef __Pyx_CyFunction_USED
21341   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21342   #endif
21343   #ifdef __Pyx_FusedFunction_USED
21344   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21345   #endif
21346   #ifdef __Pyx_Coroutine_USED
21347   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21348   #endif
21349   #ifdef __Pyx_Generator_USED
21350   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21351   #endif
21352   #ifdef __Pyx_AsyncGen_USED
21353   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21354   #endif
21355   #ifdef __Pyx_StopAsyncIteration_USED
21356   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21357   #endif
21358   /*--- Library function declarations ---*/
21359   /*--- Threads initialization code ---*/
21360   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
21361   #ifdef WITH_THREAD /* Python build with threading support? */
21362   PyEval_InitThreads();
21363   #endif
21364   #endif
21365   /*--- Module creation code ---*/
21366   #if CYTHON_PEP489_MULTI_PHASE_INIT
21367   __pyx_m = __pyx_pyinit_module;
21368   Py_INCREF(__pyx_m);
21369   #else
21370   #if PY_MAJOR_VERSION < 3
21371   __pyx_m = Py_InitModule4("distance_queue", __pyx_methods, __pyx_k_Distance_queue_implementation, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
21372   #else
21373   __pyx_m = PyModule_Create(&__pyx_moduledef);
21374   #endif
21375   if (unlikely(!__pyx_m)) __PYX_ERR(0, 2, __pyx_L1_error)
21376   #endif
21377   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 2, __pyx_L1_error)
21378   Py_INCREF(__pyx_d);
21379   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 2, __pyx_L1_error)
21380   Py_INCREF(__pyx_b);
21381   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 2, __pyx_L1_error)
21382   Py_INCREF(__pyx_cython_runtime);
21383   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
21384   /*--- Initialize various global constants etc. ---*/
21385   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21386   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
21387   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21388   #endif
21389   if (__pyx_module_is_main_yt__utilities__lib__distance_queue) {
21390     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21391   }
21392   #if PY_MAJOR_VERSION >= 3
21393   {
21394     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 2, __pyx_L1_error)
21395     if (!PyDict_GetItemString(modules, "yt.utilities.lib.distance_queue")) {
21396       if (unlikely(PyDict_SetItemString(modules, "yt.utilities.lib.distance_queue", __pyx_m) < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
21397     }
21398   }
21399   #endif
21400   /*--- Builtin init code ---*/
21401   if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
21402   /*--- Constants init code ---*/
21403   if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
21404   /*--- Global type/function init code ---*/
21405   (void)__Pyx_modinit_global_init_code();
21406   (void)__Pyx_modinit_variable_export_code();
21407   if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error;
21408   if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
21409   if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
21410   (void)__Pyx_modinit_variable_import_code();
21411   (void)__Pyx_modinit_function_import_code();
21412   /*--- Execution code ---*/
21413   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
21414   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21415   #endif
21416 
21417   /* "yt/utilities/lib/distance_queue.pyx":13
21418  * cimport numpy as np
21419  *
21420  * import numpy as np             # <<<<<<<<<<<<<<
21421  *
21422  * cimport cython
21423  */
21424   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
21425   __Pyx_GOTREF(__pyx_t_1);
21426   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
21427   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21428 
21429   /* "yt/utilities/lib/distance_queue.pyx":2
21430  *
21431  * # distutils: libraries = STD_LIBS             # <<<<<<<<<<<<<<
21432  * """
21433  * Distance queue implementation
21434  */
21435   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
21436   __Pyx_GOTREF(__pyx_t_1);
21437   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21438   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21439 
21440   /* "View.MemoryView":209
21441  *         info.obj = self
21442  *
21443  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
21444  *
21445  *     def __dealloc__(array self):
21446  */
21447   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
21448   __Pyx_GOTREF(__pyx_t_1);
21449   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
21450   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21451   PyType_Modified(__pyx_array_type);
21452 
21453   /* "View.MemoryView":286
21454  *         return self.name
21455  *
21456  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
21457  * cdef strided = Enum("<strided and direct>") # default
21458  * cdef indirect = Enum("<strided and indirect>")
21459  */
21460   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
21461   __Pyx_GOTREF(__pyx_t_1);
21462   __Pyx_XGOTREF(generic);
21463   __Pyx_DECREF_SET(generic, __pyx_t_1);
21464   __Pyx_GIVEREF(__pyx_t_1);
21465   __pyx_t_1 = 0;
21466 
21467   /* "View.MemoryView":287
21468  *
21469  * cdef generic = Enum("<strided and direct or indirect>")
21470  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
21471  * cdef indirect = Enum("<strided and indirect>")
21472  *
21473  */
21474   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error)
21475   __Pyx_GOTREF(__pyx_t_1);
21476   __Pyx_XGOTREF(strided);
21477   __Pyx_DECREF_SET(strided, __pyx_t_1);
21478   __Pyx_GIVEREF(__pyx_t_1);
21479   __pyx_t_1 = 0;
21480 
21481   /* "View.MemoryView":288
21482  * cdef generic = Enum("<strided and direct or indirect>")
21483  * cdef strided = Enum("<strided and direct>") # default
21484  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
21485  *
21486  *
21487  */
21488   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
21489   __Pyx_GOTREF(__pyx_t_1);
21490   __Pyx_XGOTREF(indirect);
21491   __Pyx_DECREF_SET(indirect, __pyx_t_1);
21492   __Pyx_GIVEREF(__pyx_t_1);
21493   __pyx_t_1 = 0;
21494 
21495   /* "View.MemoryView":291
21496  *
21497  *
21498  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
21499  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
21500  *
21501  */
21502   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error)
21503   __Pyx_GOTREF(__pyx_t_1);
21504   __Pyx_XGOTREF(contiguous);
21505   __Pyx_DECREF_SET(contiguous, __pyx_t_1);
21506   __Pyx_GIVEREF(__pyx_t_1);
21507   __pyx_t_1 = 0;
21508 
21509   /* "View.MemoryView":292
21510  *
21511  * cdef contiguous = Enum("<contiguous and direct>")
21512  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
21513  *
21514  *
21515  */
21516   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
21517   __Pyx_GOTREF(__pyx_t_1);
21518   __Pyx_XGOTREF(indirect_contiguous);
21519   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
21520   __Pyx_GIVEREF(__pyx_t_1);
21521   __pyx_t_1 = 0;
21522 
21523   /* "View.MemoryView":316
21524  *
21525  * DEF THREAD_LOCKS_PREALLOCATED = 8
21526  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
21527  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
21528  *     PyThread_allocate_lock(),
21529  */
21530   __pyx_memoryview_thread_locks_used = 0;
21531 
21532   /* "View.MemoryView":317
21533  * DEF THREAD_LOCKS_PREALLOCATED = 8
21534  * cdef int __pyx_memoryview_thread_locks_used = 0
21535  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
21536  *     PyThread_allocate_lock(),
21537  *     PyThread_allocate_lock(),
21538  */
21539   __pyx_t_2[0] = PyThread_allocate_lock();
21540   __pyx_t_2[1] = PyThread_allocate_lock();
21541   __pyx_t_2[2] = PyThread_allocate_lock();
21542   __pyx_t_2[3] = PyThread_allocate_lock();
21543   __pyx_t_2[4] = PyThread_allocate_lock();
21544   __pyx_t_2[5] = PyThread_allocate_lock();
21545   __pyx_t_2[6] = PyThread_allocate_lock();
21546   __pyx_t_2[7] = PyThread_allocate_lock();
21547   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
21548 
21549   /* "View.MemoryView":545
21550  *         info.obj = self
21551  *
21552  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
21553  *
21554  *
21555  */
21556   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 545, __pyx_L1_error)
21557   __Pyx_GOTREF(__pyx_t_1);
21558   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 545, __pyx_L1_error)
21559   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21560   PyType_Modified(__pyx_memoryview_type);
21561 
21562   /* "View.MemoryView":991
21563  *         return self.from_object
21564  *
21565  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
21566  *
21567  *
21568  */
21569   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 991, __pyx_L1_error)
21570   __Pyx_GOTREF(__pyx_t_1);
21571   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 991, __pyx_L1_error)
21572   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21573   PyType_Modified(__pyx_memoryviewslice_type);
21574 
21575   /* "(tree fragment)":1
21576  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21577  *     cdef object __pyx_PickleError
21578  *     cdef object __pyx_result
21579  */
21580   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
21581   __Pyx_GOTREF(__pyx_t_1);
21582   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
21583   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21584 
21585   /* "(tree fragment)":11
21586  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21587  *     return __pyx_result
21588  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
21589  *     __pyx_result.name = __pyx_state[0]
21590  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21591  */
21592 
21593   /*--- Wrapped vars code ---*/
21594 
21595   goto __pyx_L0;
21596   __pyx_L1_error:;
21597   __Pyx_XDECREF(__pyx_t_1);
21598   if (__pyx_m) {
21599     if (__pyx_d) {
21600       __Pyx_AddTraceback("init yt.utilities.lib.distance_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
21601     }
21602     Py_CLEAR(__pyx_m);
21603   } else if (!PyErr_Occurred()) {
21604     PyErr_SetString(PyExc_ImportError, "init yt.utilities.lib.distance_queue");
21605   }
21606   __pyx_L0:;
21607   __Pyx_RefNannyFinishContext();
21608   #if CYTHON_PEP489_MULTI_PHASE_INIT
21609   return (__pyx_m != NULL) ? 0 : -1;
21610   #elif PY_MAJOR_VERSION >= 3
21611   return __pyx_m;
21612   #else
21613   return;
21614   #endif
21615 }
21616 
21617 /* --- Runtime support code --- */
21618 /* Refnanny */
21619 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)21620 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
21621     PyObject *m = NULL, *p = NULL;
21622     void *r = NULL;
21623     m = PyImport_ImportModule(modname);
21624     if (!m) goto end;
21625     p = PyObject_GetAttrString(m, "RefNannyAPI");
21626     if (!p) goto end;
21627     r = PyLong_AsVoidPtr(p);
21628 end:
21629     Py_XDECREF(p);
21630     Py_XDECREF(m);
21631     return (__Pyx_RefNannyAPIStruct *)r;
21632 }
21633 #endif
21634 
21635 /* PyObjectGetAttrStr */
21636 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)21637 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
21638     PyTypeObject* tp = Py_TYPE(obj);
21639     if (likely(tp->tp_getattro))
21640         return tp->tp_getattro(obj, attr_name);
21641 #if PY_MAJOR_VERSION < 3
21642     if (likely(tp->tp_getattr))
21643         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
21644 #endif
21645     return PyObject_GetAttr(obj, attr_name);
21646 }
21647 #endif
21648 
21649 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)21650 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
21651     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
21652     if (unlikely(!result)) {
21653         PyErr_Format(PyExc_NameError,
21654 #if PY_MAJOR_VERSION >= 3
21655             "name '%U' is not defined", name);
21656 #else
21657             "name '%.200s' is not defined", PyString_AS_STRING(name));
21658 #endif
21659     }
21660     return result;
21661 }
21662 
21663 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)21664 static void __Pyx_RaiseDoubleKeywordsError(
21665     const char* func_name,
21666     PyObject* kw_name)
21667 {
21668     PyErr_Format(PyExc_TypeError,
21669         #if PY_MAJOR_VERSION >= 3
21670         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
21671         #else
21672         "%s() got multiple values for keyword argument '%s'", func_name,
21673         PyString_AsString(kw_name));
21674         #endif
21675 }
21676 
21677 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)21678 static int __Pyx_ParseOptionalKeywords(
21679     PyObject *kwds,
21680     PyObject **argnames[],
21681     PyObject *kwds2,
21682     PyObject *values[],
21683     Py_ssize_t num_pos_args,
21684     const char* function_name)
21685 {
21686     PyObject *key = 0, *value = 0;
21687     Py_ssize_t pos = 0;
21688     PyObject*** name;
21689     PyObject*** first_kw_arg = argnames + num_pos_args;
21690     while (PyDict_Next(kwds, &pos, &key, &value)) {
21691         name = first_kw_arg;
21692         while (*name && (**name != key)) name++;
21693         if (*name) {
21694             values[name-argnames] = value;
21695             continue;
21696         }
21697         name = first_kw_arg;
21698         #if PY_MAJOR_VERSION < 3
21699         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
21700             while (*name) {
21701                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
21702                         && _PyString_Eq(**name, key)) {
21703                     values[name-argnames] = value;
21704                     break;
21705                 }
21706                 name++;
21707             }
21708             if (*name) continue;
21709             else {
21710                 PyObject*** argname = argnames;
21711                 while (argname != first_kw_arg) {
21712                     if ((**argname == key) || (
21713                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
21714                              && _PyString_Eq(**argname, key))) {
21715                         goto arg_passed_twice;
21716                     }
21717                     argname++;
21718                 }
21719             }
21720         } else
21721         #endif
21722         if (likely(PyUnicode_Check(key))) {
21723             while (*name) {
21724                 int cmp = (**name == key) ? 0 :
21725                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
21726                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
21727                 #endif
21728                     PyUnicode_Compare(**name, key);
21729                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
21730                 if (cmp == 0) {
21731                     values[name-argnames] = value;
21732                     break;
21733                 }
21734                 name++;
21735             }
21736             if (*name) continue;
21737             else {
21738                 PyObject*** argname = argnames;
21739                 while (argname != first_kw_arg) {
21740                     int cmp = (**argname == key) ? 0 :
21741                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
21742                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
21743                     #endif
21744                         PyUnicode_Compare(**argname, key);
21745                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
21746                     if (cmp == 0) goto arg_passed_twice;
21747                     argname++;
21748                 }
21749             }
21750         } else
21751             goto invalid_keyword_type;
21752         if (kwds2) {
21753             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
21754         } else {
21755             goto invalid_keyword;
21756         }
21757     }
21758     return 0;
21759 arg_passed_twice:
21760     __Pyx_RaiseDoubleKeywordsError(function_name, key);
21761     goto bad;
21762 invalid_keyword_type:
21763     PyErr_Format(PyExc_TypeError,
21764         "%.200s() keywords must be strings", function_name);
21765     goto bad;
21766 invalid_keyword:
21767     PyErr_Format(PyExc_TypeError,
21768     #if PY_MAJOR_VERSION < 3
21769         "%.200s() got an unexpected keyword argument '%.200s'",
21770         function_name, PyString_AsString(key));
21771     #else
21772         "%s() got an unexpected keyword argument '%U'",
21773         function_name, key);
21774     #endif
21775 bad:
21776     return -1;
21777 }
21778 
21779 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)21780 static void __Pyx_RaiseArgtupleInvalid(
21781     const char* func_name,
21782     int exact,
21783     Py_ssize_t num_min,
21784     Py_ssize_t num_max,
21785     Py_ssize_t num_found)
21786 {
21787     Py_ssize_t num_expected;
21788     const char *more_or_less;
21789     if (num_found < num_min) {
21790         num_expected = num_min;
21791         more_or_less = "at least";
21792     } else {
21793         num_expected = num_max;
21794         more_or_less = "at most";
21795     }
21796     if (exact) {
21797         more_or_less = "exactly";
21798     }
21799     PyErr_Format(PyExc_TypeError,
21800                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
21801                  func_name, more_or_less, num_expected,
21802                  (num_expected == 1) ? "" : "s", num_found);
21803 }
21804 
21805 /* PyObjectCall */
21806 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)21807 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
21808     PyObject *result;
21809     ternaryfunc call = func->ob_type->tp_call;
21810     if (unlikely(!call))
21811         return PyObject_Call(func, arg, kw);
21812     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
21813         return NULL;
21814     result = (*call)(func, arg, kw);
21815     Py_LeaveRecursiveCall();
21816     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
21817         PyErr_SetString(
21818             PyExc_SystemError,
21819             "NULL result without error in PyObject_Call");
21820     }
21821     return result;
21822 }
21823 #endif
21824 
21825 /* PyErrFetchRestore */
21826 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)21827 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
21828     PyObject *tmp_type, *tmp_value, *tmp_tb;
21829     tmp_type = tstate->curexc_type;
21830     tmp_value = tstate->curexc_value;
21831     tmp_tb = tstate->curexc_traceback;
21832     tstate->curexc_type = type;
21833     tstate->curexc_value = value;
21834     tstate->curexc_traceback = tb;
21835     Py_XDECREF(tmp_type);
21836     Py_XDECREF(tmp_value);
21837     Py_XDECREF(tmp_tb);
21838 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)21839 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
21840     *type = tstate->curexc_type;
21841     *value = tstate->curexc_value;
21842     *tb = tstate->curexc_traceback;
21843     tstate->curexc_type = 0;
21844     tstate->curexc_value = 0;
21845     tstate->curexc_traceback = 0;
21846 }
21847 #endif
21848 
21849 /* RaiseException */
21850 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)21851 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
21852                         CYTHON_UNUSED PyObject *cause) {
21853     __Pyx_PyThreadState_declare
21854     Py_XINCREF(type);
21855     if (!value || value == Py_None)
21856         value = NULL;
21857     else
21858         Py_INCREF(value);
21859     if (!tb || tb == Py_None)
21860         tb = NULL;
21861     else {
21862         Py_INCREF(tb);
21863         if (!PyTraceBack_Check(tb)) {
21864             PyErr_SetString(PyExc_TypeError,
21865                 "raise: arg 3 must be a traceback or None");
21866             goto raise_error;
21867         }
21868     }
21869     if (PyType_Check(type)) {
21870 #if CYTHON_COMPILING_IN_PYPY
21871         if (!value) {
21872             Py_INCREF(Py_None);
21873             value = Py_None;
21874         }
21875 #endif
21876         PyErr_NormalizeException(&type, &value, &tb);
21877     } else {
21878         if (value) {
21879             PyErr_SetString(PyExc_TypeError,
21880                 "instance exception may not have a separate value");
21881             goto raise_error;
21882         }
21883         value = type;
21884         type = (PyObject*) Py_TYPE(type);
21885         Py_INCREF(type);
21886         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
21887             PyErr_SetString(PyExc_TypeError,
21888                 "raise: exception class must be a subclass of BaseException");
21889             goto raise_error;
21890         }
21891     }
21892     __Pyx_PyThreadState_assign
21893     __Pyx_ErrRestore(type, value, tb);
21894     return;
21895 raise_error:
21896     Py_XDECREF(value);
21897     Py_XDECREF(type);
21898     Py_XDECREF(tb);
21899     return;
21900 }
21901 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)21902 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
21903     PyObject* owned_instance = NULL;
21904     if (tb == Py_None) {
21905         tb = 0;
21906     } else if (tb && !PyTraceBack_Check(tb)) {
21907         PyErr_SetString(PyExc_TypeError,
21908             "raise: arg 3 must be a traceback or None");
21909         goto bad;
21910     }
21911     if (value == Py_None)
21912         value = 0;
21913     if (PyExceptionInstance_Check(type)) {
21914         if (value) {
21915             PyErr_SetString(PyExc_TypeError,
21916                 "instance exception may not have a separate value");
21917             goto bad;
21918         }
21919         value = type;
21920         type = (PyObject*) Py_TYPE(value);
21921     } else if (PyExceptionClass_Check(type)) {
21922         PyObject *instance_class = NULL;
21923         if (value && PyExceptionInstance_Check(value)) {
21924             instance_class = (PyObject*) Py_TYPE(value);
21925             if (instance_class != type) {
21926                 int is_subclass = PyObject_IsSubclass(instance_class, type);
21927                 if (!is_subclass) {
21928                     instance_class = NULL;
21929                 } else if (unlikely(is_subclass == -1)) {
21930                     goto bad;
21931                 } else {
21932                     type = instance_class;
21933                 }
21934             }
21935         }
21936         if (!instance_class) {
21937             PyObject *args;
21938             if (!value)
21939                 args = PyTuple_New(0);
21940             else if (PyTuple_Check(value)) {
21941                 Py_INCREF(value);
21942                 args = value;
21943             } else
21944                 args = PyTuple_Pack(1, value);
21945             if (!args)
21946                 goto bad;
21947             owned_instance = PyObject_Call(type, args, NULL);
21948             Py_DECREF(args);
21949             if (!owned_instance)
21950                 goto bad;
21951             value = owned_instance;
21952             if (!PyExceptionInstance_Check(value)) {
21953                 PyErr_Format(PyExc_TypeError,
21954                              "calling %R should have returned an instance of "
21955                              "BaseException, not %R",
21956                              type, Py_TYPE(value));
21957                 goto bad;
21958             }
21959         }
21960     } else {
21961         PyErr_SetString(PyExc_TypeError,
21962             "raise: exception class must be a subclass of BaseException");
21963         goto bad;
21964     }
21965     if (cause) {
21966         PyObject *fixed_cause;
21967         if (cause == Py_None) {
21968             fixed_cause = NULL;
21969         } else if (PyExceptionClass_Check(cause)) {
21970             fixed_cause = PyObject_CallObject(cause, NULL);
21971             if (fixed_cause == NULL)
21972                 goto bad;
21973         } else if (PyExceptionInstance_Check(cause)) {
21974             fixed_cause = cause;
21975             Py_INCREF(fixed_cause);
21976         } else {
21977             PyErr_SetString(PyExc_TypeError,
21978                             "exception causes must derive from "
21979                             "BaseException");
21980             goto bad;
21981         }
21982         PyException_SetCause(value, fixed_cause);
21983     }
21984     PyErr_SetObject(type, value);
21985     if (tb) {
21986 #if CYTHON_COMPILING_IN_PYPY
21987         PyObject *tmp_type, *tmp_value, *tmp_tb;
21988         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
21989         Py_INCREF(tb);
21990         PyErr_Restore(tmp_type, tmp_value, tb);
21991         Py_XDECREF(tmp_tb);
21992 #else
21993         PyThreadState *tstate = __Pyx_PyThreadState_Current;
21994         PyObject* tmp_tb = tstate->curexc_traceback;
21995         if (tb != tmp_tb) {
21996             Py_INCREF(tb);
21997             tstate->curexc_traceback = tb;
21998             Py_XDECREF(tmp_tb);
21999         }
22000 #endif
22001     }
22002 bad:
22003     Py_XDECREF(owned_instance);
22004     return;
22005 }
22006 #endif
22007 
22008 /* BufferIndexError */
__Pyx_RaiseBufferIndexError(int axis)22009 static void __Pyx_RaiseBufferIndexError(int axis) {
22010   PyErr_Format(PyExc_IndexError,
22011      "Out of bounds on buffer access (axis %d)", axis);
22012 }
22013 
22014 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)22015 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
22016     PyObject *r;
22017     if (!j) return NULL;
22018     r = PyObject_GetItem(o, j);
22019     Py_DECREF(j);
22020     return r;
22021 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22022 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
22023                                                               CYTHON_NCP_UNUSED int wraparound,
22024                                                               CYTHON_NCP_UNUSED int boundscheck) {
22025 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22026     Py_ssize_t wrapped_i = i;
22027     if (wraparound & unlikely(i < 0)) {
22028         wrapped_i += PyList_GET_SIZE(o);
22029     }
22030     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
22031         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
22032         Py_INCREF(r);
22033         return r;
22034     }
22035     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22036 #else
22037     return PySequence_GetItem(o, i);
22038 #endif
22039 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22040 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
22041                                                               CYTHON_NCP_UNUSED int wraparound,
22042                                                               CYTHON_NCP_UNUSED int boundscheck) {
22043 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22044     Py_ssize_t wrapped_i = i;
22045     if (wraparound & unlikely(i < 0)) {
22046         wrapped_i += PyTuple_GET_SIZE(o);
22047     }
22048     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
22049         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
22050         Py_INCREF(r);
22051         return r;
22052     }
22053     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22054 #else
22055     return PySequence_GetItem(o, i);
22056 #endif
22057 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22058 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
22059                                                      CYTHON_NCP_UNUSED int wraparound,
22060                                                      CYTHON_NCP_UNUSED int boundscheck) {
22061 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
22062     if (is_list || PyList_CheckExact(o)) {
22063         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
22064         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
22065             PyObject *r = PyList_GET_ITEM(o, n);
22066             Py_INCREF(r);
22067             return r;
22068         }
22069     }
22070     else if (PyTuple_CheckExact(o)) {
22071         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
22072         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
22073             PyObject *r = PyTuple_GET_ITEM(o, n);
22074             Py_INCREF(r);
22075             return r;
22076         }
22077     } else {
22078         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
22079         if (likely(m && m->sq_item)) {
22080             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
22081                 Py_ssize_t l = m->sq_length(o);
22082                 if (likely(l >= 0)) {
22083                     i += l;
22084                 } else {
22085                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
22086                         return NULL;
22087                     PyErr_Clear();
22088                 }
22089             }
22090             return m->sq_item(o, i);
22091         }
22092     }
22093 #else
22094     if (is_list || PySequence_Check(o)) {
22095         return PySequence_GetItem(o, i);
22096     }
22097 #endif
22098     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
22099 }
22100 
22101 /* MemviewSliceInit */
22102 static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)22103 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
22104                         int ndim,
22105                         __Pyx_memviewslice *memviewslice,
22106                         int memview_is_new_reference)
22107 {
22108     __Pyx_RefNannyDeclarations
22109     int i, retval=-1;
22110     Py_buffer *buf = &memview->view;
22111     __Pyx_RefNannySetupContext("init_memviewslice", 0);
22112     if (memviewslice->memview || memviewslice->data) {
22113         PyErr_SetString(PyExc_ValueError,
22114             "memviewslice is already initialized!");
22115         goto fail;
22116     }
22117     if (buf->strides) {
22118         for (i = 0; i < ndim; i++) {
22119             memviewslice->strides[i] = buf->strides[i];
22120         }
22121     } else {
22122         Py_ssize_t stride = buf->itemsize;
22123         for (i = ndim - 1; i >= 0; i--) {
22124             memviewslice->strides[i] = stride;
22125             stride *= buf->shape[i];
22126         }
22127     }
22128     for (i = 0; i < ndim; i++) {
22129         memviewslice->shape[i]   = buf->shape[i];
22130         if (buf->suboffsets) {
22131             memviewslice->suboffsets[i] = buf->suboffsets[i];
22132         } else {
22133             memviewslice->suboffsets[i] = -1;
22134         }
22135     }
22136     memviewslice->memview = memview;
22137     memviewslice->data = (char *)buf->buf;
22138     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
22139         Py_INCREF(memview);
22140     }
22141     retval = 0;
22142     goto no_fail;
22143 fail:
22144     memviewslice->memview = 0;
22145     memviewslice->data = 0;
22146     retval = -1;
22147 no_fail:
22148     __Pyx_RefNannyFinishContext();
22149     return retval;
22150 }
22151 #ifndef Py_NO_RETURN
22152 #define Py_NO_RETURN
22153 #endif
__pyx_fatalerror(const char * fmt,...)22154 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
22155     va_list vargs;
22156     char msg[200];
22157 #ifdef HAVE_STDARG_PROTOTYPES
22158     va_start(vargs, fmt);
22159 #else
22160     va_start(vargs);
22161 #endif
22162     vsnprintf(msg, 200, fmt, vargs);
22163     va_end(vargs);
22164     Py_FatalError(msg);
22165 }
22166 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)22167 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22168                                    PyThread_type_lock lock)
22169 {
22170     int result;
22171     PyThread_acquire_lock(lock, 1);
22172     result = (*acquisition_count)++;
22173     PyThread_release_lock(lock);
22174     return result;
22175 }
22176 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)22177 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22178                                    PyThread_type_lock lock)
22179 {
22180     int result;
22181     PyThread_acquire_lock(lock, 1);
22182     result = (*acquisition_count)--;
22183     PyThread_release_lock(lock);
22184     return result;
22185 }
22186 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)22187 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
22188 {
22189     int first_time;
22190     struct __pyx_memoryview_obj *memview = memslice->memview;
22191     if (!memview || (PyObject *) memview == Py_None)
22192         return;
22193     if (__pyx_get_slice_count(memview) < 0)
22194         __pyx_fatalerror("Acquisition count is %d (line %d)",
22195                          __pyx_get_slice_count(memview), lineno);
22196     first_time = __pyx_add_acquisition_count(memview) == 0;
22197     if (first_time) {
22198         if (have_gil) {
22199             Py_INCREF((PyObject *) memview);
22200         } else {
22201             PyGILState_STATE _gilstate = PyGILState_Ensure();
22202             Py_INCREF((PyObject *) memview);
22203             PyGILState_Release(_gilstate);
22204         }
22205     }
22206 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)22207 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
22208                                              int have_gil, int lineno) {
22209     int last_time;
22210     struct __pyx_memoryview_obj *memview = memslice->memview;
22211     if (!memview ) {
22212         return;
22213     } else if ((PyObject *) memview == Py_None) {
22214         memslice->memview = NULL;
22215         return;
22216     }
22217     if (__pyx_get_slice_count(memview) <= 0)
22218         __pyx_fatalerror("Acquisition count is %d (line %d)",
22219                          __pyx_get_slice_count(memview), lineno);
22220     last_time = __pyx_sub_acquisition_count(memview) == 1;
22221     memslice->data = NULL;
22222     if (last_time) {
22223         if (have_gil) {
22224             Py_CLEAR(memslice->memview);
22225         } else {
22226             PyGILState_STATE _gilstate = PyGILState_Ensure();
22227             Py_CLEAR(memslice->memview);
22228             PyGILState_Release(_gilstate);
22229         }
22230     } else {
22231         memslice->memview = NULL;
22232     }
22233 }
22234 
22235 /* PyDictVersioning */
22236 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)22237 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
22238     PyObject *dict = Py_TYPE(obj)->tp_dict;
22239     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
22240 }
__Pyx_get_object_dict_version(PyObject * obj)22241 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
22242     PyObject **dictptr = NULL;
22243     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
22244     if (offset) {
22245 #if CYTHON_COMPILING_IN_CPYTHON
22246         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
22247 #else
22248         dictptr = _PyObject_GetDictPtr(obj);
22249 #endif
22250     }
22251     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
22252 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)22253 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
22254     PyObject *dict = Py_TYPE(obj)->tp_dict;
22255     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
22256         return 0;
22257     return obj_dict_version == __Pyx_get_object_dict_version(obj);
22258 }
22259 #endif
22260 
22261 /* GetModuleGlobalName */
22262 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)22263 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
22264 #else
22265 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
22266 #endif
22267 {
22268     PyObject *result;
22269 #if !CYTHON_AVOID_BORROWED_REFS
22270 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
22271     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
22272     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
22273     if (likely(result)) {
22274         return __Pyx_NewRef(result);
22275     } else if (unlikely(PyErr_Occurred())) {
22276         return NULL;
22277     }
22278 #else
22279     result = PyDict_GetItem(__pyx_d, name);
22280     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
22281     if (likely(result)) {
22282         return __Pyx_NewRef(result);
22283     }
22284 #endif
22285 #else
22286     result = PyObject_GetItem(__pyx_d, name);
22287     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
22288     if (likely(result)) {
22289         return __Pyx_NewRef(result);
22290     }
22291     PyErr_Clear();
22292 #endif
22293     return __Pyx_GetBuiltinName(name);
22294 }
22295 
22296 /* SetItemInt */
__Pyx_SetItemInt_Generic(PyObject * o,PyObject * j,PyObject * v)22297 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
22298     int r;
22299     if (!j) return -1;
22300     r = PyObject_SetItem(o, j, v);
22301     Py_DECREF(j);
22302     return r;
22303 }
__Pyx_SetItemInt_Fast(PyObject * o,Py_ssize_t i,PyObject * v,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)22304 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
22305                                                CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
22306 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
22307     if (is_list || PyList_CheckExact(o)) {
22308         Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
22309         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
22310             PyObject* old = PyList_GET_ITEM(o, n);
22311             Py_INCREF(v);
22312             PyList_SET_ITEM(o, n, v);
22313             Py_DECREF(old);
22314             return 1;
22315         }
22316     } else {
22317         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
22318         if (likely(m && m->sq_ass_item)) {
22319             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
22320                 Py_ssize_t l = m->sq_length(o);
22321                 if (likely(l >= 0)) {
22322                     i += l;
22323                 } else {
22324                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
22325                         return -1;
22326                     PyErr_Clear();
22327                 }
22328             }
22329             return m->sq_ass_item(o, i, v);
22330         }
22331     }
22332 #else
22333 #if CYTHON_COMPILING_IN_PYPY
22334     if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
22335 #else
22336     if (is_list || PySequence_Check(o))
22337 #endif
22338     {
22339         return PySequence_SetItem(o, i, v);
22340     }
22341 #endif
22342     return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
22343 }
22344 
22345 /* PyCFunctionFastCall */
22346 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)22347 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
22348     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
22349     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
22350     PyObject *self = PyCFunction_GET_SELF(func);
22351     int flags = PyCFunction_GET_FLAGS(func);
22352     assert(PyCFunction_Check(func));
22353     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
22354     assert(nargs >= 0);
22355     assert(nargs == 0 || args != NULL);
22356     /* _PyCFunction_FastCallDict() must not be called with an exception set,
22357        because it may clear it (directly or indirectly) and so the
22358        caller loses its exception */
22359     assert(!PyErr_Occurred());
22360     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
22361         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
22362     } else {
22363         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
22364     }
22365 }
22366 #endif
22367 
22368 /* PyFunctionFastCall */
22369 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)22370 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
22371                                                PyObject *globals) {
22372     PyFrameObject *f;
22373     PyThreadState *tstate = __Pyx_PyThreadState_Current;
22374     PyObject **fastlocals;
22375     Py_ssize_t i;
22376     PyObject *result;
22377     assert(globals != NULL);
22378     /* XXX Perhaps we should create a specialized
22379        PyFrame_New() that doesn't take locals, but does
22380        take builtins without sanity checking them.
22381        */
22382     assert(tstate != NULL);
22383     f = PyFrame_New(tstate, co, globals, NULL);
22384     if (f == NULL) {
22385         return NULL;
22386     }
22387     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
22388     for (i = 0; i < na; i++) {
22389         Py_INCREF(*args);
22390         fastlocals[i] = *args++;
22391     }
22392     result = PyEval_EvalFrameEx(f,0);
22393     ++tstate->recursion_depth;
22394     Py_DECREF(f);
22395     --tstate->recursion_depth;
22396     return result;
22397 }
22398 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)22399 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
22400     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
22401     PyObject *globals = PyFunction_GET_GLOBALS(func);
22402     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
22403     PyObject *closure;
22404 #if PY_MAJOR_VERSION >= 3
22405     PyObject *kwdefs;
22406 #endif
22407     PyObject *kwtuple, **k;
22408     PyObject **d;
22409     Py_ssize_t nd;
22410     Py_ssize_t nk;
22411     PyObject *result;
22412     assert(kwargs == NULL || PyDict_Check(kwargs));
22413     nk = kwargs ? PyDict_Size(kwargs) : 0;
22414     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
22415         return NULL;
22416     }
22417     if (
22418 #if PY_MAJOR_VERSION >= 3
22419             co->co_kwonlyargcount == 0 &&
22420 #endif
22421             likely(kwargs == NULL || nk == 0) &&
22422             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
22423         if (argdefs == NULL && co->co_argcount == nargs) {
22424             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
22425             goto done;
22426         }
22427         else if (nargs == 0 && argdefs != NULL
22428                  && co->co_argcount == Py_SIZE(argdefs)) {
22429             /* function called with no arguments, but all parameters have
22430                a default value: use default values as arguments .*/
22431             args = &PyTuple_GET_ITEM(argdefs, 0);
22432             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
22433             goto done;
22434         }
22435     }
22436     if (kwargs != NULL) {
22437         Py_ssize_t pos, i;
22438         kwtuple = PyTuple_New(2 * nk);
22439         if (kwtuple == NULL) {
22440             result = NULL;
22441             goto done;
22442         }
22443         k = &PyTuple_GET_ITEM(kwtuple, 0);
22444         pos = i = 0;
22445         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
22446             Py_INCREF(k[i]);
22447             Py_INCREF(k[i+1]);
22448             i += 2;
22449         }
22450         nk = i / 2;
22451     }
22452     else {
22453         kwtuple = NULL;
22454         k = NULL;
22455     }
22456     closure = PyFunction_GET_CLOSURE(func);
22457 #if PY_MAJOR_VERSION >= 3
22458     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
22459 #endif
22460     if (argdefs != NULL) {
22461         d = &PyTuple_GET_ITEM(argdefs, 0);
22462         nd = Py_SIZE(argdefs);
22463     }
22464     else {
22465         d = NULL;
22466         nd = 0;
22467     }
22468 #if PY_MAJOR_VERSION >= 3
22469     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
22470                                args, (int)nargs,
22471                                k, (int)nk,
22472                                d, (int)nd, kwdefs, closure);
22473 #else
22474     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
22475                                args, (int)nargs,
22476                                k, (int)nk,
22477                                d, (int)nd, closure);
22478 #endif
22479     Py_XDECREF(kwtuple);
22480 done:
22481     Py_LeaveRecursiveCall();
22482     return result;
22483 }
22484 #endif
22485 #endif
22486 
22487 /* PyObjectCallMethO */
22488 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)22489 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
22490     PyObject *self, *result;
22491     PyCFunction cfunc;
22492     cfunc = PyCFunction_GET_FUNCTION(func);
22493     self = PyCFunction_GET_SELF(func);
22494     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
22495         return NULL;
22496     result = cfunc(self, arg);
22497     Py_LeaveRecursiveCall();
22498     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22499         PyErr_SetString(
22500             PyExc_SystemError,
22501             "NULL result without error in PyObject_Call");
22502     }
22503     return result;
22504 }
22505 #endif
22506 
22507 /* PyObjectCallOneArg */
22508 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)22509 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22510     PyObject *result;
22511     PyObject *args = PyTuple_New(1);
22512     if (unlikely(!args)) return NULL;
22513     Py_INCREF(arg);
22514     PyTuple_SET_ITEM(args, 0, arg);
22515     result = __Pyx_PyObject_Call(func, args, NULL);
22516     Py_DECREF(args);
22517     return result;
22518 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)22519 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22520 #if CYTHON_FAST_PYCALL
22521     if (PyFunction_Check(func)) {
22522         return __Pyx_PyFunction_FastCall(func, &arg, 1);
22523     }
22524 #endif
22525     if (likely(PyCFunction_Check(func))) {
22526         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
22527             return __Pyx_PyObject_CallMethO(func, arg);
22528 #if CYTHON_FAST_PYCCALL
22529         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
22530             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
22531 #endif
22532         }
22533     }
22534     return __Pyx__PyObject_CallOneArg(func, arg);
22535 }
22536 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)22537 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22538     PyObject *result;
22539     PyObject *args = PyTuple_Pack(1, arg);
22540     if (unlikely(!args)) return NULL;
22541     result = __Pyx_PyObject_Call(func, args, NULL);
22542     Py_DECREF(args);
22543     return result;
22544 }
22545 #endif
22546 
22547 /* DictGetItem */
22548 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)22549 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
22550     PyObject *value;
22551     value = PyDict_GetItemWithError(d, key);
22552     if (unlikely(!value)) {
22553         if (!PyErr_Occurred()) {
22554             if (unlikely(PyTuple_Check(key))) {
22555                 PyObject* args = PyTuple_Pack(1, key);
22556                 if (likely(args)) {
22557                     PyErr_SetObject(PyExc_KeyError, args);
22558                     Py_DECREF(args);
22559                 }
22560             } else {
22561                 PyErr_SetObject(PyExc_KeyError, key);
22562             }
22563         }
22564         return NULL;
22565     }
22566     Py_INCREF(value);
22567     return value;
22568 }
22569 #endif
22570 
22571 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)22572 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
22573     PyErr_Format(PyExc_ValueError,
22574                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
22575 }
22576 
22577 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)22578 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
22579     PyErr_Format(PyExc_ValueError,
22580                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
22581                  index, (index == 1) ? "" : "s");
22582 }
22583 
22584 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)22585 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
22586     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
22587 }
22588 
22589 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)22590 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
22591     if (unlikely(!type)) {
22592         PyErr_SetString(PyExc_SystemError, "Missing type object");
22593         return 0;
22594     }
22595     if (likely(__Pyx_TypeCheck(obj, type)))
22596         return 1;
22597     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
22598                  Py_TYPE(obj)->tp_name, type->tp_name);
22599     return 0;
22600 }
22601 
22602 /* GetTopmostException */
22603 #if CYTHON_USE_EXC_INFO_STACK
22604 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)22605 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
22606 {
22607     _PyErr_StackItem *exc_info = tstate->exc_info;
22608     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
22609            exc_info->previous_item != NULL)
22610     {
22611         exc_info = exc_info->previous_item;
22612     }
22613     return exc_info;
22614 }
22615 #endif
22616 
22617 /* SaveResetException */
22618 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22619 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22620     #if CYTHON_USE_EXC_INFO_STACK
22621     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
22622     *type = exc_info->exc_type;
22623     *value = exc_info->exc_value;
22624     *tb = exc_info->exc_traceback;
22625     #else
22626     *type = tstate->exc_type;
22627     *value = tstate->exc_value;
22628     *tb = tstate->exc_traceback;
22629     #endif
22630     Py_XINCREF(*type);
22631     Py_XINCREF(*value);
22632     Py_XINCREF(*tb);
22633 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)22634 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22635     PyObject *tmp_type, *tmp_value, *tmp_tb;
22636     #if CYTHON_USE_EXC_INFO_STACK
22637     _PyErr_StackItem *exc_info = tstate->exc_info;
22638     tmp_type = exc_info->exc_type;
22639     tmp_value = exc_info->exc_value;
22640     tmp_tb = exc_info->exc_traceback;
22641     exc_info->exc_type = type;
22642     exc_info->exc_value = value;
22643     exc_info->exc_traceback = tb;
22644     #else
22645     tmp_type = tstate->exc_type;
22646     tmp_value = tstate->exc_value;
22647     tmp_tb = tstate->exc_traceback;
22648     tstate->exc_type = type;
22649     tstate->exc_value = value;
22650     tstate->exc_traceback = tb;
22651     #endif
22652     Py_XDECREF(tmp_type);
22653     Py_XDECREF(tmp_value);
22654     Py_XDECREF(tmp_tb);
22655 }
22656 #endif
22657 
22658 /* PyErrExceptionMatches */
22659 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)22660 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
22661     Py_ssize_t i, n;
22662     n = PyTuple_GET_SIZE(tuple);
22663 #if PY_MAJOR_VERSION >= 3
22664     for (i=0; i<n; i++) {
22665         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
22666     }
22667 #endif
22668     for (i=0; i<n; i++) {
22669         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
22670     }
22671     return 0;
22672 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)22673 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
22674     PyObject *exc_type = tstate->curexc_type;
22675     if (exc_type == err) return 1;
22676     if (unlikely(!exc_type)) return 0;
22677     if (unlikely(PyTuple_Check(err)))
22678         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
22679     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
22680 }
22681 #endif
22682 
22683 /* GetException */
22684 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22685 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
22686 #else
22687 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
22688 #endif
22689 {
22690     PyObject *local_type, *local_value, *local_tb;
22691 #if CYTHON_FAST_THREAD_STATE
22692     PyObject *tmp_type, *tmp_value, *tmp_tb;
22693     local_type = tstate->curexc_type;
22694     local_value = tstate->curexc_value;
22695     local_tb = tstate->curexc_traceback;
22696     tstate->curexc_type = 0;
22697     tstate->curexc_value = 0;
22698     tstate->curexc_traceback = 0;
22699 #else
22700     PyErr_Fetch(&local_type, &local_value, &local_tb);
22701 #endif
22702     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
22703 #if CYTHON_FAST_THREAD_STATE
22704     if (unlikely(tstate->curexc_type))
22705 #else
22706     if (unlikely(PyErr_Occurred()))
22707 #endif
22708         goto bad;
22709     #if PY_MAJOR_VERSION >= 3
22710     if (local_tb) {
22711         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
22712             goto bad;
22713     }
22714     #endif
22715     Py_XINCREF(local_tb);
22716     Py_XINCREF(local_type);
22717     Py_XINCREF(local_value);
22718     *type = local_type;
22719     *value = local_value;
22720     *tb = local_tb;
22721 #if CYTHON_FAST_THREAD_STATE
22722     #if CYTHON_USE_EXC_INFO_STACK
22723     {
22724         _PyErr_StackItem *exc_info = tstate->exc_info;
22725         tmp_type = exc_info->exc_type;
22726         tmp_value = exc_info->exc_value;
22727         tmp_tb = exc_info->exc_traceback;
22728         exc_info->exc_type = local_type;
22729         exc_info->exc_value = local_value;
22730         exc_info->exc_traceback = local_tb;
22731     }
22732     #else
22733     tmp_type = tstate->exc_type;
22734     tmp_value = tstate->exc_value;
22735     tmp_tb = tstate->exc_traceback;
22736     tstate->exc_type = local_type;
22737     tstate->exc_value = local_value;
22738     tstate->exc_traceback = local_tb;
22739     #endif
22740     Py_XDECREF(tmp_type);
22741     Py_XDECREF(tmp_value);
22742     Py_XDECREF(tmp_tb);
22743 #else
22744     PyErr_SetExcInfo(local_type, local_value, local_tb);
22745 #endif
22746     return 0;
22747 bad:
22748     *type = 0;
22749     *value = 0;
22750     *tb = 0;
22751     Py_XDECREF(local_type);
22752     Py_XDECREF(local_value);
22753     Py_XDECREF(local_tb);
22754     return -1;
22755 }
22756 
22757 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)22758 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
22759 {
22760     if (unlikely(!type)) {
22761         PyErr_SetString(PyExc_SystemError, "Missing type object");
22762         return 0;
22763     }
22764     else if (exact) {
22765         #if PY_MAJOR_VERSION == 2
22766         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
22767         #endif
22768     }
22769     else {
22770         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
22771     }
22772     PyErr_Format(PyExc_TypeError,
22773         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
22774         name, type->tp_name, Py_TYPE(obj)->tp_name);
22775     return 0;
22776 }
22777 
22778 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)22779 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
22780     PyObject *args, *result = NULL;
22781     #if CYTHON_FAST_PYCALL
22782     if (PyFunction_Check(function)) {
22783         PyObject *args[2] = {arg1, arg2};
22784         return __Pyx_PyFunction_FastCall(function, args, 2);
22785     }
22786     #endif
22787     #if CYTHON_FAST_PYCCALL
22788     if (__Pyx_PyFastCFunction_Check(function)) {
22789         PyObject *args[2] = {arg1, arg2};
22790         return __Pyx_PyCFunction_FastCall(function, args, 2);
22791     }
22792     #endif
22793     args = PyTuple_New(2);
22794     if (unlikely(!args)) goto done;
22795     Py_INCREF(arg1);
22796     PyTuple_SET_ITEM(args, 0, arg1);
22797     Py_INCREF(arg2);
22798     PyTuple_SET_ITEM(args, 1, arg2);
22799     Py_INCREF(function);
22800     result = __Pyx_PyObject_Call(function, args, NULL);
22801     Py_DECREF(args);
22802     Py_DECREF(function);
22803 done:
22804     return result;
22805 }
22806 
22807 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)22808 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
22809 #if CYTHON_COMPILING_IN_PYPY
22810     return PyObject_RichCompareBool(s1, s2, equals);
22811 #else
22812     if (s1 == s2) {
22813         return (equals == Py_EQ);
22814     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
22815         const char *ps1, *ps2;
22816         Py_ssize_t length = PyBytes_GET_SIZE(s1);
22817         if (length != PyBytes_GET_SIZE(s2))
22818             return (equals == Py_NE);
22819         ps1 = PyBytes_AS_STRING(s1);
22820         ps2 = PyBytes_AS_STRING(s2);
22821         if (ps1[0] != ps2[0]) {
22822             return (equals == Py_NE);
22823         } else if (length == 1) {
22824             return (equals == Py_EQ);
22825         } else {
22826             int result;
22827 #if CYTHON_USE_UNICODE_INTERNALS
22828             Py_hash_t hash1, hash2;
22829             hash1 = ((PyBytesObject*)s1)->ob_shash;
22830             hash2 = ((PyBytesObject*)s2)->ob_shash;
22831             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22832                 return (equals == Py_NE);
22833             }
22834 #endif
22835             result = memcmp(ps1, ps2, (size_t)length);
22836             return (equals == Py_EQ) ? (result == 0) : (result != 0);
22837         }
22838     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
22839         return (equals == Py_NE);
22840     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
22841         return (equals == Py_NE);
22842     } else {
22843         int result;
22844         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22845         if (!py_result)
22846             return -1;
22847         result = __Pyx_PyObject_IsTrue(py_result);
22848         Py_DECREF(py_result);
22849         return result;
22850     }
22851 #endif
22852 }
22853 
22854 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)22855 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
22856 #if CYTHON_COMPILING_IN_PYPY
22857     return PyObject_RichCompareBool(s1, s2, equals);
22858 #else
22859 #if PY_MAJOR_VERSION < 3
22860     PyObject* owned_ref = NULL;
22861 #endif
22862     int s1_is_unicode, s2_is_unicode;
22863     if (s1 == s2) {
22864         goto return_eq;
22865     }
22866     s1_is_unicode = PyUnicode_CheckExact(s1);
22867     s2_is_unicode = PyUnicode_CheckExact(s2);
22868 #if PY_MAJOR_VERSION < 3
22869     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
22870         owned_ref = PyUnicode_FromObject(s2);
22871         if (unlikely(!owned_ref))
22872             return -1;
22873         s2 = owned_ref;
22874         s2_is_unicode = 1;
22875     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
22876         owned_ref = PyUnicode_FromObject(s1);
22877         if (unlikely(!owned_ref))
22878             return -1;
22879         s1 = owned_ref;
22880         s1_is_unicode = 1;
22881     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
22882         return __Pyx_PyBytes_Equals(s1, s2, equals);
22883     }
22884 #endif
22885     if (s1_is_unicode & s2_is_unicode) {
22886         Py_ssize_t length;
22887         int kind;
22888         void *data1, *data2;
22889         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
22890             return -1;
22891         length = __Pyx_PyUnicode_GET_LENGTH(s1);
22892         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
22893             goto return_ne;
22894         }
22895 #if CYTHON_USE_UNICODE_INTERNALS
22896         {
22897             Py_hash_t hash1, hash2;
22898         #if CYTHON_PEP393_ENABLED
22899             hash1 = ((PyASCIIObject*)s1)->hash;
22900             hash2 = ((PyASCIIObject*)s2)->hash;
22901         #else
22902             hash1 = ((PyUnicodeObject*)s1)->hash;
22903             hash2 = ((PyUnicodeObject*)s2)->hash;
22904         #endif
22905             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22906                 goto return_ne;
22907             }
22908         }
22909 #endif
22910         kind = __Pyx_PyUnicode_KIND(s1);
22911         if (kind != __Pyx_PyUnicode_KIND(s2)) {
22912             goto return_ne;
22913         }
22914         data1 = __Pyx_PyUnicode_DATA(s1);
22915         data2 = __Pyx_PyUnicode_DATA(s2);
22916         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
22917             goto return_ne;
22918         } else if (length == 1) {
22919             goto return_eq;
22920         } else {
22921             int result = memcmp(data1, data2, (size_t)(length * kind));
22922             #if PY_MAJOR_VERSION < 3
22923             Py_XDECREF(owned_ref);
22924             #endif
22925             return (equals == Py_EQ) ? (result == 0) : (result != 0);
22926         }
22927     } else if ((s1 == Py_None) & s2_is_unicode) {
22928         goto return_ne;
22929     } else if ((s2 == Py_None) & s1_is_unicode) {
22930         goto return_ne;
22931     } else {
22932         int result;
22933         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22934         #if PY_MAJOR_VERSION < 3
22935         Py_XDECREF(owned_ref);
22936         #endif
22937         if (!py_result)
22938             return -1;
22939         result = __Pyx_PyObject_IsTrue(py_result);
22940         Py_DECREF(py_result);
22941         return result;
22942     }
22943 return_eq:
22944     #if PY_MAJOR_VERSION < 3
22945     Py_XDECREF(owned_ref);
22946     #endif
22947     return (equals == Py_EQ);
22948 return_ne:
22949     #if PY_MAJOR_VERSION < 3
22950     Py_XDECREF(owned_ref);
22951     #endif
22952     return (equals == Py_NE);
22953 #endif
22954 }
22955 
22956 /* None */
__Pyx_div_Py_ssize_t(Py_ssize_t a,Py_ssize_t b)22957 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
22958     Py_ssize_t q = a / b;
22959     Py_ssize_t r = a - q*b;
22960     q -= ((r != 0) & ((r ^ b) < 0));
22961     return q;
22962 }
22963 
22964 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)22965 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
22966 #if CYTHON_USE_TYPE_SLOTS
22967 #if PY_MAJOR_VERSION >= 3
22968     if (likely(PyUnicode_Check(n)))
22969 #else
22970     if (likely(PyString_Check(n)))
22971 #endif
22972         return __Pyx_PyObject_GetAttrStr(o, n);
22973 #endif
22974     return PyObject_GetAttr(o, n);
22975 }
22976 
22977 /* ObjectGetItem */
22978 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)22979 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
22980     PyObject *runerr;
22981     Py_ssize_t key_value;
22982     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
22983     if (unlikely(!(m && m->sq_item))) {
22984         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
22985         return NULL;
22986     }
22987     key_value = __Pyx_PyIndex_AsSsize_t(index);
22988     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
22989         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
22990     }
22991     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
22992         PyErr_Clear();
22993         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
22994     }
22995     return NULL;
22996 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)22997 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
22998     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
22999     if (likely(m && m->mp_subscript)) {
23000         return m->mp_subscript(obj, key);
23001     }
23002     return __Pyx_PyObject_GetIndex(obj, key);
23003 }
23004 #endif
23005 
23006 /* decode_c_string */
__Pyx_decode_c_string(const char * cstring,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))23007 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
23008          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
23009          const char* encoding, const char* errors,
23010          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
23011     Py_ssize_t length;
23012     if (unlikely((start < 0) | (stop < 0))) {
23013         size_t slen = strlen(cstring);
23014         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
23015             PyErr_SetString(PyExc_OverflowError,
23016                             "c-string too long to convert to Python");
23017             return NULL;
23018         }
23019         length = (Py_ssize_t) slen;
23020         if (start < 0) {
23021             start += length;
23022             if (start < 0)
23023                 start = 0;
23024         }
23025         if (stop < 0)
23026             stop += length;
23027     }
23028     length = stop - start;
23029     if (unlikely(length <= 0))
23030         return PyUnicode_FromUnicode(NULL, 0);
23031     cstring += start;
23032     if (decode_func) {
23033         return decode_func(cstring, length, errors);
23034     } else {
23035         return PyUnicode_Decode(cstring, length, encoding, errors);
23036     }
23037 }
23038 
23039 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)23040 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
23041     __Pyx_PyThreadState_declare
23042     __Pyx_PyThreadState_assign
23043     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
23044         return NULL;
23045     __Pyx_PyErr_Clear();
23046     Py_INCREF(d);
23047     return d;
23048 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)23049 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
23050     PyObject *r = __Pyx_GetAttr(o, n);
23051     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
23052 }
23053 
23054 /* SwapException */
23055 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)23056 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23057     PyObject *tmp_type, *tmp_value, *tmp_tb;
23058     #if CYTHON_USE_EXC_INFO_STACK
23059     _PyErr_StackItem *exc_info = tstate->exc_info;
23060     tmp_type = exc_info->exc_type;
23061     tmp_value = exc_info->exc_value;
23062     tmp_tb = exc_info->exc_traceback;
23063     exc_info->exc_type = *type;
23064     exc_info->exc_value = *value;
23065     exc_info->exc_traceback = *tb;
23066     #else
23067     tmp_type = tstate->exc_type;
23068     tmp_value = tstate->exc_value;
23069     tmp_tb = tstate->exc_traceback;
23070     tstate->exc_type = *type;
23071     tstate->exc_value = *value;
23072     tstate->exc_traceback = *tb;
23073     #endif
23074     *type = tmp_type;
23075     *value = tmp_value;
23076     *tb = tmp_tb;
23077 }
23078 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)23079 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
23080     PyObject *tmp_type, *tmp_value, *tmp_tb;
23081     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
23082     PyErr_SetExcInfo(*type, *value, *tb);
23083     *type = tmp_type;
23084     *value = tmp_value;
23085     *tb = tmp_tb;
23086 }
23087 #endif
23088 
23089 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)23090 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
23091     PyObject *empty_list = 0;
23092     PyObject *module = 0;
23093     PyObject *global_dict = 0;
23094     PyObject *empty_dict = 0;
23095     PyObject *list;
23096     #if PY_MAJOR_VERSION < 3
23097     PyObject *py_import;
23098     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
23099     if (!py_import)
23100         goto bad;
23101     #endif
23102     if (from_list)
23103         list = from_list;
23104     else {
23105         empty_list = PyList_New(0);
23106         if (!empty_list)
23107             goto bad;
23108         list = empty_list;
23109     }
23110     global_dict = PyModule_GetDict(__pyx_m);
23111     if (!global_dict)
23112         goto bad;
23113     empty_dict = PyDict_New();
23114     if (!empty_dict)
23115         goto bad;
23116     {
23117         #if PY_MAJOR_VERSION >= 3
23118         if (level == -1) {
23119             if (strchr(__Pyx_MODULE_NAME, '.')) {
23120                 module = PyImport_ImportModuleLevelObject(
23121                     name, global_dict, empty_dict, list, 1);
23122                 if (!module) {
23123                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
23124                         goto bad;
23125                     PyErr_Clear();
23126                 }
23127             }
23128             level = 0;
23129         }
23130         #endif
23131         if (!module) {
23132             #if PY_MAJOR_VERSION < 3
23133             PyObject *py_level = PyInt_FromLong(level);
23134             if (!py_level)
23135                 goto bad;
23136             module = PyObject_CallFunctionObjArgs(py_import,
23137                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
23138             Py_DECREF(py_level);
23139             #else
23140             module = PyImport_ImportModuleLevelObject(
23141                 name, global_dict, empty_dict, list, level);
23142             #endif
23143         }
23144     }
23145 bad:
23146     #if PY_MAJOR_VERSION < 3
23147     Py_XDECREF(py_import);
23148     #endif
23149     Py_XDECREF(empty_list);
23150     Py_XDECREF(empty_dict);
23151     return module;
23152 }
23153 
23154 /* FastTypeChecks */
23155 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)23156 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
23157     while (a) {
23158         a = a->tp_base;
23159         if (a == b)
23160             return 1;
23161     }
23162     return b == &PyBaseObject_Type;
23163 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)23164 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
23165     PyObject *mro;
23166     if (a == b) return 1;
23167     mro = a->tp_mro;
23168     if (likely(mro)) {
23169         Py_ssize_t i, n;
23170         n = PyTuple_GET_SIZE(mro);
23171         for (i = 0; i < n; i++) {
23172             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
23173                 return 1;
23174         }
23175         return 0;
23176     }
23177     return __Pyx_InBases(a, b);
23178 }
23179 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)23180 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
23181     PyObject *exception, *value, *tb;
23182     int res;
23183     __Pyx_PyThreadState_declare
23184     __Pyx_PyThreadState_assign
23185     __Pyx_ErrFetch(&exception, &value, &tb);
23186     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
23187     if (unlikely(res == -1)) {
23188         PyErr_WriteUnraisable(err);
23189         res = 0;
23190     }
23191     if (!res) {
23192         res = PyObject_IsSubclass(err, exc_type2);
23193         if (unlikely(res == -1)) {
23194             PyErr_WriteUnraisable(err);
23195             res = 0;
23196         }
23197     }
23198     __Pyx_ErrRestore(exception, value, tb);
23199     return res;
23200 }
23201 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)23202 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
23203     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
23204     if (!res) {
23205         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
23206     }
23207     return res;
23208 }
23209 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)23210 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
23211     Py_ssize_t i, n;
23212     assert(PyExceptionClass_Check(exc_type));
23213     n = PyTuple_GET_SIZE(tuple);
23214 #if PY_MAJOR_VERSION >= 3
23215     for (i=0; i<n; i++) {
23216         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
23217     }
23218 #endif
23219     for (i=0; i<n; i++) {
23220         PyObject *t = PyTuple_GET_ITEM(tuple, i);
23221         #if PY_MAJOR_VERSION < 3
23222         if (likely(exc_type == t)) return 1;
23223         #endif
23224         if (likely(PyExceptionClass_Check(t))) {
23225             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
23226         } else {
23227         }
23228     }
23229     return 0;
23230 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)23231 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
23232     if (likely(err == exc_type)) return 1;
23233     if (likely(PyExceptionClass_Check(err))) {
23234         if (likely(PyExceptionClass_Check(exc_type))) {
23235             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
23236         } else if (likely(PyTuple_Check(exc_type))) {
23237             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
23238         } else {
23239         }
23240     }
23241     return PyErr_GivenExceptionMatches(err, exc_type);
23242 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)23243 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
23244     assert(PyExceptionClass_Check(exc_type1));
23245     assert(PyExceptionClass_Check(exc_type2));
23246     if (likely(err == exc_type1 || err == exc_type2)) return 1;
23247     if (likely(PyExceptionClass_Check(err))) {
23248         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
23249     }
23250     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
23251 }
23252 #endif
23253 
23254 /* PyIntBinop */
23255 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)23256 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
23257     (void)inplace;
23258     (void)zerodivision_check;
23259     #if PY_MAJOR_VERSION < 3
23260     if (likely(PyInt_CheckExact(op1))) {
23261         const long b = intval;
23262         long x;
23263         long a = PyInt_AS_LONG(op1);
23264             x = (long)((unsigned long)a + b);
23265             if (likely((x^a) >= 0 || (x^b) >= 0))
23266                 return PyInt_FromLong(x);
23267             return PyLong_Type.tp_as_number->nb_add(op1, op2);
23268     }
23269     #endif
23270     #if CYTHON_USE_PYLONG_INTERNALS
23271     if (likely(PyLong_CheckExact(op1))) {
23272         const long b = intval;
23273         long a, x;
23274 #ifdef HAVE_LONG_LONG
23275         const PY_LONG_LONG llb = intval;
23276         PY_LONG_LONG lla, llx;
23277 #endif
23278         const digit* digits = ((PyLongObject*)op1)->ob_digit;
23279         const Py_ssize_t size = Py_SIZE(op1);
23280         if (likely(__Pyx_sst_abs(size) <= 1)) {
23281             a = likely(size) ? digits[0] : 0;
23282             if (size == -1) a = -a;
23283         } else {
23284             switch (size) {
23285                 case -2:
23286                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23287                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23288                         break;
23289 #ifdef HAVE_LONG_LONG
23290                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23291                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23292                         goto long_long;
23293 #endif
23294                     }
23295                     CYTHON_FALLTHROUGH;
23296                 case 2:
23297                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23298                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23299                         break;
23300 #ifdef HAVE_LONG_LONG
23301                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23302                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23303                         goto long_long;
23304 #endif
23305                     }
23306                     CYTHON_FALLTHROUGH;
23307                 case -3:
23308                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23309                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23310                         break;
23311 #ifdef HAVE_LONG_LONG
23312                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23313                         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]));
23314                         goto long_long;
23315 #endif
23316                     }
23317                     CYTHON_FALLTHROUGH;
23318                 case 3:
23319                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23320                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23321                         break;
23322 #ifdef HAVE_LONG_LONG
23323                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23324                         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]));
23325                         goto long_long;
23326 #endif
23327                     }
23328                     CYTHON_FALLTHROUGH;
23329                 case -4:
23330                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23331                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23332                         break;
23333 #ifdef HAVE_LONG_LONG
23334                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23335                         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]));
23336                         goto long_long;
23337 #endif
23338                     }
23339                     CYTHON_FALLTHROUGH;
23340                 case 4:
23341                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23342                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23343                         break;
23344 #ifdef HAVE_LONG_LONG
23345                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23346                         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]));
23347                         goto long_long;
23348 #endif
23349                     }
23350                     CYTHON_FALLTHROUGH;
23351                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
23352             }
23353         }
23354                 x = a + b;
23355             return PyLong_FromLong(x);
23356 #ifdef HAVE_LONG_LONG
23357         long_long:
23358                 llx = lla + llb;
23359             return PyLong_FromLongLong(llx);
23360 #endif
23361 
23362 
23363     }
23364     #endif
23365     if (PyFloat_CheckExact(op1)) {
23366         const long b = intval;
23367         double a = PyFloat_AS_DOUBLE(op1);
23368             double result;
23369             PyFPE_START_PROTECT("add", return NULL)
23370             result = ((double)a) + (double)b;
23371             PyFPE_END_PROTECT(result)
23372             return PyFloat_FromDouble(result);
23373     }
23374     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
23375 }
23376 #endif
23377 
23378 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)23379 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
23380     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
23381 }
23382 
23383 /* None */
__Pyx_div_long(long a,long b)23384 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
23385     long q = a / b;
23386     long r = a - q*b;
23387     q -= ((r != 0) & ((r ^ b) < 0));
23388     return q;
23389 }
23390 
23391 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)23392 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
23393                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
23394                                   int full_traceback, CYTHON_UNUSED int nogil) {
23395     PyObject *old_exc, *old_val, *old_tb;
23396     PyObject *ctx;
23397     __Pyx_PyThreadState_declare
23398 #ifdef WITH_THREAD
23399     PyGILState_STATE state;
23400     if (nogil)
23401         state = PyGILState_Ensure();
23402 #ifdef _MSC_VER
23403     else state = (PyGILState_STATE)-1;
23404 #endif
23405 #endif
23406     __Pyx_PyThreadState_assign
23407     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
23408     if (full_traceback) {
23409         Py_XINCREF(old_exc);
23410         Py_XINCREF(old_val);
23411         Py_XINCREF(old_tb);
23412         __Pyx_ErrRestore(old_exc, old_val, old_tb);
23413         PyErr_PrintEx(1);
23414     }
23415     #if PY_MAJOR_VERSION < 3
23416     ctx = PyString_FromString(name);
23417     #else
23418     ctx = PyUnicode_FromString(name);
23419     #endif
23420     __Pyx_ErrRestore(old_exc, old_val, old_tb);
23421     if (!ctx) {
23422         PyErr_WriteUnraisable(Py_None);
23423     } else {
23424         PyErr_WriteUnraisable(ctx);
23425         Py_DECREF(ctx);
23426     }
23427 #ifdef WITH_THREAD
23428     if (nogil)
23429         PyGILState_Release(state);
23430 #endif
23431 }
23432 
23433 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)23434 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
23435     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
23436     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
23437         PyErr_Format(PyExc_ImportError,
23438         #if PY_MAJOR_VERSION < 3
23439             "cannot import name %.230s", PyString_AS_STRING(name));
23440         #else
23441             "cannot import name %S", name);
23442         #endif
23443     }
23444     return value;
23445 }
23446 
23447 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)23448 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
23449     PyObject *r;
23450     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
23451         PyErr_SetString(PyExc_TypeError,
23452                         "hasattr(): attribute name must be string");
23453         return -1;
23454     }
23455     r = __Pyx_GetAttr(o, n);
23456     if (unlikely(!r)) {
23457         PyErr_Clear();
23458         return 0;
23459     } else {
23460         Py_DECREF(r);
23461         return 1;
23462     }
23463 }
23464 
23465 /* PyObject_GenericGetAttrNoDict */
23466 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)23467 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
23468     PyErr_Format(PyExc_AttributeError,
23469 #if PY_MAJOR_VERSION >= 3
23470                  "'%.50s' object has no attribute '%U'",
23471                  tp->tp_name, attr_name);
23472 #else
23473                  "'%.50s' object has no attribute '%.400s'",
23474                  tp->tp_name, PyString_AS_STRING(attr_name));
23475 #endif
23476     return NULL;
23477 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)23478 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
23479     PyObject *descr;
23480     PyTypeObject *tp = Py_TYPE(obj);
23481     if (unlikely(!PyString_Check(attr_name))) {
23482         return PyObject_GenericGetAttr(obj, attr_name);
23483     }
23484     assert(!tp->tp_dictoffset);
23485     descr = _PyType_Lookup(tp, attr_name);
23486     if (unlikely(!descr)) {
23487         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
23488     }
23489     Py_INCREF(descr);
23490     #if PY_MAJOR_VERSION < 3
23491     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
23492     #endif
23493     {
23494         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
23495         if (unlikely(f)) {
23496             PyObject *res = f(descr, obj, (PyObject *)tp);
23497             Py_DECREF(descr);
23498             return res;
23499         }
23500     }
23501     return descr;
23502 }
23503 #endif
23504 
23505 /* PyObject_GenericGetAttr */
23506 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)23507 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
23508     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
23509         return PyObject_GenericGetAttr(obj, attr_name);
23510     }
23511     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
23512 }
23513 #endif
23514 
23515 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)23516 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
23517 #if PY_VERSION_HEX >= 0x02070000
23518     PyObject *ob = PyCapsule_New(vtable, 0, 0);
23519 #else
23520     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
23521 #endif
23522     if (!ob)
23523         goto bad;
23524     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
23525         goto bad;
23526     Py_DECREF(ob);
23527     return 0;
23528 bad:
23529     Py_XDECREF(ob);
23530     return -1;
23531 }
23532 
23533 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)23534 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
23535   int ret;
23536   PyObject *name_attr;
23537   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
23538   if (likely(name_attr)) {
23539       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
23540   } else {
23541       ret = -1;
23542   }
23543   if (unlikely(ret < 0)) {
23544       PyErr_Clear();
23545       ret = 0;
23546   }
23547   Py_XDECREF(name_attr);
23548   return ret;
23549 }
__Pyx_setup_reduce(PyObject * type_obj)23550 static int __Pyx_setup_reduce(PyObject* type_obj) {
23551     int ret = 0;
23552     PyObject *object_reduce = NULL;
23553     PyObject *object_reduce_ex = NULL;
23554     PyObject *reduce = NULL;
23555     PyObject *reduce_ex = NULL;
23556     PyObject *reduce_cython = NULL;
23557     PyObject *setstate = NULL;
23558     PyObject *setstate_cython = NULL;
23559 #if CYTHON_USE_PYTYPE_LOOKUP
23560     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
23561 #else
23562     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
23563 #endif
23564 #if CYTHON_USE_PYTYPE_LOOKUP
23565     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
23566 #else
23567     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
23568 #endif
23569     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
23570     if (reduce_ex == object_reduce_ex) {
23571 #if CYTHON_USE_PYTYPE_LOOKUP
23572         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
23573 #else
23574         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
23575 #endif
23576         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
23577         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
23578             reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
23579             ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
23580             ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
23581             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
23582             if (!setstate) PyErr_Clear();
23583             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
23584                 setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
23585                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
23586                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
23587             }
23588             PyType_Modified((PyTypeObject*)type_obj);
23589         }
23590     }
23591     goto GOOD;
23592 BAD:
23593     if (!PyErr_Occurred())
23594         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
23595     ret = -1;
23596 GOOD:
23597 #if !CYTHON_USE_PYTYPE_LOOKUP
23598     Py_XDECREF(object_reduce);
23599     Py_XDECREF(object_reduce_ex);
23600 #endif
23601     Py_XDECREF(reduce);
23602     Py_XDECREF(reduce_ex);
23603     Py_XDECREF(reduce_cython);
23604     Py_XDECREF(setstate);
23605     Py_XDECREF(setstate_cython);
23606     return ret;
23607 }
23608 
23609 /* TypeImport */
23610 #ifndef __PYX_HAVE_RT_ImportType
23611 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)23612 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
23613     size_t size, enum __Pyx_ImportType_CheckSize check_size)
23614 {
23615     PyObject *result = 0;
23616     char warning[200];
23617     Py_ssize_t basicsize;
23618 #ifdef Py_LIMITED_API
23619     PyObject *py_basicsize;
23620 #endif
23621     result = PyObject_GetAttrString(module, class_name);
23622     if (!result)
23623         goto bad;
23624     if (!PyType_Check(result)) {
23625         PyErr_Format(PyExc_TypeError,
23626             "%.200s.%.200s is not a type object",
23627             module_name, class_name);
23628         goto bad;
23629     }
23630 #ifndef Py_LIMITED_API
23631     basicsize = ((PyTypeObject *)result)->tp_basicsize;
23632 #else
23633     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
23634     if (!py_basicsize)
23635         goto bad;
23636     basicsize = PyLong_AsSsize_t(py_basicsize);
23637     Py_DECREF(py_basicsize);
23638     py_basicsize = 0;
23639     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
23640         goto bad;
23641 #endif
23642     if ((size_t)basicsize < size) {
23643         PyErr_Format(PyExc_ValueError,
23644             "%.200s.%.200s size changed, may indicate binary incompatibility. "
23645             "Expected %zd from C header, got %zd from PyObject",
23646             module_name, class_name, size, basicsize);
23647         goto bad;
23648     }
23649     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
23650         PyErr_Format(PyExc_ValueError,
23651             "%.200s.%.200s size changed, may indicate binary incompatibility. "
23652             "Expected %zd from C header, got %zd from PyObject",
23653             module_name, class_name, size, basicsize);
23654         goto bad;
23655     }
23656     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
23657         PyOS_snprintf(warning, sizeof(warning),
23658             "%s.%s size changed, may indicate binary incompatibility. "
23659             "Expected %zd from C header, got %zd from PyObject",
23660             module_name, class_name, size, basicsize);
23661         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
23662     }
23663     return (PyTypeObject *)result;
23664 bad:
23665     Py_XDECREF(result);
23666     return NULL;
23667 }
23668 #endif
23669 
23670 /* CLineInTraceback */
23671 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(PyThreadState * tstate,int c_line)23672 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
23673     PyObject *use_cline;
23674     PyObject *ptype, *pvalue, *ptraceback;
23675 #if CYTHON_COMPILING_IN_CPYTHON
23676     PyObject **cython_runtime_dict;
23677 #endif
23678     if (unlikely(!__pyx_cython_runtime)) {
23679         return c_line;
23680     }
23681     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
23682 #if CYTHON_COMPILING_IN_CPYTHON
23683     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
23684     if (likely(cython_runtime_dict)) {
23685         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
23686             use_cline, *cython_runtime_dict,
23687             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
23688     } else
23689 #endif
23690     {
23691       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
23692       if (use_cline_obj) {
23693         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
23694         Py_DECREF(use_cline_obj);
23695       } else {
23696         PyErr_Clear();
23697         use_cline = NULL;
23698       }
23699     }
23700     if (!use_cline) {
23701         c_line = 0;
23702         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
23703     }
23704     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
23705         c_line = 0;
23706     }
23707     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
23708     return c_line;
23709 }
23710 #endif
23711 
23712 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)23713 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
23714     int start = 0, mid = 0, end = count - 1;
23715     if (end >= 0 && code_line > entries[end].code_line) {
23716         return count;
23717     }
23718     while (start < end) {
23719         mid = start + (end - start) / 2;
23720         if (code_line < entries[mid].code_line) {
23721             end = mid;
23722         } else if (code_line > entries[mid].code_line) {
23723              start = mid + 1;
23724         } else {
23725             return mid;
23726         }
23727     }
23728     if (code_line <= entries[mid].code_line) {
23729         return mid;
23730     } else {
23731         return mid + 1;
23732     }
23733 }
__pyx_find_code_object(int code_line)23734 static PyCodeObject *__pyx_find_code_object(int code_line) {
23735     PyCodeObject* code_object;
23736     int pos;
23737     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
23738         return NULL;
23739     }
23740     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
23741     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
23742         return NULL;
23743     }
23744     code_object = __pyx_code_cache.entries[pos].code_object;
23745     Py_INCREF(code_object);
23746     return code_object;
23747 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)23748 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
23749     int pos, i;
23750     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
23751     if (unlikely(!code_line)) {
23752         return;
23753     }
23754     if (unlikely(!entries)) {
23755         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
23756         if (likely(entries)) {
23757             __pyx_code_cache.entries = entries;
23758             __pyx_code_cache.max_count = 64;
23759             __pyx_code_cache.count = 1;
23760             entries[0].code_line = code_line;
23761             entries[0].code_object = code_object;
23762             Py_INCREF(code_object);
23763         }
23764         return;
23765     }
23766     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
23767     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
23768         PyCodeObject* tmp = entries[pos].code_object;
23769         entries[pos].code_object = code_object;
23770         Py_DECREF(tmp);
23771         return;
23772     }
23773     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
23774         int new_max = __pyx_code_cache.max_count + 64;
23775         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
23776             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
23777         if (unlikely(!entries)) {
23778             return;
23779         }
23780         __pyx_code_cache.entries = entries;
23781         __pyx_code_cache.max_count = new_max;
23782     }
23783     for (i=__pyx_code_cache.count; i>pos; i--) {
23784         entries[i] = entries[i-1];
23785     }
23786     entries[pos].code_line = code_line;
23787     entries[pos].code_object = code_object;
23788     __pyx_code_cache.count++;
23789     Py_INCREF(code_object);
23790 }
23791 
23792 /* AddTraceback */
23793 #include "compile.h"
23794 #include "frameobject.h"
23795 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)23796 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
23797             const char *funcname, int c_line,
23798             int py_line, const char *filename) {
23799     PyCodeObject *py_code = 0;
23800     PyObject *py_srcfile = 0;
23801     PyObject *py_funcname = 0;
23802     #if PY_MAJOR_VERSION < 3
23803     py_srcfile = PyString_FromString(filename);
23804     #else
23805     py_srcfile = PyUnicode_FromString(filename);
23806     #endif
23807     if (!py_srcfile) goto bad;
23808     if (c_line) {
23809         #if PY_MAJOR_VERSION < 3
23810         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
23811         #else
23812         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
23813         #endif
23814     }
23815     else {
23816         #if PY_MAJOR_VERSION < 3
23817         py_funcname = PyString_FromString(funcname);
23818         #else
23819         py_funcname = PyUnicode_FromString(funcname);
23820         #endif
23821     }
23822     if (!py_funcname) goto bad;
23823     py_code = __Pyx_PyCode_New(
23824         0,
23825         0,
23826         0,
23827         0,
23828         0,
23829         __pyx_empty_bytes, /*PyObject *code,*/
23830         __pyx_empty_tuple, /*PyObject *consts,*/
23831         __pyx_empty_tuple, /*PyObject *names,*/
23832         __pyx_empty_tuple, /*PyObject *varnames,*/
23833         __pyx_empty_tuple, /*PyObject *freevars,*/
23834         __pyx_empty_tuple, /*PyObject *cellvars,*/
23835         py_srcfile,   /*PyObject *filename,*/
23836         py_funcname,  /*PyObject *name,*/
23837         py_line,
23838         __pyx_empty_bytes  /*PyObject *lnotab*/
23839     );
23840     Py_DECREF(py_srcfile);
23841     Py_DECREF(py_funcname);
23842     return py_code;
23843 bad:
23844     Py_XDECREF(py_srcfile);
23845     Py_XDECREF(py_funcname);
23846     return NULL;
23847 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)23848 static void __Pyx_AddTraceback(const char *funcname, int c_line,
23849                                int py_line, const char *filename) {
23850     PyCodeObject *py_code = 0;
23851     PyFrameObject *py_frame = 0;
23852     PyThreadState *tstate = __Pyx_PyThreadState_Current;
23853     if (c_line) {
23854         c_line = __Pyx_CLineForTraceback(tstate, c_line);
23855     }
23856     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
23857     if (!py_code) {
23858         py_code = __Pyx_CreateCodeObjectForTraceback(
23859             funcname, c_line, py_line, filename);
23860         if (!py_code) goto bad;
23861         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
23862     }
23863     py_frame = PyFrame_New(
23864         tstate,            /*PyThreadState *tstate,*/
23865         py_code,           /*PyCodeObject *code,*/
23866         __pyx_d,    /*PyObject *globals,*/
23867         0                  /*PyObject *locals*/
23868     );
23869     if (!py_frame) goto bad;
23870     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
23871     PyTraceBack_Here(py_frame);
23872 bad:
23873     Py_XDECREF(py_code);
23874     Py_XDECREF(py_frame);
23875 }
23876 
23877 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)23878 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
23879     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
23880         if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
23881         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
23882         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
23883     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
23884     return -1;
23885 }
__Pyx_ReleaseBuffer(Py_buffer * view)23886 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
23887     PyObject *obj = view->obj;
23888     if (!obj) return;
23889     if (PyObject_CheckBuffer(obj)) {
23890         PyBuffer_Release(view);
23891         return;
23892     }
23893     if ((0)) {}
23894         else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
23895     view->obj = NULL;
23896     Py_DECREF(obj);
23897 }
23898 #endif
23899 
23900 
23901 /* MemviewSliceIsContig */
23902 static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)23903 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
23904 {
23905     int i, index, step, start;
23906     Py_ssize_t itemsize = mvs.memview->view.itemsize;
23907     if (order == 'F') {
23908         step = 1;
23909         start = 0;
23910     } else {
23911         step = -1;
23912         start = ndim - 1;
23913     }
23914     for (i = 0; i < ndim; i++) {
23915         index = start + step * i;
23916         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
23917             return 0;
23918         itemsize *= mvs.shape[index];
23919     }
23920     return 1;
23921 }
23922 
23923 /* OverlappingSlices */
23924 static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)23925 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
23926                                void **out_start, void **out_end,
23927                                int ndim, size_t itemsize)
23928 {
23929     char *start, *end;
23930     int i;
23931     start = end = slice->data;
23932     for (i = 0; i < ndim; i++) {
23933         Py_ssize_t stride = slice->strides[i];
23934         Py_ssize_t extent = slice->shape[i];
23935         if (extent == 0) {
23936             *out_start = *out_end = start;
23937             return;
23938         } else {
23939             if (stride > 0)
23940                 end += stride * (extent - 1);
23941             else
23942                 start += stride * (extent - 1);
23943         }
23944     }
23945     *out_start = start;
23946     *out_end = end + itemsize;
23947 }
23948 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)23949 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
23950                      __Pyx_memviewslice *slice2,
23951                      int ndim, size_t itemsize)
23952 {
23953     void *start1, *end1, *start2, *end2;
23954     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
23955     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
23956     return (start1 < end2) && (start2 < end1);
23957 }
23958 
23959 /* Capsule */
23960 static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)23961 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
23962 {
23963     PyObject *cobj;
23964 #if PY_VERSION_HEX >= 0x02070000
23965     cobj = PyCapsule_New(p, sig, NULL);
23966 #else
23967     cobj = PyCObject_FromVoidPtr(p, NULL);
23968 #endif
23969     return cobj;
23970 }
23971 
23972 /* CIntFromPyVerify */
23973 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
23974     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
23975 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
23976     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
23977 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
23978     {\
23979         func_type value = func_value;\
23980         if (sizeof(target_type) < sizeof(func_type)) {\
23981             if (unlikely(value != (func_type) (target_type) value)) {\
23982                 func_type zero = 0;\
23983                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
23984                     return (target_type) -1;\
23985                 if (is_unsigned && unlikely(value < zero))\
23986                     goto raise_neg_overflow;\
23987                 else\
23988                     goto raise_overflow;\
23989             }\
23990         }\
23991         return (target_type) value;\
23992     }
23993 
23994 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)23995 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
23996 {
23997   union {
23998     uint32_t u32;
23999     uint8_t u8[4];
24000   } S;
24001   S.u32 = 0x01020304;
24002   return S.u8[0] == 4;
24003 }
24004 
24005 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)24006 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
24007                               __Pyx_BufFmt_StackElem* stack,
24008                               __Pyx_TypeInfo* type) {
24009   stack[0].field = &ctx->root;
24010   stack[0].parent_offset = 0;
24011   ctx->root.type = type;
24012   ctx->root.name = "buffer dtype";
24013   ctx->root.offset = 0;
24014   ctx->head = stack;
24015   ctx->head->field = &ctx->root;
24016   ctx->fmt_offset = 0;
24017   ctx->head->parent_offset = 0;
24018   ctx->new_packmode = '@';
24019   ctx->enc_packmode = '@';
24020   ctx->new_count = 1;
24021   ctx->enc_count = 0;
24022   ctx->enc_type = 0;
24023   ctx->is_complex = 0;
24024   ctx->is_valid_array = 0;
24025   ctx->struct_alignment = 0;
24026   while (type->typegroup == 'S') {
24027     ++ctx->head;
24028     ctx->head->field = type->fields;
24029     ctx->head->parent_offset = 0;
24030     type = type->fields->type;
24031   }
24032 }
__Pyx_BufFmt_ParseNumber(const char ** ts)24033 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
24034     int count;
24035     const char* t = *ts;
24036     if (*t < '0' || *t > '9') {
24037       return -1;
24038     } else {
24039         count = *t++ - '0';
24040         while (*t >= '0' && *t <= '9') {
24041             count *= 10;
24042             count += *t++ - '0';
24043         }
24044     }
24045     *ts = t;
24046     return count;
24047 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)24048 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
24049     int number = __Pyx_BufFmt_ParseNumber(ts);
24050     if (number == -1)
24051         PyErr_Format(PyExc_ValueError,\
24052                      "Does not understand character buffer dtype format string ('%c')", **ts);
24053     return number;
24054 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)24055 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
24056   PyErr_Format(PyExc_ValueError,
24057                "Unexpected format string character: '%c'", ch);
24058 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)24059 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
24060   switch (ch) {
24061     case 'c': return "'char'";
24062     case 'b': return "'signed char'";
24063     case 'B': return "'unsigned char'";
24064     case 'h': return "'short'";
24065     case 'H': return "'unsigned short'";
24066     case 'i': return "'int'";
24067     case 'I': return "'unsigned int'";
24068     case 'l': return "'long'";
24069     case 'L': return "'unsigned long'";
24070     case 'q': return "'long long'";
24071     case 'Q': return "'unsigned long long'";
24072     case 'f': return (is_complex ? "'complex float'" : "'float'");
24073     case 'd': return (is_complex ? "'complex double'" : "'double'");
24074     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
24075     case 'T': return "a struct";
24076     case 'O': return "Python object";
24077     case 'P': return "a pointer";
24078     case 's': case 'p': return "a string";
24079     case 0: return "end";
24080     default: return "unparseable format string";
24081   }
24082 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)24083 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
24084   switch (ch) {
24085     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24086     case 'h': case 'H': return 2;
24087     case 'i': case 'I': case 'l': case 'L': return 4;
24088     case 'q': case 'Q': return 8;
24089     case 'f': return (is_complex ? 8 : 4);
24090     case 'd': return (is_complex ? 16 : 8);
24091     case 'g': {
24092       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
24093       return 0;
24094     }
24095     case 'O': case 'P': return sizeof(void*);
24096     default:
24097       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24098       return 0;
24099     }
24100 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)24101 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
24102   switch (ch) {
24103     case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24104     case 'h': case 'H': return sizeof(short);
24105     case 'i': case 'I': return sizeof(int);
24106     case 'l': case 'L': return sizeof(long);
24107     #ifdef HAVE_LONG_LONG
24108     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
24109     #endif
24110     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
24111     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
24112     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
24113     case 'O': case 'P': return sizeof(void*);
24114     default: {
24115       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24116       return 0;
24117     }
24118   }
24119 }
24120 typedef struct { char c; short x; } __Pyx_st_short;
24121 typedef struct { char c; int x; } __Pyx_st_int;
24122 typedef struct { char c; long x; } __Pyx_st_long;
24123 typedef struct { char c; float x; } __Pyx_st_float;
24124 typedef struct { char c; double x; } __Pyx_st_double;
24125 typedef struct { char c; long double x; } __Pyx_st_longdouble;
24126 typedef struct { char c; void *x; } __Pyx_st_void_p;
24127 #ifdef HAVE_LONG_LONG
24128 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
24129 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)24130 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
24131   switch (ch) {
24132     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24133     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
24134     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
24135     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
24136 #ifdef HAVE_LONG_LONG
24137     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
24138 #endif
24139     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
24140     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
24141     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
24142     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
24143     default:
24144       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24145       return 0;
24146     }
24147 }
24148 /* These are for computing the padding at the end of the struct to align
24149    on the first member of the struct. This will probably the same as above,
24150    but we don't have any guarantees.
24151  */
24152 typedef struct { short x; char c; } __Pyx_pad_short;
24153 typedef struct { int x; char c; } __Pyx_pad_int;
24154 typedef struct { long x; char c; } __Pyx_pad_long;
24155 typedef struct { float x; char c; } __Pyx_pad_float;
24156 typedef struct { double x; char c; } __Pyx_pad_double;
24157 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
24158 typedef struct { void *x; char c; } __Pyx_pad_void_p;
24159 #ifdef HAVE_LONG_LONG
24160 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
24161 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)24162 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
24163   switch (ch) {
24164     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24165     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
24166     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
24167     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
24168 #ifdef HAVE_LONG_LONG
24169     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
24170 #endif
24171     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
24172     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
24173     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
24174     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
24175     default:
24176       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24177       return 0;
24178     }
24179 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)24180 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
24181   switch (ch) {
24182     case 'c':
24183         return 'H';
24184     case 'b': case 'h': case 'i':
24185     case 'l': case 'q': case 's': case 'p':
24186         return 'I';
24187     case 'B': case 'H': case 'I': case 'L': case 'Q':
24188         return 'U';
24189     case 'f': case 'd': case 'g':
24190         return (is_complex ? 'C' : 'R');
24191     case 'O':
24192         return 'O';
24193     case 'P':
24194         return 'P';
24195     default: {
24196       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24197       return 0;
24198     }
24199   }
24200 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)24201 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
24202   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
24203     const char* expected;
24204     const char* quote;
24205     if (ctx->head == NULL) {
24206       expected = "end";
24207       quote = "";
24208     } else {
24209       expected = ctx->head->field->type->name;
24210       quote = "'";
24211     }
24212     PyErr_Format(PyExc_ValueError,
24213                  "Buffer dtype mismatch, expected %s%s%s but got %s",
24214                  quote, expected, quote,
24215                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
24216   } else {
24217     __Pyx_StructField* field = ctx->head->field;
24218     __Pyx_StructField* parent = (ctx->head - 1)->field;
24219     PyErr_Format(PyExc_ValueError,
24220                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
24221                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
24222                  parent->type->name, field->name);
24223   }
24224 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)24225 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
24226   char group;
24227   size_t size, offset, arraysize = 1;
24228   if (ctx->enc_type == 0) return 0;
24229   if (ctx->head->field->type->arraysize[0]) {
24230     int i, ndim = 0;
24231     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
24232         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
24233         ndim = 1;
24234         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
24235             PyErr_Format(PyExc_ValueError,
24236                          "Expected a dimension of size %zu, got %zu",
24237                          ctx->head->field->type->arraysize[0], ctx->enc_count);
24238             return -1;
24239         }
24240     }
24241     if (!ctx->is_valid_array) {
24242       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
24243                    ctx->head->field->type->ndim, ndim);
24244       return -1;
24245     }
24246     for (i = 0; i < ctx->head->field->type->ndim; i++) {
24247       arraysize *= ctx->head->field->type->arraysize[i];
24248     }
24249     ctx->is_valid_array = 0;
24250     ctx->enc_count = 1;
24251   }
24252   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
24253   do {
24254     __Pyx_StructField* field = ctx->head->field;
24255     __Pyx_TypeInfo* type = field->type;
24256     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
24257       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
24258     } else {
24259       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
24260     }
24261     if (ctx->enc_packmode == '@') {
24262       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
24263       size_t align_mod_offset;
24264       if (align_at == 0) return -1;
24265       align_mod_offset = ctx->fmt_offset % align_at;
24266       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
24267       if (ctx->struct_alignment == 0)
24268           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
24269                                                                  ctx->is_complex);
24270     }
24271     if (type->size != size || type->typegroup != group) {
24272       if (type->typegroup == 'C' && type->fields != NULL) {
24273         size_t parent_offset = ctx->head->parent_offset + field->offset;
24274         ++ctx->head;
24275         ctx->head->field = type->fields;
24276         ctx->head->parent_offset = parent_offset;
24277         continue;
24278       }
24279       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
24280       } else {
24281           __Pyx_BufFmt_RaiseExpected(ctx);
24282           return -1;
24283       }
24284     }
24285     offset = ctx->head->parent_offset + field->offset;
24286     if (ctx->fmt_offset != offset) {
24287       PyErr_Format(PyExc_ValueError,
24288                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
24289                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
24290       return -1;
24291     }
24292     ctx->fmt_offset += size;
24293     if (arraysize)
24294       ctx->fmt_offset += (arraysize - 1) * size;
24295     --ctx->enc_count;
24296     while (1) {
24297       if (field == &ctx->root) {
24298         ctx->head = NULL;
24299         if (ctx->enc_count != 0) {
24300           __Pyx_BufFmt_RaiseExpected(ctx);
24301           return -1;
24302         }
24303         break;
24304       }
24305       ctx->head->field = ++field;
24306       if (field->type == NULL) {
24307         --ctx->head;
24308         field = ctx->head->field;
24309         continue;
24310       } else if (field->type->typegroup == 'S') {
24311         size_t parent_offset = ctx->head->parent_offset + field->offset;
24312         if (field->type->fields->type == NULL) continue;
24313         field = field->type->fields;
24314         ++ctx->head;
24315         ctx->head->field = field;
24316         ctx->head->parent_offset = parent_offset;
24317         break;
24318       } else {
24319         break;
24320       }
24321     }
24322   } while (ctx->enc_count);
24323   ctx->enc_type = 0;
24324   ctx->is_complex = 0;
24325   return 0;
24326 }
24327 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)24328 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
24329 {
24330     const char *ts = *tsp;
24331     int i = 0, number;
24332     int ndim = ctx->head->field->type->ndim;
24333 ;
24334     ++ts;
24335     if (ctx->new_count != 1) {
24336         PyErr_SetString(PyExc_ValueError,
24337                         "Cannot handle repeated arrays in format string");
24338         return NULL;
24339     }
24340     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24341     while (*ts && *ts != ')') {
24342         switch (*ts) {
24343             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
24344             default:  break;
24345         }
24346         number = __Pyx_BufFmt_ExpectNumber(&ts);
24347         if (number == -1) return NULL;
24348         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
24349             return PyErr_Format(PyExc_ValueError,
24350                         "Expected a dimension of size %zu, got %d",
24351                         ctx->head->field->type->arraysize[i], number);
24352         if (*ts != ',' && *ts != ')')
24353             return PyErr_Format(PyExc_ValueError,
24354                                 "Expected a comma in format string, got '%c'", *ts);
24355         if (*ts == ',') ts++;
24356         i++;
24357     }
24358     if (i != ndim)
24359         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
24360                             ctx->head->field->type->ndim, i);
24361     if (!*ts) {
24362         PyErr_SetString(PyExc_ValueError,
24363                         "Unexpected end of format string, expected ')'");
24364         return NULL;
24365     }
24366     ctx->is_valid_array = 1;
24367     ctx->new_count = 1;
24368     *tsp = ++ts;
24369     return Py_None;
24370 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)24371 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
24372   int got_Z = 0;
24373   while (1) {
24374     switch(*ts) {
24375       case 0:
24376         if (ctx->enc_type != 0 && ctx->head == NULL) {
24377           __Pyx_BufFmt_RaiseExpected(ctx);
24378           return NULL;
24379         }
24380         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24381         if (ctx->head != NULL) {
24382           __Pyx_BufFmt_RaiseExpected(ctx);
24383           return NULL;
24384         }
24385         return ts;
24386       case ' ':
24387       case '\r':
24388       case '\n':
24389         ++ts;
24390         break;
24391       case '<':
24392         if (!__Pyx_Is_Little_Endian()) {
24393           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
24394           return NULL;
24395         }
24396         ctx->new_packmode = '=';
24397         ++ts;
24398         break;
24399       case '>':
24400       case '!':
24401         if (__Pyx_Is_Little_Endian()) {
24402           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
24403           return NULL;
24404         }
24405         ctx->new_packmode = '=';
24406         ++ts;
24407         break;
24408       case '=':
24409       case '@':
24410       case '^':
24411         ctx->new_packmode = *ts++;
24412         break;
24413       case 'T':
24414         {
24415           const char* ts_after_sub;
24416           size_t i, struct_count = ctx->new_count;
24417           size_t struct_alignment = ctx->struct_alignment;
24418           ctx->new_count = 1;
24419           ++ts;
24420           if (*ts != '{') {
24421             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
24422             return NULL;
24423           }
24424           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24425           ctx->enc_type = 0;
24426           ctx->enc_count = 0;
24427           ctx->struct_alignment = 0;
24428           ++ts;
24429           ts_after_sub = ts;
24430           for (i = 0; i != struct_count; ++i) {
24431             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
24432             if (!ts_after_sub) return NULL;
24433           }
24434           ts = ts_after_sub;
24435           if (struct_alignment) ctx->struct_alignment = struct_alignment;
24436         }
24437         break;
24438       case '}':
24439         {
24440           size_t alignment = ctx->struct_alignment;
24441           ++ts;
24442           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24443           ctx->enc_type = 0;
24444           if (alignment && ctx->fmt_offset % alignment) {
24445             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
24446           }
24447         }
24448         return ts;
24449       case 'x':
24450         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24451         ctx->fmt_offset += ctx->new_count;
24452         ctx->new_count = 1;
24453         ctx->enc_count = 0;
24454         ctx->enc_type = 0;
24455         ctx->enc_packmode = ctx->new_packmode;
24456         ++ts;
24457         break;
24458       case 'Z':
24459         got_Z = 1;
24460         ++ts;
24461         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
24462           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
24463           return NULL;
24464         }
24465         CYTHON_FALLTHROUGH;
24466       case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
24467       case 'l': case 'L': case 'q': case 'Q':
24468       case 'f': case 'd': case 'g':
24469       case 'O': case 'p':
24470         if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
24471             ctx->enc_packmode == ctx->new_packmode) {
24472           ctx->enc_count += ctx->new_count;
24473           ctx->new_count = 1;
24474           got_Z = 0;
24475           ++ts;
24476           break;
24477         }
24478         CYTHON_FALLTHROUGH;
24479       case 's':
24480         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24481         ctx->enc_count = ctx->new_count;
24482         ctx->enc_packmode = ctx->new_packmode;
24483         ctx->enc_type = *ts;
24484         ctx->is_complex = got_Z;
24485         ++ts;
24486         ctx->new_count = 1;
24487         got_Z = 0;
24488         break;
24489       case ':':
24490         ++ts;
24491         while(*ts != ':') ++ts;
24492         ++ts;
24493         break;
24494       case '(':
24495         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
24496         break;
24497       default:
24498         {
24499           int number = __Pyx_BufFmt_ExpectNumber(&ts);
24500           if (number == -1) return NULL;
24501           ctx->new_count = (size_t)number;
24502         }
24503     }
24504   }
24505 }
24506 
24507 /* TypeInfoCompare */
24508   static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo * a,__Pyx_TypeInfo * b)24509 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
24510 {
24511     int i;
24512     if (!a || !b)
24513         return 0;
24514     if (a == b)
24515         return 1;
24516     if (a->size != b->size || a->typegroup != b->typegroup ||
24517             a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
24518         if (a->typegroup == 'H' || b->typegroup == 'H') {
24519             return a->size == b->size;
24520         } else {
24521             return 0;
24522         }
24523     }
24524     if (a->ndim) {
24525         for (i = 0; i < a->ndim; i++)
24526             if (a->arraysize[i] != b->arraysize[i])
24527                 return 0;
24528     }
24529     if (a->typegroup == 'S') {
24530         if (a->flags != b->flags)
24531             return 0;
24532         if (a->fields || b->fields) {
24533             if (!(a->fields && b->fields))
24534                 return 0;
24535             for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
24536                 __Pyx_StructField *field_a = a->fields + i;
24537                 __Pyx_StructField *field_b = b->fields + i;
24538                 if (field_a->offset != field_b->offset ||
24539                     !__pyx_typeinfo_cmp(field_a->type, field_b->type))
24540                     return 0;
24541             }
24542             return !a->fields[i].type && !b->fields[i].type;
24543         }
24544     }
24545     return 1;
24546 }
24547 
24548 /* MemviewSliceValidateAndInit */
24549   static int
__pyx_check_strides(Py_buffer * buf,int dim,int ndim,int spec)24550 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
24551 {
24552     if (buf->shape[dim] <= 1)
24553         return 1;
24554     if (buf->strides) {
24555         if (spec & __Pyx_MEMVIEW_CONTIG) {
24556             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
24557                 if (buf->strides[dim] != sizeof(void *)) {
24558                     PyErr_Format(PyExc_ValueError,
24559                                  "Buffer is not indirectly contiguous "
24560                                  "in dimension %d.", dim);
24561                     goto fail;
24562                 }
24563             } else if (buf->strides[dim] != buf->itemsize) {
24564                 PyErr_SetString(PyExc_ValueError,
24565                                 "Buffer and memoryview are not contiguous "
24566                                 "in the same dimension.");
24567                 goto fail;
24568             }
24569         }
24570         if (spec & __Pyx_MEMVIEW_FOLLOW) {
24571             Py_ssize_t stride = buf->strides[dim];
24572             if (stride < 0)
24573                 stride = -stride;
24574             if (stride < buf->itemsize) {
24575                 PyErr_SetString(PyExc_ValueError,
24576                                 "Buffer and memoryview are not contiguous "
24577                                 "in the same dimension.");
24578                 goto fail;
24579             }
24580         }
24581     } else {
24582         if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
24583             PyErr_Format(PyExc_ValueError,
24584                          "C-contiguous buffer is not contiguous in "
24585                          "dimension %d", dim);
24586             goto fail;
24587         } else if (spec & (__Pyx_MEMVIEW_PTR)) {
24588             PyErr_Format(PyExc_ValueError,
24589                          "C-contiguous buffer is not indirect in "
24590                          "dimension %d", dim);
24591             goto fail;
24592         } else if (buf->suboffsets) {
24593             PyErr_SetString(PyExc_ValueError,
24594                             "Buffer exposes suboffsets but no strides");
24595             goto fail;
24596         }
24597     }
24598     return 1;
24599 fail:
24600     return 0;
24601 }
24602 static int
__pyx_check_suboffsets(Py_buffer * buf,int dim,CYTHON_UNUSED int ndim,int spec)24603 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
24604 {
24605     if (spec & __Pyx_MEMVIEW_DIRECT) {
24606         if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
24607             PyErr_Format(PyExc_ValueError,
24608                          "Buffer not compatible with direct access "
24609                          "in dimension %d.", dim);
24610             goto fail;
24611         }
24612     }
24613     if (spec & __Pyx_MEMVIEW_PTR) {
24614         if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
24615             PyErr_Format(PyExc_ValueError,
24616                          "Buffer is not indirectly accessible "
24617                          "in dimension %d.", dim);
24618             goto fail;
24619         }
24620     }
24621     return 1;
24622 fail:
24623     return 0;
24624 }
24625 static int
__pyx_verify_contig(Py_buffer * buf,int ndim,int c_or_f_flag)24626 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
24627 {
24628     int i;
24629     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
24630         Py_ssize_t stride = 1;
24631         for (i = 0; i < ndim; i++) {
24632             if (stride * buf->itemsize != buf->strides[i] &&
24633                     buf->shape[i] > 1)
24634             {
24635                 PyErr_SetString(PyExc_ValueError,
24636                     "Buffer not fortran contiguous.");
24637                 goto fail;
24638             }
24639             stride = stride * buf->shape[i];
24640         }
24641     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
24642         Py_ssize_t stride = 1;
24643         for (i = ndim - 1; i >- 1; i--) {
24644             if (stride * buf->itemsize != buf->strides[i] &&
24645                     buf->shape[i] > 1) {
24646                 PyErr_SetString(PyExc_ValueError,
24647                     "Buffer not C contiguous.");
24648                 goto fail;
24649             }
24650             stride = stride * buf->shape[i];
24651         }
24652     }
24653     return 1;
24654 fail:
24655     return 0;
24656 }
__Pyx_ValidateAndInit_memviewslice(int * axes_specs,int c_or_f_flag,int buf_flags,int ndim,__Pyx_TypeInfo * dtype,__Pyx_BufFmt_StackElem stack[],__Pyx_memviewslice * memviewslice,PyObject * original_obj)24657 static int __Pyx_ValidateAndInit_memviewslice(
24658                 int *axes_specs,
24659                 int c_or_f_flag,
24660                 int buf_flags,
24661                 int ndim,
24662                 __Pyx_TypeInfo *dtype,
24663                 __Pyx_BufFmt_StackElem stack[],
24664                 __Pyx_memviewslice *memviewslice,
24665                 PyObject *original_obj)
24666 {
24667     struct __pyx_memoryview_obj *memview, *new_memview;
24668     __Pyx_RefNannyDeclarations
24669     Py_buffer *buf;
24670     int i, spec = 0, retval = -1;
24671     __Pyx_BufFmt_Context ctx;
24672     int from_memoryview = __pyx_memoryview_check(original_obj);
24673     __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
24674     if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
24675                                                             original_obj)->typeinfo)) {
24676         memview = (struct __pyx_memoryview_obj *) original_obj;
24677         new_memview = NULL;
24678     } else {
24679         memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
24680                                             original_obj, buf_flags, 0, dtype);
24681         new_memview = memview;
24682         if (unlikely(!memview))
24683             goto fail;
24684     }
24685     buf = &memview->view;
24686     if (buf->ndim != ndim) {
24687         PyErr_Format(PyExc_ValueError,
24688                 "Buffer has wrong number of dimensions (expected %d, got %d)",
24689                 ndim, buf->ndim);
24690         goto fail;
24691     }
24692     if (new_memview) {
24693         __Pyx_BufFmt_Init(&ctx, stack, dtype);
24694         if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
24695     }
24696     if ((unsigned) buf->itemsize != dtype->size) {
24697         PyErr_Format(PyExc_ValueError,
24698                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
24699                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
24700                      buf->itemsize,
24701                      (buf->itemsize > 1) ? "s" : "",
24702                      dtype->name,
24703                      dtype->size,
24704                      (dtype->size > 1) ? "s" : "");
24705         goto fail;
24706     }
24707     for (i = 0; i < ndim; i++) {
24708         spec = axes_specs[i];
24709         if (!__pyx_check_strides(buf, i, ndim, spec))
24710             goto fail;
24711         if (!__pyx_check_suboffsets(buf, i, ndim, spec))
24712             goto fail;
24713     }
24714     if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
24715         goto fail;
24716     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
24717                                          new_memview != NULL) == -1)) {
24718         goto fail;
24719     }
24720     retval = 0;
24721     goto no_fail;
24722 fail:
24723     Py_XDECREF(new_memview);
24724     retval = -1;
24725 no_fail:
24726     __Pyx_RefNannyFinishContext();
24727     return retval;
24728 }
24729 
24730 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject * obj,int writable_flag)24731   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *obj, int writable_flag) {
24732     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
24733     __Pyx_BufFmt_StackElem stack[1];
24734     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
24735     int retcode;
24736     if (obj == Py_None) {
24737         result.memview = (struct __pyx_memoryview_obj *) Py_None;
24738         return result;
24739     }
24740     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
24741                                                  PyBUF_RECORDS_RO | writable_flag, 1,
24742                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
24743                                                  &result, obj);
24744     if (unlikely(retcode == -1))
24745         goto __pyx_fail;
24746     return result;
24747 __pyx_fail:
24748     result.memview = NULL;
24749     result.data = NULL;
24750     return result;
24751 }
24752 
24753 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(PyObject * obj,int writable_flag)24754   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(PyObject *obj, int writable_flag) {
24755     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
24756     __Pyx_BufFmt_StackElem stack[1];
24757     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
24758     int retcode;
24759     if (obj == Py_None) {
24760         result.memview = (struct __pyx_memoryview_obj *) Py_None;
24761         return result;
24762     }
24763     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
24764                                                  PyBUF_RECORDS_RO | writable_flag, 2,
24765                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
24766                                                  &result, obj);
24767     if (unlikely(retcode == -1))
24768         goto __pyx_fail;
24769     return result;
24770 __pyx_fail:
24771     result.memview = NULL;
24772     result.data = NULL;
24773     return result;
24774 }
24775 
24776 /* CIntToPy */
__Pyx_PyInt_From_int(int value)24777   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
24778     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
24779     const int is_unsigned = neg_one > const_zero;
24780     if (is_unsigned) {
24781         if (sizeof(int) < sizeof(long)) {
24782             return PyInt_FromLong((long) value);
24783         } else if (sizeof(int) <= sizeof(unsigned long)) {
24784             return PyLong_FromUnsignedLong((unsigned long) value);
24785 #ifdef HAVE_LONG_LONG
24786         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
24787             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
24788 #endif
24789         }
24790     } else {
24791         if (sizeof(int) <= sizeof(long)) {
24792             return PyInt_FromLong((long) value);
24793 #ifdef HAVE_LONG_LONG
24794         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
24795             return PyLong_FromLongLong((PY_LONG_LONG) value);
24796 #endif
24797         }
24798     }
24799     {
24800         int one = 1; int little = (int)*(unsigned char *)&one;
24801         unsigned char *bytes = (unsigned char *)&value;
24802         return _PyLong_FromByteArray(bytes, sizeof(int),
24803                                      little, !is_unsigned);
24804     }
24805 }
24806 
24807 /* CIntToPy */
__Pyx_PyInt_From_long(long value)24808   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
24809     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
24810     const int is_unsigned = neg_one > const_zero;
24811     if (is_unsigned) {
24812         if (sizeof(long) < sizeof(long)) {
24813             return PyInt_FromLong((long) value);
24814         } else if (sizeof(long) <= sizeof(unsigned long)) {
24815             return PyLong_FromUnsignedLong((unsigned long) value);
24816 #ifdef HAVE_LONG_LONG
24817         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
24818             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
24819 #endif
24820         }
24821     } else {
24822         if (sizeof(long) <= sizeof(long)) {
24823             return PyInt_FromLong((long) value);
24824 #ifdef HAVE_LONG_LONG
24825         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
24826             return PyLong_FromLongLong((PY_LONG_LONG) value);
24827 #endif
24828         }
24829     }
24830     {
24831         int one = 1; int little = (int)*(unsigned char *)&one;
24832         unsigned char *bytes = (unsigned char *)&value;
24833         return _PyLong_FromByteArray(bytes, sizeof(long),
24834                                      little, !is_unsigned);
24835     }
24836 }
24837 
24838 /* CIntToPy */
__Pyx_PyInt_From_npy_int64(npy_int64 value)24839   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) {
24840     const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
24841     const int is_unsigned = neg_one > const_zero;
24842     if (is_unsigned) {
24843         if (sizeof(npy_int64) < sizeof(long)) {
24844             return PyInt_FromLong((long) value);
24845         } else if (sizeof(npy_int64) <= sizeof(unsigned long)) {
24846             return PyLong_FromUnsignedLong((unsigned long) value);
24847 #ifdef HAVE_LONG_LONG
24848         } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
24849             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
24850 #endif
24851         }
24852     } else {
24853         if (sizeof(npy_int64) <= sizeof(long)) {
24854             return PyInt_FromLong((long) value);
24855 #ifdef HAVE_LONG_LONG
24856         } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
24857             return PyLong_FromLongLong((PY_LONG_LONG) value);
24858 #endif
24859         }
24860     }
24861     {
24862         int one = 1; int little = (int)*(unsigned char *)&one;
24863         unsigned char *bytes = (unsigned char *)&value;
24864         return _PyLong_FromByteArray(bytes, sizeof(npy_int64),
24865                                      little, !is_unsigned);
24866     }
24867 }
24868 
24869 /* Declarations */
24870   #if CYTHON_CCOMPLEX
24871   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)24872     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
24873       return ::std::complex< float >(x, y);
24874     }
24875   #else
__pyx_t_float_complex_from_parts(float x,float y)24876     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
24877       return x + y*(__pyx_t_float_complex)_Complex_I;
24878     }
24879   #endif
24880 #else
__pyx_t_float_complex_from_parts(float x,float y)24881     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
24882       __pyx_t_float_complex z;
24883       z.real = x;
24884       z.imag = y;
24885       return z;
24886     }
24887 #endif
24888 
24889 /* Arithmetic */
24890   #if CYTHON_CCOMPLEX
24891 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24892     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24893        return (a.real == b.real) && (a.imag == b.imag);
24894     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24895     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24896         __pyx_t_float_complex z;
24897         z.real = a.real + b.real;
24898         z.imag = a.imag + b.imag;
24899         return z;
24900     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24901     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24902         __pyx_t_float_complex z;
24903         z.real = a.real - b.real;
24904         z.imag = a.imag - b.imag;
24905         return z;
24906     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24907     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24908         __pyx_t_float_complex z;
24909         z.real = a.real * b.real - a.imag * b.imag;
24910         z.imag = a.real * b.imag + a.imag * b.real;
24911         return z;
24912     }
24913     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24914     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24915         if (b.imag == 0) {
24916             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
24917         } else if (fabsf(b.real) >= fabsf(b.imag)) {
24918             if (b.real == 0 && b.imag == 0) {
24919                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
24920             } else {
24921                 float r = b.imag / b.real;
24922                 float s = (float)(1.0) / (b.real + b.imag * r);
24923                 return __pyx_t_float_complex_from_parts(
24924                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
24925             }
24926         } else {
24927             float r = b.real / b.imag;
24928             float s = (float)(1.0) / (b.imag + b.real * r);
24929             return __pyx_t_float_complex_from_parts(
24930                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
24931         }
24932     }
24933     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24934     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24935         if (b.imag == 0) {
24936             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
24937         } else {
24938             float denom = b.real * b.real + b.imag * b.imag;
24939             return __pyx_t_float_complex_from_parts(
24940                 (a.real * b.real + a.imag * b.imag) / denom,
24941                 (a.imag * b.real - a.real * b.imag) / denom);
24942         }
24943     }
24944     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)24945     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
24946         __pyx_t_float_complex z;
24947         z.real = -a.real;
24948         z.imag = -a.imag;
24949         return z;
24950     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)24951     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
24952        return (a.real == 0) && (a.imag == 0);
24953     }
__Pyx_c_conj_float(__pyx_t_float_complex a)24954     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
24955         __pyx_t_float_complex z;
24956         z.real =  a.real;
24957         z.imag = -a.imag;
24958         return z;
24959     }
24960     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)24961         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
24962           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
24963             return sqrtf(z.real*z.real + z.imag*z.imag);
24964           #else
24965             return hypotf(z.real, z.imag);
24966           #endif
24967         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)24968         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
24969             __pyx_t_float_complex z;
24970             float r, lnr, theta, z_r, z_theta;
24971             if (b.imag == 0 && b.real == (int)b.real) {
24972                 if (b.real < 0) {
24973                     float denom = a.real * a.real + a.imag * a.imag;
24974                     a.real = a.real / denom;
24975                     a.imag = -a.imag / denom;
24976                     b.real = -b.real;
24977                 }
24978                 switch ((int)b.real) {
24979                     case 0:
24980                         z.real = 1;
24981                         z.imag = 0;
24982                         return z;
24983                     case 1:
24984                         return a;
24985                     case 2:
24986                         z = __Pyx_c_prod_float(a, a);
24987                         return __Pyx_c_prod_float(a, a);
24988                     case 3:
24989                         z = __Pyx_c_prod_float(a, a);
24990                         return __Pyx_c_prod_float(z, a);
24991                     case 4:
24992                         z = __Pyx_c_prod_float(a, a);
24993                         return __Pyx_c_prod_float(z, z);
24994                 }
24995             }
24996             if (a.imag == 0) {
24997                 if (a.real == 0) {
24998                     return a;
24999                 } else if (b.imag == 0) {
25000                     z.real = powf(a.real, b.real);
25001                     z.imag = 0;
25002                     return z;
25003                 } else if (a.real > 0) {
25004                     r = a.real;
25005                     theta = 0;
25006                 } else {
25007                     r = -a.real;
25008                     theta = atan2f(0.0, -1.0);
25009                 }
25010             } else {
25011                 r = __Pyx_c_abs_float(a);
25012                 theta = atan2f(a.imag, a.real);
25013             }
25014             lnr = logf(r);
25015             z_r = expf(lnr * b.real - theta * b.imag);
25016             z_theta = theta * b.real + lnr * b.imag;
25017             z.real = z_r * cosf(z_theta);
25018             z.imag = z_r * sinf(z_theta);
25019             return z;
25020         }
25021     #endif
25022 #endif
25023 
25024 /* Declarations */
25025   #if CYTHON_CCOMPLEX
25026   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)25027     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25028       return ::std::complex< double >(x, y);
25029     }
25030   #else
__pyx_t_double_complex_from_parts(double x,double y)25031     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25032       return x + y*(__pyx_t_double_complex)_Complex_I;
25033     }
25034   #endif
25035 #else
__pyx_t_double_complex_from_parts(double x,double y)25036     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25037       __pyx_t_double_complex z;
25038       z.real = x;
25039       z.imag = y;
25040       return z;
25041     }
25042 #endif
25043 
25044 /* Arithmetic */
25045   #if CYTHON_CCOMPLEX
25046 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25047     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25048        return (a.real == b.real) && (a.imag == b.imag);
25049     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25050     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25051         __pyx_t_double_complex z;
25052         z.real = a.real + b.real;
25053         z.imag = a.imag + b.imag;
25054         return z;
25055     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25056     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25057         __pyx_t_double_complex z;
25058         z.real = a.real - b.real;
25059         z.imag = a.imag - b.imag;
25060         return z;
25061     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25062     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25063         __pyx_t_double_complex z;
25064         z.real = a.real * b.real - a.imag * b.imag;
25065         z.imag = a.real * b.imag + a.imag * b.real;
25066         return z;
25067     }
25068     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25069     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25070         if (b.imag == 0) {
25071             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25072         } else if (fabs(b.real) >= fabs(b.imag)) {
25073             if (b.real == 0 && b.imag == 0) {
25074                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
25075             } else {
25076                 double r = b.imag / b.real;
25077                 double s = (double)(1.0) / (b.real + b.imag * r);
25078                 return __pyx_t_double_complex_from_parts(
25079                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25080             }
25081         } else {
25082             double r = b.real / b.imag;
25083             double s = (double)(1.0) / (b.imag + b.real * r);
25084             return __pyx_t_double_complex_from_parts(
25085                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25086         }
25087     }
25088     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25089     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25090         if (b.imag == 0) {
25091             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25092         } else {
25093             double denom = b.real * b.real + b.imag * b.imag;
25094             return __pyx_t_double_complex_from_parts(
25095                 (a.real * b.real + a.imag * b.imag) / denom,
25096                 (a.imag * b.real - a.real * b.imag) / denom);
25097         }
25098     }
25099     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)25100     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
25101         __pyx_t_double_complex z;
25102         z.real = -a.real;
25103         z.imag = -a.imag;
25104         return z;
25105     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)25106     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
25107        return (a.real == 0) && (a.imag == 0);
25108     }
__Pyx_c_conj_double(__pyx_t_double_complex a)25109     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
25110         __pyx_t_double_complex z;
25111         z.real =  a.real;
25112         z.imag = -a.imag;
25113         return z;
25114     }
25115     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)25116         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
25117           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25118             return sqrt(z.real*z.real + z.imag*z.imag);
25119           #else
25120             return hypot(z.real, z.imag);
25121           #endif
25122         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25123         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25124             __pyx_t_double_complex z;
25125             double r, lnr, theta, z_r, z_theta;
25126             if (b.imag == 0 && b.real == (int)b.real) {
25127                 if (b.real < 0) {
25128                     double denom = a.real * a.real + a.imag * a.imag;
25129                     a.real = a.real / denom;
25130                     a.imag = -a.imag / denom;
25131                     b.real = -b.real;
25132                 }
25133                 switch ((int)b.real) {
25134                     case 0:
25135                         z.real = 1;
25136                         z.imag = 0;
25137                         return z;
25138                     case 1:
25139                         return a;
25140                     case 2:
25141                         z = __Pyx_c_prod_double(a, a);
25142                         return __Pyx_c_prod_double(a, a);
25143                     case 3:
25144                         z = __Pyx_c_prod_double(a, a);
25145                         return __Pyx_c_prod_double(z, a);
25146                     case 4:
25147                         z = __Pyx_c_prod_double(a, a);
25148                         return __Pyx_c_prod_double(z, z);
25149                 }
25150             }
25151             if (a.imag == 0) {
25152                 if (a.real == 0) {
25153                     return a;
25154                 } else if (b.imag == 0) {
25155                     z.real = pow(a.real, b.real);
25156                     z.imag = 0;
25157                     return z;
25158                 } else if (a.real > 0) {
25159                     r = a.real;
25160                     theta = 0;
25161                 } else {
25162                     r = -a.real;
25163                     theta = atan2(0.0, -1.0);
25164                 }
25165             } else {
25166                 r = __Pyx_c_abs_double(a);
25167                 theta = atan2(a.imag, a.real);
25168             }
25169             lnr = log(r);
25170             z_r = exp(lnr * b.real - theta * b.imag);
25171             z_theta = theta * b.real + lnr * b.imag;
25172             z.real = z_r * cos(z_theta);
25173             z.imag = z_r * sin(z_theta);
25174             return z;
25175         }
25176     #endif
25177 #endif
25178 
25179 /* CIntToPy */
__Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value)25180   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
25181     const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
25182     const int is_unsigned = neg_one > const_zero;
25183     if (is_unsigned) {
25184         if (sizeof(enum NPY_TYPES) < sizeof(long)) {
25185             return PyInt_FromLong((long) value);
25186         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
25187             return PyLong_FromUnsignedLong((unsigned long) value);
25188 #ifdef HAVE_LONG_LONG
25189         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
25190             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
25191 #endif
25192         }
25193     } else {
25194         if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
25195             return PyInt_FromLong((long) value);
25196 #ifdef HAVE_LONG_LONG
25197         } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
25198             return PyLong_FromLongLong((PY_LONG_LONG) value);
25199 #endif
25200         }
25201     }
25202     {
25203         int one = 1; int little = (int)*(unsigned char *)&one;
25204         unsigned char *bytes = (unsigned char *)&value;
25205         return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
25206                                      little, !is_unsigned);
25207     }
25208 }
25209 
25210 /* MemviewSliceCopyTemplate */
25211   static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice * from_mvs,const char * mode,int ndim,size_t sizeof_dtype,int contig_flag,int dtype_is_object)25212 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
25213                                  const char *mode, int ndim,
25214                                  size_t sizeof_dtype, int contig_flag,
25215                                  int dtype_is_object)
25216 {
25217     __Pyx_RefNannyDeclarations
25218     int i;
25219     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
25220     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
25221     Py_buffer *buf = &from_memview->view;
25222     PyObject *shape_tuple = NULL;
25223     PyObject *temp_int = NULL;
25224     struct __pyx_array_obj *array_obj = NULL;
25225     struct __pyx_memoryview_obj *memview_obj = NULL;
25226     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
25227     for (i = 0; i < ndim; i++) {
25228         if (from_mvs->suboffsets[i] >= 0) {
25229             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
25230                                            "indirect dimensions (axis %d)", i);
25231             goto fail;
25232         }
25233     }
25234     shape_tuple = PyTuple_New(ndim);
25235     if (unlikely(!shape_tuple)) {
25236         goto fail;
25237     }
25238     __Pyx_GOTREF(shape_tuple);
25239     for(i = 0; i < ndim; i++) {
25240         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
25241         if(unlikely(!temp_int)) {
25242             goto fail;
25243         } else {
25244             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
25245             temp_int = NULL;
25246         }
25247     }
25248     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
25249     if (unlikely(!array_obj)) {
25250         goto fail;
25251     }
25252     __Pyx_GOTREF(array_obj);
25253     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
25254                                     (PyObject *) array_obj, contig_flag,
25255                                     dtype_is_object,
25256                                     from_mvs->memview->typeinfo);
25257     if (unlikely(!memview_obj))
25258         goto fail;
25259     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
25260         goto fail;
25261     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
25262                                                 dtype_is_object) < 0))
25263         goto fail;
25264     goto no_fail;
25265 fail:
25266     __Pyx_XDECREF(new_mvs.memview);
25267     new_mvs.memview = NULL;
25268     new_mvs.data = NULL;
25269 no_fail:
25270     __Pyx_XDECREF(shape_tuple);
25271     __Pyx_XDECREF(temp_int);
25272     __Pyx_XDECREF(array_obj);
25273     __Pyx_RefNannyFinishContext();
25274     return new_mvs;
25275 }
25276 
25277 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)25278   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
25279     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
25280     const int is_unsigned = neg_one > const_zero;
25281 #if PY_MAJOR_VERSION < 3
25282     if (likely(PyInt_Check(x))) {
25283         if (sizeof(int) < sizeof(long)) {
25284             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
25285         } else {
25286             long val = PyInt_AS_LONG(x);
25287             if (is_unsigned && unlikely(val < 0)) {
25288                 goto raise_neg_overflow;
25289             }
25290             return (int) val;
25291         }
25292     } else
25293 #endif
25294     if (likely(PyLong_Check(x))) {
25295         if (is_unsigned) {
25296 #if CYTHON_USE_PYLONG_INTERNALS
25297             const digit* digits = ((PyLongObject*)x)->ob_digit;
25298             switch (Py_SIZE(x)) {
25299                 case  0: return (int) 0;
25300                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
25301                 case 2:
25302                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25303                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25304                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25305                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
25306                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25307                         }
25308                     }
25309                     break;
25310                 case 3:
25311                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25312                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25313                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25314                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
25315                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25316                         }
25317                     }
25318                     break;
25319                 case 4:
25320                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25321                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25322                             __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])))
25323                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
25324                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25325                         }
25326                     }
25327                     break;
25328             }
25329 #endif
25330 #if CYTHON_COMPILING_IN_CPYTHON
25331             if (unlikely(Py_SIZE(x) < 0)) {
25332                 goto raise_neg_overflow;
25333             }
25334 #else
25335             {
25336                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25337                 if (unlikely(result < 0))
25338                     return (int) -1;
25339                 if (unlikely(result == 1))
25340                     goto raise_neg_overflow;
25341             }
25342 #endif
25343             if (sizeof(int) <= sizeof(unsigned long)) {
25344                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
25345 #ifdef HAVE_LONG_LONG
25346             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
25347                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25348 #endif
25349             }
25350         } else {
25351 #if CYTHON_USE_PYLONG_INTERNALS
25352             const digit* digits = ((PyLongObject*)x)->ob_digit;
25353             switch (Py_SIZE(x)) {
25354                 case  0: return (int) 0;
25355                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
25356                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
25357                 case -2:
25358                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
25359                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25360                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25361                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25362                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25363                         }
25364                     }
25365                     break;
25366                 case 2:
25367                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25368                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25369                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25370                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25371                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25372                         }
25373                     }
25374                     break;
25375                 case -3:
25376                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25377                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25378                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25379                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25380                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25381                         }
25382                     }
25383                     break;
25384                 case 3:
25385                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25386                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25387                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25388                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25389                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25390                         }
25391                     }
25392                     break;
25393                 case -4:
25394                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25395                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25396                             __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])))
25397                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25398                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25399                         }
25400                     }
25401                     break;
25402                 case 4:
25403                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25404                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25405                             __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])))
25406                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25407                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25408                         }
25409                     }
25410                     break;
25411             }
25412 #endif
25413             if (sizeof(int) <= sizeof(long)) {
25414                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
25415 #ifdef HAVE_LONG_LONG
25416             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
25417                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
25418 #endif
25419             }
25420         }
25421         {
25422 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25423             PyErr_SetString(PyExc_RuntimeError,
25424                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25425 #else
25426             int val;
25427             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25428  #if PY_MAJOR_VERSION < 3
25429             if (likely(v) && !PyLong_Check(v)) {
25430                 PyObject *tmp = v;
25431                 v = PyNumber_Long(tmp);
25432                 Py_DECREF(tmp);
25433             }
25434  #endif
25435             if (likely(v)) {
25436                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25437                 unsigned char *bytes = (unsigned char *)&val;
25438                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25439                                               bytes, sizeof(val),
25440                                               is_little, !is_unsigned);
25441                 Py_DECREF(v);
25442                 if (likely(!ret))
25443                     return val;
25444             }
25445 #endif
25446             return (int) -1;
25447         }
25448     } else {
25449         int val;
25450         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25451         if (!tmp) return (int) -1;
25452         val = __Pyx_PyInt_As_int(tmp);
25453         Py_DECREF(tmp);
25454         return val;
25455     }
25456 raise_overflow:
25457     PyErr_SetString(PyExc_OverflowError,
25458         "value too large to convert to int");
25459     return (int) -1;
25460 raise_neg_overflow:
25461     PyErr_SetString(PyExc_OverflowError,
25462         "can't convert negative value to int");
25463     return (int) -1;
25464 }
25465 
25466 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)25467   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
25468     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
25469     const int is_unsigned = neg_one > const_zero;
25470 #if PY_MAJOR_VERSION < 3
25471     if (likely(PyInt_Check(x))) {
25472         if (sizeof(long) < sizeof(long)) {
25473             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
25474         } else {
25475             long val = PyInt_AS_LONG(x);
25476             if (is_unsigned && unlikely(val < 0)) {
25477                 goto raise_neg_overflow;
25478             }
25479             return (long) val;
25480         }
25481     } else
25482 #endif
25483     if (likely(PyLong_Check(x))) {
25484         if (is_unsigned) {
25485 #if CYTHON_USE_PYLONG_INTERNALS
25486             const digit* digits = ((PyLongObject*)x)->ob_digit;
25487             switch (Py_SIZE(x)) {
25488                 case  0: return (long) 0;
25489                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
25490                 case 2:
25491                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25492                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25493                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25494                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
25495                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25496                         }
25497                     }
25498                     break;
25499                 case 3:
25500                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25501                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25502                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25503                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
25504                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25505                         }
25506                     }
25507                     break;
25508                 case 4:
25509                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25510                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25511                             __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])))
25512                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
25513                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25514                         }
25515                     }
25516                     break;
25517             }
25518 #endif
25519 #if CYTHON_COMPILING_IN_CPYTHON
25520             if (unlikely(Py_SIZE(x) < 0)) {
25521                 goto raise_neg_overflow;
25522             }
25523 #else
25524             {
25525                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25526                 if (unlikely(result < 0))
25527                     return (long) -1;
25528                 if (unlikely(result == 1))
25529                     goto raise_neg_overflow;
25530             }
25531 #endif
25532             if (sizeof(long) <= sizeof(unsigned long)) {
25533                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
25534 #ifdef HAVE_LONG_LONG
25535             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
25536                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25537 #endif
25538             }
25539         } else {
25540 #if CYTHON_USE_PYLONG_INTERNALS
25541             const digit* digits = ((PyLongObject*)x)->ob_digit;
25542             switch (Py_SIZE(x)) {
25543                 case  0: return (long) 0;
25544                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
25545                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
25546                 case -2:
25547                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
25548                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25549                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25550                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25551                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25552                         }
25553                     }
25554                     break;
25555                 case 2:
25556                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25557                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25558                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25559                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25560                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25561                         }
25562                     }
25563                     break;
25564                 case -3:
25565                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25566                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25567                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25568                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25569                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25570                         }
25571                     }
25572                     break;
25573                 case 3:
25574                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25575                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25576                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25577                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25578                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25579                         }
25580                     }
25581                     break;
25582                 case -4:
25583                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25584                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25585                             __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])))
25586                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25587                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25588                         }
25589                     }
25590                     break;
25591                 case 4:
25592                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25593                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25594                             __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])))
25595                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25596                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25597                         }
25598                     }
25599                     break;
25600             }
25601 #endif
25602             if (sizeof(long) <= sizeof(long)) {
25603                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
25604 #ifdef HAVE_LONG_LONG
25605             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
25606                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
25607 #endif
25608             }
25609         }
25610         {
25611 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25612             PyErr_SetString(PyExc_RuntimeError,
25613                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25614 #else
25615             long val;
25616             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25617  #if PY_MAJOR_VERSION < 3
25618             if (likely(v) && !PyLong_Check(v)) {
25619                 PyObject *tmp = v;
25620                 v = PyNumber_Long(tmp);
25621                 Py_DECREF(tmp);
25622             }
25623  #endif
25624             if (likely(v)) {
25625                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25626                 unsigned char *bytes = (unsigned char *)&val;
25627                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25628                                               bytes, sizeof(val),
25629                                               is_little, !is_unsigned);
25630                 Py_DECREF(v);
25631                 if (likely(!ret))
25632                     return val;
25633             }
25634 #endif
25635             return (long) -1;
25636         }
25637     } else {
25638         long val;
25639         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25640         if (!tmp) return (long) -1;
25641         val = __Pyx_PyInt_As_long(tmp);
25642         Py_DECREF(tmp);
25643         return val;
25644     }
25645 raise_overflow:
25646     PyErr_SetString(PyExc_OverflowError,
25647         "value too large to convert to long");
25648     return (long) -1;
25649 raise_neg_overflow:
25650     PyErr_SetString(PyExc_OverflowError,
25651         "can't convert negative value to long");
25652     return (long) -1;
25653 }
25654 
25655 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)25656   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
25657     const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
25658     const int is_unsigned = neg_one > const_zero;
25659 #if PY_MAJOR_VERSION < 3
25660     if (likely(PyInt_Check(x))) {
25661         if (sizeof(char) < sizeof(long)) {
25662             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
25663         } else {
25664             long val = PyInt_AS_LONG(x);
25665             if (is_unsigned && unlikely(val < 0)) {
25666                 goto raise_neg_overflow;
25667             }
25668             return (char) val;
25669         }
25670     } else
25671 #endif
25672     if (likely(PyLong_Check(x))) {
25673         if (is_unsigned) {
25674 #if CYTHON_USE_PYLONG_INTERNALS
25675             const digit* digits = ((PyLongObject*)x)->ob_digit;
25676             switch (Py_SIZE(x)) {
25677                 case  0: return (char) 0;
25678                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
25679                 case 2:
25680                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
25681                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25682                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25683                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
25684                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
25685                         }
25686                     }
25687                     break;
25688                 case 3:
25689                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
25690                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25691                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25692                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
25693                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
25694                         }
25695                     }
25696                     break;
25697                 case 4:
25698                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
25699                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25700                             __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])))
25701                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
25702                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
25703                         }
25704                     }
25705                     break;
25706             }
25707 #endif
25708 #if CYTHON_COMPILING_IN_CPYTHON
25709             if (unlikely(Py_SIZE(x) < 0)) {
25710                 goto raise_neg_overflow;
25711             }
25712 #else
25713             {
25714                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25715                 if (unlikely(result < 0))
25716                     return (char) -1;
25717                 if (unlikely(result == 1))
25718                     goto raise_neg_overflow;
25719             }
25720 #endif
25721             if (sizeof(char) <= sizeof(unsigned long)) {
25722                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
25723 #ifdef HAVE_LONG_LONG
25724             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
25725                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25726 #endif
25727             }
25728         } else {
25729 #if CYTHON_USE_PYLONG_INTERNALS
25730             const digit* digits = ((PyLongObject*)x)->ob_digit;
25731             switch (Py_SIZE(x)) {
25732                 case  0: return (char) 0;
25733                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
25734                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
25735                 case -2:
25736                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
25737                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25738                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25739                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
25740                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
25741                         }
25742                     }
25743                     break;
25744                 case 2:
25745                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
25746                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25747                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25748                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
25749                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
25750                         }
25751                     }
25752                     break;
25753                 case -3:
25754                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
25755                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25756                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25757                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
25758                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
25759                         }
25760                     }
25761                     break;
25762                 case 3:
25763                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
25764                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25765                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25766                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
25767                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
25768                         }
25769                     }
25770                     break;
25771                 case -4:
25772                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
25773                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25774                             __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])))
25775                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
25776                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
25777                         }
25778                     }
25779                     break;
25780                 case 4:
25781                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
25782                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25783                             __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])))
25784                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
25785                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
25786                         }
25787                     }
25788                     break;
25789             }
25790 #endif
25791             if (sizeof(char) <= sizeof(long)) {
25792                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
25793 #ifdef HAVE_LONG_LONG
25794             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
25795                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
25796 #endif
25797             }
25798         }
25799         {
25800 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25801             PyErr_SetString(PyExc_RuntimeError,
25802                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25803 #else
25804             char val;
25805             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25806  #if PY_MAJOR_VERSION < 3
25807             if (likely(v) && !PyLong_Check(v)) {
25808                 PyObject *tmp = v;
25809                 v = PyNumber_Long(tmp);
25810                 Py_DECREF(tmp);
25811             }
25812  #endif
25813             if (likely(v)) {
25814                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25815                 unsigned char *bytes = (unsigned char *)&val;
25816                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25817                                               bytes, sizeof(val),
25818                                               is_little, !is_unsigned);
25819                 Py_DECREF(v);
25820                 if (likely(!ret))
25821                     return val;
25822             }
25823 #endif
25824             return (char) -1;
25825         }
25826     } else {
25827         char val;
25828         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25829         if (!tmp) return (char) -1;
25830         val = __Pyx_PyInt_As_char(tmp);
25831         Py_DECREF(tmp);
25832         return val;
25833     }
25834 raise_overflow:
25835     PyErr_SetString(PyExc_OverflowError,
25836         "value too large to convert to char");
25837     return (char) -1;
25838 raise_neg_overflow:
25839     PyErr_SetString(PyExc_OverflowError,
25840         "can't convert negative value to char");
25841     return (char) -1;
25842 }
25843 
25844 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)25845   static int __Pyx_check_binary_version(void) {
25846     char ctversion[4], rtversion[4];
25847     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
25848     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
25849     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
25850         char message[200];
25851         PyOS_snprintf(message, sizeof(message),
25852                       "compiletime version %s of module '%.100s' "
25853                       "does not match runtime version %s",
25854                       ctversion, __Pyx_MODULE_NAME, rtversion);
25855         return PyErr_WarnEx(NULL, message, 1);
25856     }
25857     return 0;
25858 }
25859 
25860 /* FunctionExport */
__Pyx_ExportFunction(const char * name,void (* f)(void),const char * sig)25861   static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
25862     PyObject *d = 0;
25863     PyObject *cobj = 0;
25864     union {
25865         void (*fp)(void);
25866         void *p;
25867     } tmp;
25868     d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
25869     if (!d) {
25870         PyErr_Clear();
25871         d = PyDict_New();
25872         if (!d)
25873             goto bad;
25874         Py_INCREF(d);
25875         if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
25876             goto bad;
25877     }
25878     tmp.fp = f;
25879 #if PY_VERSION_HEX >= 0x02070000
25880     cobj = PyCapsule_New(tmp.p, sig, 0);
25881 #else
25882     cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
25883 #endif
25884     if (!cobj)
25885         goto bad;
25886     if (PyDict_SetItemString(d, name, cobj) < 0)
25887         goto bad;
25888     Py_DECREF(cobj);
25889     Py_DECREF(d);
25890     return 0;
25891 bad:
25892     Py_XDECREF(cobj);
25893     Py_XDECREF(d);
25894     return -1;
25895 }
25896 
25897 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)25898   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
25899     while (t->p) {
25900         #if PY_MAJOR_VERSION < 3
25901         if (t->is_unicode) {
25902             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
25903         } else if (t->intern) {
25904             *t->p = PyString_InternFromString(t->s);
25905         } else {
25906             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
25907         }
25908         #else
25909         if (t->is_unicode | t->is_str) {
25910             if (t->intern) {
25911                 *t->p = PyUnicode_InternFromString(t->s);
25912             } else if (t->encoding) {
25913                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
25914             } else {
25915                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
25916             }
25917         } else {
25918             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
25919         }
25920         #endif
25921         if (!*t->p)
25922             return -1;
25923         if (PyObject_Hash(*t->p) == -1)
25924             return -1;
25925         ++t;
25926     }
25927     return 0;
25928 }
25929 
__Pyx_PyUnicode_FromString(const char * c_str)25930 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
25931     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
25932 }
__Pyx_PyObject_AsString(PyObject * o)25933 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
25934     Py_ssize_t ignore;
25935     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
25936 }
25937 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
25938 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)25939 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
25940     char* defenc_c;
25941     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
25942     if (!defenc) return NULL;
25943     defenc_c = PyBytes_AS_STRING(defenc);
25944 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
25945     {
25946         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
25947         char* c;
25948         for (c = defenc_c; c < end; c++) {
25949             if ((unsigned char) (*c) >= 128) {
25950                 PyUnicode_AsASCIIString(o);
25951                 return NULL;
25952             }
25953         }
25954     }
25955 #endif
25956     *length = PyBytes_GET_SIZE(defenc);
25957     return defenc_c;
25958 }
25959 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)25960 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
25961     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
25962 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
25963     if (likely(PyUnicode_IS_ASCII(o))) {
25964         *length = PyUnicode_GET_LENGTH(o);
25965         return PyUnicode_AsUTF8(o);
25966     } else {
25967         PyUnicode_AsASCIIString(o);
25968         return NULL;
25969     }
25970 #else
25971     return PyUnicode_AsUTF8AndSize(o, length);
25972 #endif
25973 }
25974 #endif
25975 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)25976 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
25977 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
25978     if (
25979 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
25980             __Pyx_sys_getdefaultencoding_not_ascii &&
25981 #endif
25982             PyUnicode_Check(o)) {
25983         return __Pyx_PyUnicode_AsStringAndSize(o, length);
25984     } else
25985 #endif
25986 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
25987     if (PyByteArray_Check(o)) {
25988         *length = PyByteArray_GET_SIZE(o);
25989         return PyByteArray_AS_STRING(o);
25990     } else
25991 #endif
25992     {
25993         char* result;
25994         int r = PyBytes_AsStringAndSize(o, &result, length);
25995         if (unlikely(r < 0)) {
25996             return NULL;
25997         } else {
25998             return result;
25999         }
26000     }
26001 }
__Pyx_PyObject_IsTrue(PyObject * x)26002 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
26003    int is_true = x == Py_True;
26004    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
26005    else return PyObject_IsTrue(x);
26006 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)26007 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
26008     int retval;
26009     if (unlikely(!x)) return -1;
26010     retval = __Pyx_PyObject_IsTrue(x);
26011     Py_DECREF(x);
26012     return retval;
26013 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)26014 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
26015 #if PY_MAJOR_VERSION >= 3
26016     if (PyLong_Check(result)) {
26017         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
26018                 "__int__ returned non-int (type %.200s).  "
26019                 "The ability to return an instance of a strict subclass of int "
26020                 "is deprecated, and may be removed in a future version of Python.",
26021                 Py_TYPE(result)->tp_name)) {
26022             Py_DECREF(result);
26023             return NULL;
26024         }
26025         return result;
26026     }
26027 #endif
26028     PyErr_Format(PyExc_TypeError,
26029                  "__%.4s__ returned non-%.4s (type %.200s)",
26030                  type_name, type_name, Py_TYPE(result)->tp_name);
26031     Py_DECREF(result);
26032     return NULL;
26033 }
__Pyx_PyNumber_IntOrLong(PyObject * x)26034 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
26035 #if CYTHON_USE_TYPE_SLOTS
26036   PyNumberMethods *m;
26037 #endif
26038   const char *name = NULL;
26039   PyObject *res = NULL;
26040 #if PY_MAJOR_VERSION < 3
26041   if (likely(PyInt_Check(x) || PyLong_Check(x)))
26042 #else
26043   if (likely(PyLong_Check(x)))
26044 #endif
26045     return __Pyx_NewRef(x);
26046 #if CYTHON_USE_TYPE_SLOTS
26047   m = Py_TYPE(x)->tp_as_number;
26048   #if PY_MAJOR_VERSION < 3
26049   if (m && m->nb_int) {
26050     name = "int";
26051     res = m->nb_int(x);
26052   }
26053   else if (m && m->nb_long) {
26054     name = "long";
26055     res = m->nb_long(x);
26056   }
26057   #else
26058   if (likely(m && m->nb_int)) {
26059     name = "int";
26060     res = m->nb_int(x);
26061   }
26062   #endif
26063 #else
26064   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
26065     res = PyNumber_Int(x);
26066   }
26067 #endif
26068   if (likely(res)) {
26069 #if PY_MAJOR_VERSION < 3
26070     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
26071 #else
26072     if (unlikely(!PyLong_CheckExact(res))) {
26073 #endif
26074         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
26075     }
26076   }
26077   else if (!PyErr_Occurred()) {
26078     PyErr_SetString(PyExc_TypeError,
26079                     "an integer is required");
26080   }
26081   return res;
26082 }
26083 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
26084   Py_ssize_t ival;
26085   PyObject *x;
26086 #if PY_MAJOR_VERSION < 3
26087   if (likely(PyInt_CheckExact(b))) {
26088     if (sizeof(Py_ssize_t) >= sizeof(long))
26089         return PyInt_AS_LONG(b);
26090     else
26091         return PyInt_AsSsize_t(b);
26092   }
26093 #endif
26094   if (likely(PyLong_CheckExact(b))) {
26095     #if CYTHON_USE_PYLONG_INTERNALS
26096     const digit* digits = ((PyLongObject*)b)->ob_digit;
26097     const Py_ssize_t size = Py_SIZE(b);
26098     if (likely(__Pyx_sst_abs(size) <= 1)) {
26099         ival = likely(size) ? digits[0] : 0;
26100         if (size == -1) ival = -ival;
26101         return ival;
26102     } else {
26103       switch (size) {
26104          case 2:
26105            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26106              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26107            }
26108            break;
26109          case -2:
26110            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26111              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26112            }
26113            break;
26114          case 3:
26115            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26116              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26117            }
26118            break;
26119          case -3:
26120            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26121              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26122            }
26123            break;
26124          case 4:
26125            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26126              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]));
26127            }
26128            break;
26129          case -4:
26130            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26131              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]));
26132            }
26133            break;
26134       }
26135     }
26136     #endif
26137     return PyLong_AsSsize_t(b);
26138   }
26139   x = PyNumber_Index(b);
26140   if (!x) return -1;
26141   ival = PyInt_AsSsize_t(x);
26142   Py_DECREF(x);
26143   return ival;
26144 }
26145 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
26146   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
26147 }
26148 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
26149     return PyInt_FromSize_t(ival);
26150 }
26151 
26152 
26153 #endif /* Py_PYTHON_H */
26154